From 7792856f74aad8382869361e219f77d4e0aa018a Mon Sep 17 00:00:00 2001 From: zielvna Date: Mon, 16 Dec 2024 18:04:31 +0100 Subject: [PATCH 1/2] fix layout issues and redirect issues --- src/components/Header/Header.tsx | 4 ++-- src/components/LiquidityPoolList/LiquidityPoolList.tsx | 8 ++++---- src/components/NewPosition/NewPosition.tsx | 6 +++--- src/components/PositionDetails/PositionDetails.tsx | 2 +- .../SinglePositionWrapper/SinglePositionWrapper.tsx | 6 +++--- src/pages/PortfolioPage/styles.ts | 3 ++- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/components/Header/Header.tsx b/src/components/Header/Header.tsx index 5e864890..e39e9c64 100644 --- a/src/components/Header/Header.tsx +++ b/src/components/Header/Header.tsx @@ -75,9 +75,9 @@ export const Header: React.FC = ({ const routes = ['exchange', 'liquidity', 'portfolio', 'statistics'] const otherRoutesToHighlight: Record = { - liquidity: [/^newPosition\/*/, /^position\/*/], + liquidity: [/^liquidity\/*/], exchange: [/^exchange\/*/], - portfolio: [/^portfolio\/*/] + portfolio: [/^portfolio\/*/, /^newPosition\/*/, /^position\/*/] // creator: [/^creator\/*/] } diff --git a/src/components/LiquidityPoolList/LiquidityPoolList.tsx b/src/components/LiquidityPoolList/LiquidityPoolList.tsx index a140e8bf..158e3a5e 100644 --- a/src/components/LiquidityPoolList/LiquidityPoolList.tsx +++ b/src/components/LiquidityPoolList/LiquidityPoolList.tsx @@ -110,10 +110,10 @@ const LiquidityPoolList: React.FC = ({ return data.sort((a, b) => (a.TVL === b.TVL ? a.volume - b.volume : a.TVL - b.TVL)) case SortTypePoolList.TVL_DESC: return data.sort((a, b) => (a.TVL === b.TVL ? b.volume - a.volume : b.TVL - a.TVL)) - // case SortType.APY_ASC: - // return data.sort((a, b) => a.apy - b.apy) - // case SortType.APY_DESC: - // return data.sort((a, b) => b.apy - a.apy) + case SortTypePoolList.APY_ASC: + return data.sort((a, b) => a.apy - b.apy) + case SortTypePoolList.APY_DESC: + return data.sort((a, b) => b.apy - a.apy) default: return data } diff --git a/src/components/NewPosition/NewPosition.tsx b/src/components/NewPosition/NewPosition.tsx index 8f3a696a..2fbee37b 100644 --- a/src/components/NewPosition/NewPosition.tsx +++ b/src/components/NewPosition/NewPosition.tsx @@ -371,11 +371,11 @@ export const NewPosition: React.FC = ({ const bestTierIndex = tokenA === null || tokenB === null ? undefined - : (bestTiers.find( + : bestTiers.find( tier => (tier.tokenX.equals(tokenA) && tier.tokenY.equals(tokenB)) || (tier.tokenX.equals(tokenB) && tier.tokenY.equals(tokenA)) - )?.bestTierIndex ?? undefined) + )?.bestTierIndex ?? undefined const getMinSliderIndex = () => { let minimumSliderIndex = 0 @@ -526,7 +526,7 @@ export const NewPosition: React.FC = ({ return ( - + back Positions diff --git a/src/components/PositionDetails/PositionDetails.tsx b/src/components/PositionDetails/PositionDetails.tsx index d5a155fd..f9bd606f 100644 --- a/src/components/PositionDetails/PositionDetails.tsx +++ b/src/components/PositionDetails/PositionDetails.tsx @@ -136,7 +136,7 @@ const PositionDetails: React.FC = ({ - + Back Positions diff --git a/src/containers/SinglePositionWrapper/SinglePositionWrapper.tsx b/src/containers/SinglePositionWrapper/SinglePositionWrapper.tsx index 957d7db5..7d8d1ddd 100644 --- a/src/containers/SinglePositionWrapper/SinglePositionWrapper.tsx +++ b/src/containers/SinglePositionWrapper/SinglePositionWrapper.tsx @@ -444,7 +444,7 @@ export const SinglePositionWrapper: React.FC = ({ id }) => { if (position?.positionIndex === undefined && isClosingPosition) { setIsClosingPosition(false) dispatch(connectionActions.setTimeoutError(false)) - navigate('/liquidity') + navigate('/portfolio') } else { dispatch(connectionActions.setTimeoutError(false)) onRefresh() @@ -474,7 +474,7 @@ export const SinglePositionWrapper: React.FC = ({ id }) => { actions.closePosition({ positionIndex: position.positionIndex, onSuccess: () => { - navigate('/liquidity') + navigate('/portfolio') }, claimFarmRewards }) @@ -569,7 +569,7 @@ export const SinglePositionWrapper: React.FC = ({ id }) => { className={classes.fullHeightContainer}> navigate('/liquidity')} + onAction={() => navigate('/portfolio')} buttonName='Back to positions' /> diff --git a/src/pages/PortfolioPage/styles.ts b/src/pages/PortfolioPage/styles.ts index d061c0ae..727d4aab 100644 --- a/src/pages/PortfolioPage/styles.ts +++ b/src/pages/PortfolioPage/styles.ts @@ -24,7 +24,8 @@ const useStyles = makeStyles()(theme => { } }, innerContainer: { - maxWidth: 1072, + maxWidth: 1210, + minHeight: '70vh', [theme.breakpoints.down('md')]: { width: '100%' From 8b1f7b08501ca06085d3815747d09134cc74e902 Mon Sep 17 00:00:00 2001 From: zielvna Date: Mon, 16 Dec 2024 18:26:43 +0100 Subject: [PATCH 2/2] fix trunk issues --- package-lock.json | 157 +++++++++++++++++++++ package.json | 1 + src/components/NewPosition/NewPosition.tsx | 4 +- 3 files changed, 160 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 726be152..fa626e4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,6 +66,7 @@ "@storybook/react": "^8.1.10", "@storybook/react-vite": "^8.1.10", "@storybook/test": "^8.1.10", + "@trunkio/launcher": "^1.3.4", "@types/node": "^20.12.7", "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", @@ -6308,6 +6309,37 @@ "@testing-library/dom": ">=7.21.4" } }, + "node_modules/@trunkio/launcher": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@trunkio/launcher/-/launcher-1.3.4.tgz", + "integrity": "sha512-4LCsFVvZtKht7EkbOq5gDsRLIBOH05ycNxm1Vrv+YzY+uOK2HueLBcLU8oejV9v01LTtWjfLJxonIgTSo7lwng==", + "dev": true, + "license": "ISC", + "dependencies": { + "semver": "^7.5.4", + "tar": "^6.2.0", + "yaml": "^2.2.0" + }, + "bin": { + "trunk": "trunk.js" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@trunkio/launcher/node_modules/yaml": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", + "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", @@ -8404,6 +8436,16 @@ "node": ">= 6" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, "node_modules/chromatic": { "version": "11.16.1", "resolved": "https://registry.npmjs.org/chromatic/-/chromatic-11.16.1.tgz", @@ -10391,6 +10433,39 @@ "node": ">=14.14" } }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs-minipass/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -12820,6 +12895,40 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -15947,12 +16056,60 @@ "node": ">=14.0.0" } }, + "node_modules/tar": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", + "dev": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/tar-mini": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/tar-mini/-/tar-mini-0.2.0.tgz", "integrity": "sha512-+qfUHz700DWnRutdUsxRRVZ38G1Qr27OetwaMYTdg8hcPxf46U0S1Zf76dQMWRBmusOt2ZCK5kbIaiLkoGO7WQ==", "dev": true }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/tar/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/tar/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, "node_modules/telejson": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/telejson/-/telejson-7.2.0.tgz", diff --git a/package.json b/package.json index ecc82bfd..03f73196 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "@storybook/react": "^8.1.10", "@storybook/react-vite": "^8.1.10", "@storybook/test": "^8.1.10", + "@trunkio/launcher": "^1.3.4", "@types/node": "^20.12.7", "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", diff --git a/src/components/NewPosition/NewPosition.tsx b/src/components/NewPosition/NewPosition.tsx index 2fbee37b..c296d5d1 100644 --- a/src/components/NewPosition/NewPosition.tsx +++ b/src/components/NewPosition/NewPosition.tsx @@ -371,11 +371,11 @@ export const NewPosition: React.FC = ({ const bestTierIndex = tokenA === null || tokenB === null ? undefined - : bestTiers.find( + : (bestTiers.find( tier => (tier.tokenX.equals(tokenA) && tier.tokenY.equals(tokenB)) || (tier.tokenX.equals(tokenB) && tier.tokenY.equals(tokenA)) - )?.bestTierIndex ?? undefined + )?.bestTierIndex ?? undefined) const getMinSliderIndex = () => { let minimumSliderIndex = 0