From 4742ac61ce6918ca24c011dcf1a29f984275b381 Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Wed, 5 Jul 2023 15:28:25 +0100 Subject: [PATCH 1/4] refactor: Use single layout for any page with pool id in route --- src/App.vue | 6 ++-- src/components/layouts/DefaultLayout.vue | 28 +++++++++++++++ src/pages/_layouts/DefaultLayout.vue | 35 +++++-------------- .../{JoinExitLayout.vue => PoolLayout.vue} | 16 +++++++-- src/plugins/router/index.ts | 5 +-- 5 files changed, 56 insertions(+), 34 deletions(-) create mode 100644 src/components/layouts/DefaultLayout.vue rename src/pages/_layouts/{JoinExitLayout.vue => PoolLayout.vue} (66%) diff --git a/src/App.vue b/src/App.vue index abf4656bd9..c655bdefb4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -41,8 +41,8 @@ const FocussedLayout = defineAsyncComponent( const ContentLayout = defineAsyncComponent( () => import('@/pages/_layouts/ContentLayout.vue') ); -const JoinExitLayout = defineAsyncComponent( - () => import('@/pages/_layouts/JoinExitLayout.vue') +const PoolLayout = defineAsyncComponent( + () => import('@/pages/_layouts/PoolLayout.vue') ); BigNumber.config({ DECIMAL_PLACES: DEFAULT_TOKEN_DECIMALS }); @@ -57,7 +57,7 @@ const Layouts = { ContentLayout: ContentLayout, DefaultLayout: DefaultLayout, FocussedLayout: FocussedLayout, - JoinExitLayout: JoinExitLayout, + PoolLayout: PoolLayout, }; /** * COMPOSABLES diff --git a/src/components/layouts/DefaultLayout.vue b/src/components/layouts/DefaultLayout.vue new file mode 100644 index 0000000000..a442494b86 --- /dev/null +++ b/src/components/layouts/DefaultLayout.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/src/pages/_layouts/DefaultLayout.vue b/src/pages/_layouts/DefaultLayout.vue index cce554af42..a6d70ee57b 100644 --- a/src/pages/_layouts/DefaultLayout.vue +++ b/src/pages/_layouts/DefaultLayout.vue @@ -1,32 +1,13 @@ - - diff --git a/src/pages/_layouts/JoinExitLayout.vue b/src/pages/_layouts/PoolLayout.vue similarity index 66% rename from src/pages/_layouts/JoinExitLayout.vue rename to src/pages/_layouts/PoolLayout.vue index 7847cc0976..f5791c1ce3 100644 --- a/src/pages/_layouts/JoinExitLayout.vue +++ b/src/pages/_layouts/PoolLayout.vue @@ -1,5 +1,6 @@ diff --git a/src/plugins/router/index.ts b/src/plugins/router/index.ts index bf96bd1d8b..94821c8b0d 100644 --- a/src/plugins/router/index.ts +++ b/src/plugins/router/index.ts @@ -91,12 +91,13 @@ const routes: RouteRecordRaw[] = [ path: '/:networkSlug/pool/:id', name: 'pool', component: PoolPage, + meta: { layout: 'PoolLayout' }, }, { path: '/:networkSlug/pool/:id/add-liquidity', name: 'add-liquidity', component: PoolAddLiquidityPage, - meta: { layout: 'JoinExitLayout' }, + meta: { layout: 'PoolLayout' }, }, { path: '/:networkSlug/pool/:id/invest', @@ -109,7 +110,7 @@ const routes: RouteRecordRaw[] = [ path: '/:networkSlug/pool/:id/withdraw', name: 'withdraw', component: PoolWithdrawPage, - meta: { layout: 'JoinExitLayout' }, + meta: { layout: 'PoolLayout' }, }, { path: '/:networkSlug/vebal', From 856ae1decfa772246b2020ce27442475e5cf9d8e Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Wed, 5 Jul 2023 16:00:26 +0100 Subject: [PATCH 2/4] chore: Use pool provider for pool page --- .../pages/pool/MyPoolBalancesCard.vue | 2 +- src/pages/pool/_id.vue | 48 ++++--------------- src/providers/local/pool.provider.ts | 21 ++++++++ 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/components/contextual/pages/pool/MyPoolBalancesCard.vue b/src/components/contextual/pages/pool/MyPoolBalancesCard.vue index 92690c5a27..1b113c6941 100644 --- a/src/components/contextual/pages/pool/MyPoolBalancesCard.vue +++ b/src/components/contextual/pages/pool/MyPoolBalancesCard.vue @@ -45,7 +45,7 @@ const { isMigratablePool } = usePoolHelpers(toRef(props, 'pool')); const { stakedShares } = usePoolStaking(); const { networkSlug } = useNetwork(); const router = useRouter(); -const { totalLockedValue } = useLock(); +const { totalLockedValue } = useLock({ enabled: isVeBalPool(props.pool.id) }); /** * COMPUTED diff --git a/src/pages/pool/_id.vue b/src/pages/pool/_id.vue index 41cfeff555..eb9b094c53 100644 --- a/src/pages/pool/_id.vue +++ b/src/pages/pool/_id.vue @@ -1,7 +1,5 @@