Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: deprecate pages #5913

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/components/navs/AppNav/AppNavActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { computed } from 'vue';

import DarkModeToggle from '@/components/btns/DarkModeToggle.vue';
import FeedbackBtn from '@/components/btns/FeedbackBtn.vue';
import useBreakpoints from '@/composables/useBreakpoints';
import { useSidebar } from '@/composables/useSidebar';
import useWeb3 from '@/services/web3/useWeb3';
Expand Down Expand Up @@ -37,7 +36,6 @@ function connectWalletHandler() {
<div class="grid grid-rows-1 grid-flow-col gap-2">
<DarkModeToggle v-if="isDesktop" />
<AppNavActivityBtn v-if="account" />
<FeedbackBtn v-if="isDesktop" />
<AppNavAccountBtn v-if="account" />
<BalBtn
v-else
Expand Down
7 changes: 0 additions & 7 deletions src/components/navs/AppNav/AppSidebar/SidebarContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,11 @@ const { openNpsModal } = useAppzi();
const blockIcon = ref<HTMLDivElement>();

const navLinks = [
{ label: t('pool'), path: '/', goal: Goals.ClickNavPools },
{ label: t('swap'), path: `/${networkSlug}/swap`, goal: Goals.ClickNavSwap },
{
label: t('claim'),
path: `/${networkSlug}/claim`,
goal: Goals.ClickNavClaim,
},
{
label: t('portfolio'),
path: `/${networkSlug}/portfolio`,
goal: Goals.ClickNavPortfolio,
},
{ label: 'veBAL', path: `/${networkSlug}/vebal`, goal: Goals.ClickNavVebal },
];

Expand Down
24 changes: 0 additions & 24 deletions src/components/navs/AppNav/DesktopLinks/DesktopLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,6 @@ function isActive(page: string): boolean {

<template>
<div class="desktop-links">
<DesktopLinkItem
:to="{ name: 'home', params: { networkSlug } }"
:active="isActive('home')"
prefetch
@click="trackGoal(Goals.ClickNavPools)"
>
{{ $t('pool') }}
</DesktopLinkItem>
<DesktopLinkItem
:to="{ name: 'swap', params: { networkSlug } }"
:active="isActive('swap')"
prefetch
@click="trackGoal(Goals.ClickNavSwap)"
>
{{ $t('swap') }}
</DesktopLinkItem>
<DesktopLinkItem
:to="{ name: 'claim', params: { networkSlug } }"
:active="isActive('claim')"
Expand All @@ -54,14 +38,6 @@ function isActive(page: string): boolean {
>
Faucet
</DesktopLinkItem>
<DesktopLinkItem
:to="{ name: 'portfolio', params: { networkSlug } }"
:active="isActive('portfolio')"
prefetch
@click="trackGoal(Goals.ClickNavPortfolio)"
>
{{ $t('portfolio') }}
</DesktopLinkItem>
<DesktopLinkItem
:to="{ name: 'vebal', params: { networkSlug } }"
:active="isActive('vebal')"
Expand Down
258 changes: 18 additions & 240 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,250 +1,28 @@
<script setup lang="ts">
import { useRouter } from 'vue-router';

import HomePageHero from '@/components/heros/HomePageHero.vue';
import TokenSearchInput from '@/components/inputs/TokenSearchInput.vue';
import FeaturedProtocols from '@/components/sections/FeaturedProtocols.vue';
import PoolsTable from '@/components/tables/PoolsTable/PoolsTable.vue';
import usePoolFilters from '@/composables/pools/usePoolFilters';
import useBreakpoints from '@/composables/useBreakpoints';
import useNetwork from '@/composables/useNetwork';
import usePools from '@/composables/pools/usePools';
import { lsGet, lsSet } from '@/lib/utils';
import LS_KEYS from '@/constants/local-storage.keys';
import { useIntersectionObserver } from '@vueuse/core';
import { PoolType } from '@/services/pool/types';
import PoolFeatureSelect from '@/components/inputs/PoolFeatureSelect.vue';
import { useTokens } from '@/providers/tokens.provider';
import { PoolAttributeFilter, PoolTypeFilter } from '@/types/pools';
import UserInvestedInAffectedPoolAlert from '@/pages/recovery-exit/UserInvestedInAffectedPoolAlert.vue';
import { usePoolGroups } from '@/composables/usePoolGroups';

const featuredProtocolsSentinel = ref<HTMLDivElement | null>(null);
const isFeaturedProtocolsVisible = ref(false);
useIntersectionObserver(featuredProtocolsSentinel, ([{ isIntersecting }]) => {
if (isIntersecting) {
isFeaturedProtocolsVisible.value = true;
}
});

/**
* STATE
*/
const route = useRoute();
const urlSortParam = route.query?.sort as string | undefined;
const initSortCol =
urlSortParam || lsGet(LS_KEYS.App.PoolSorting) || 'totalLiquidity';
const sortField = ref('totalLiquidity');
const poolTypeFilter = ref<PoolTypeFilter>();
const filterPoolIds = ref<string[]>([]);
const filterPoolTypes = ref<PoolType[]>([]);
const filterPoolAttributes = ref<PoolAttributeFilter[]>([]);

/**
* COMPOSABLES
*/
const router = useRouter();
const { getToken } = useTokens();
const { appNetworkConfig } = useNetwork();
const isElementSupported = appNetworkConfig.supportsElementPools;
const { selectedTokens, addSelectedToken, removeSelectedToken } =
usePoolFilters();

const { pools, isLoading, isFetchingNextPage, loadMorePools } = usePools({
filterTokens: selectedTokens,
sortField,
poolIds: filterPoolIds,
poolTypes: filterPoolTypes,
poolAttributes: filterPoolAttributes,
});

const { upToSmallBreakpoint } = useBreakpoints();
const { networkSlug, networkConfig } = useNetwork();

const { lrtPools, pointPools } = usePoolGroups(networkConfig.chainId);

const isPaginated = computed(() => pools.value.length >= 10);

/**
* METHODS
*/
function navigateToCreatePool() {
router.push({ name: 'create-pool', params: { networkSlug } });
}

function onColumnSort(columnId: string) {
sortField.value = columnId;
lsSet(LS_KEYS.App.PoolSorting, columnId);
}

function updatePoolFilters(feature: PoolTypeFilter | undefined) {
switch (feature) {
case PoolTypeFilter.Weighted:
filterPoolIds.value = [];
filterPoolTypes.value = [PoolType.Weighted];
break;
case PoolTypeFilter.Stable:
filterPoolIds.value = [];
filterPoolTypes.value = [
PoolType.Stable,
PoolType.StablePhantom,
PoolType.MetaStable,
PoolType.ComposableStable,
];
break;
case PoolTypeFilter.CLP:
filterPoolIds.value = [];
filterPoolTypes.value = [PoolType.Gyro2, PoolType.Gyro3, PoolType.GyroE];
break;
case PoolTypeFilter.LBP:
filterPoolIds.value = [];
filterPoolTypes.value = [PoolType.LiquidityBootstrapping];
break;
case PoolTypeFilter.LRT:
filterPoolIds.value = lrtPools.value;
filterPoolTypes.value = [];
break;
case PoolTypeFilter.Points:
filterPoolIds.value = pointPools.value;
filterPoolTypes.value = [];
break;
default:
filterPoolIds.value = [];
filterPoolTypes.value = [];
}
}

function removeAttributeFilter(attribute: PoolAttributeFilter) {
const index = filterPoolAttributes.value.indexOf(attribute);
filterPoolAttributes.value.splice(index, 1);
}

watch(poolTypeFilter, newPoolTypeFilter => {
updatePoolFilters(newPoolTypeFilter);
});
</script>

<template>
<div>
<HomePageHero />
<div class="xl:container xl:px-4 pt-10 md:pt-8 xl:mx-auto">
<UserInvestedInAffectedPoolAlert />
<BalStack vertical>
<div class="px-4 xl:px-0">
<div class="flex justify-between items-end mb-2">
<h3>
{{ networkConfig.chainName }}
<span class="lowercase">{{ $t('pools') }}</span>
</h3>
<BalBtn
v-if="upToSmallBreakpoint"
color="blue"
size="sm"
outline
:class="{ 'mt-4': upToSmallBreakpoint }"
@click="navigateToCreatePool"
>
{{ $t('createAPool.title') }}
</BalBtn>
</div>

<div
class="flex flex-col md:flex-row justify-between items-end lg:items-center w-full"
>
<BalVStack width="full">
<BalHStack justify="between" width="full">
<BalHStack spacing="md">
<TokenSearchInput
v-model="selectedTokens"
@add="addSelectedToken"
@remove="removeSelectedToken"
/>
<PoolFeatureSelect
v-model:selectedPoolType="poolTypeFilter"
v-model:selectedAttributes="filterPoolAttributes"
/>
</BalHStack>

<BalBtn
v-if="!upToSmallBreakpoint"
color="blue"
size="sm"
outline
:class="{ 'mt-4': upToSmallBreakpoint }"
:block="upToSmallBreakpoint"
@click="navigateToCreatePool"
>
{{ $t('createAPool.title') }}
</BalBtn>
</BalHStack>
<BalHStack spacing="sm">
<TransitionGroup name="pop">
<BalTag
v-for="token in selectedTokens"
:key="token"
:closeable="true"
class="mt-4"
@closed="removeSelectedToken(token)"
>
<BalAsset :address="token" :size="20" class="flex-auto" />
<span class="ml-2">{{ getToken(token)?.symbol }}</span>
</BalTag>
</TransitionGroup>

<Transition name="pop">
<BalTag
v-if="poolTypeFilter"
:closeable="true"
class="mt-4"
@closed="poolTypeFilter = undefined"
>
<span>{{ poolTypeFilter }}</span>
</BalTag>
</Transition>

<TransitionGroup name="pop">
<BalTag
v-for="attribute in filterPoolAttributes"
:key="attribute"
:closeable="true"
class="mt-4"
@closed="removeAttributeFilter(attribute)"
>
<span>{{ attribute }}</span>
</BalTag>
</TransitionGroup>
</BalHStack>
</BalVStack>
</div>
</div>
<PoolsTable
:data="pools"
:noPoolsLabel="$t('noPoolsFound')"
:isLoading="isLoading"
:selectedTokens="selectedTokens"
class="mb-8"
:sortColumn="initSortCol"
:hiddenColumns="['migrate', 'actions', 'lockEndDate']"
:isLoadingMore="isFetchingNextPage"
:isPaginated="isPaginated"
skeletonClass="pools-table-loading-height"
@on-column-sort="onColumnSort"
@load-more="loadMorePools"
/>
<div ref="featuredProtocolsSentinel" />
<div
v-if="isElementSupported && isFeaturedProtocolsVisible"
class="p-4 xl:p-0 mt-12"
>
<FeaturedProtocols />
</div>
</BalStack>
<div class="px-3 pt-10 md:pt-8 mx-auto max-w-md">
<h1 class="mb-4 text-2xl font-bold">This UI is mostly deprecated</h1>
<p>
Please use the new UI at
<BalLink href="https://balancer.fi" external>balancer.fi</BalLink>
to:
</p>
<ul class="pl-5 list-disc">
<li>Explore pools</li>
<li>Add and remove liquidity</li>
<li>Swap tokens</li>
<li>View your portfolio</li>
</ul>
<p class="mt-4">You can continue to use this UI to:</p>
<ul class="pl-5 list-disc">
<li>Manage your veBAL</li>
<li>Claim old incentives</li>
</ul>
</div>
</div>
</template>

<style>
.pools-table-loading-height {
height: 40rem;
}
</style>
12 changes: 12 additions & 0 deletions src/plugins/router/nav-guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function applyNavGuards(router: Router): Router {
router = applyMetaData(router);
router = applyVotingRedirects(router);
router = applyPoolPageRedirects(router);
router = applyDeprecationRedirects(router);

return router;
}
Expand Down Expand Up @@ -205,3 +206,14 @@ function applyPoolPageRedirects(router: Router): Router {
});
return router;
}

function applyDeprecationRedirects(router: Router): Router {
router.beforeEach((to, from, next) => {
if (to.name === 'swap') {
window.location.href = 'https://balancer.fi/swap';
} else if (to.name === 'portfolio') {
window.location.href = 'https://balancer.fi/portfolio';
} else next();
});
return router;
}
Loading