From 6445a9fc7260359769190e6a94a83b3ccb1314b4 Mon Sep 17 00:00:00 2001 From: LufyCZ Date: Sat, 3 Aug 2024 12:17:14 +0000 Subject: [PATCH 1/3] refactor(pkgs/ui): navigation --- apps/tron/src/app/header.tsx | 4 +- apps/web/src/app/(cms)/header.tsx | 118 ++---- .../src/app/(evm)/_common/header-elements.ts | 94 +++++ apps/web/src/app/(evm)/analytics/header.tsx | 4 +- apps/web/src/app/(evm)/bonds/header.tsx | 2 + .../app/(evm)/claims/components/Header.tsx | 2 + apps/web/src/app/(evm)/pool/header.tsx | 2 + apps/web/src/app/(evm)/stake/header.tsx | 2 + apps/web/src/app/(evm)/swap/header.tsx | 2 + apps/web/src/app/(landing)/header.tsx | 120 +----- apps/web/src/app/(non-evm)/aptos/header.tsx | 2 +- apps/web/src/app/_common/header-elements.ts | 50 +++ .../ui/src/components/navigation-menu.tsx | 4 +- packages/ui/src/components/navigation.tsx | 353 ++++++------------ 14 files changed, 308 insertions(+), 451 deletions(-) create mode 100644 apps/web/src/app/(evm)/_common/header-elements.ts create mode 100644 apps/web/src/app/_common/header-elements.ts diff --git a/apps/tron/src/app/header.tsx b/apps/tron/src/app/header.tsx index 01c6426a21..0c9826752d 100644 --- a/apps/tron/src/app/header.tsx +++ b/apps/tron/src/app/header.tsx @@ -54,7 +54,7 @@ export const Navigation: FC = () => { Swap @@ -62,7 +62,7 @@ export const Navigation: FC = () => { Pool diff --git a/apps/web/src/app/(cms)/header.tsx b/apps/web/src/app/(cms)/header.tsx index 66469e80c3..5f177b4ca8 100644 --- a/apps/web/src/app/(cms)/header.tsx +++ b/apps/web/src/app/(cms)/header.tsx @@ -1,19 +1,11 @@ import { getDifficulties, getProducts } from '@sushiswap/graph-client/strapi' import { - EXPLORE_NAVIGATION_LINKS, - NavigationContainer, - NavigationListItem, - NavigationMenu, - NavigationMenuContent, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuList, - NavigationMenuTrigger, - // OnramperButton, - buttonVariants, + Navigation, + NavigationElement, + NavigationElementType, } from '@sushiswap/ui' -// import { getDifficulties, getProducts } from 'lib/api' import React from 'react' +import { EXPLORE_NAVIGATION_LINKS } from '../_common/header-elements' import { DOCS_URL } from './constants' interface HeaderLink { @@ -45,91 +37,49 @@ export async function Header() { : -1, ) - const navData: HeaderSection[] = [ - { title: 'Academy', href: '/academy' }, - { title: 'Blog', href: '/blog' }, + const navData: NavigationElement[] = [ + { + title: 'Explore', + items: EXPLORE_NAVIGATION_LINKS, + show: 'everywhere', + type: NavigationElementType.Dropdown, + }, + { + title: 'Academy', + href: '/academy', + show: 'everywhere', + type: NavigationElementType.Single, + }, + { + title: 'Blog', + href: '/blog', + show: 'everywhere', + type: NavigationElementType.Single, + }, { title: 'Products', - links: sortedProducts.map(({ longName, slug }) => ({ - name: longName, + items: sortedProducts.map(({ longName, slug }) => ({ + title: longName, href: `/academy/products/${slug}`, + description: '', })), - className: 'hidden md:flex', + show: 'desktop', + type: NavigationElementType.Dropdown, }, { title: 'Learn', - links: difficulties?.map(({ shortDescription, slug }) => { + items: difficulties?.map(({ shortDescription, slug }) => { const isTechnical = slug === 'technical' return { - name: shortDescription, + title: shortDescription, href: isTechnical ? DOCS_URL : `/academy/explore?difficulty=${slug}`, - isExternal: isTechnical, + description: '', } }), - className: 'hidden md:flex', + show: 'desktop', + type: NavigationElementType.Dropdown, }, ] - return ( - - - - - Explore - -
    - {EXPLORE_NAVIGATION_LINKS.map((component) => ( - - {component.description} - - ))} - {/* - - Need to buy some more crypto? - - */} -
-
-
- {navData.map(({ title, href, links, className }) => { - if (href && !links) { - return ( - - - {title} - - - ) - } - - return ( - - {title} - -
    - {links?.map(({ name, href }) => ( - - {name.split('-')?.[1]} - - ))} -
-
-
- ) - })} -
-
-
- ) + return } diff --git a/apps/web/src/app/(evm)/_common/header-elements.ts b/apps/web/src/app/(evm)/_common/header-elements.ts new file mode 100644 index 0000000000..ae9a05b80f --- /dev/null +++ b/apps/web/src/app/(evm)/_common/header-elements.ts @@ -0,0 +1,94 @@ +import { + type NavigationElement, + NavigationElementDropdown, + NavigationElementType, +} from '@sushiswap/ui' +import { EXPLORE_NAVIGATION_LINKS } from 'src/app/_common/header-elements' + +const TOOLS_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [ + { + title: 'Analytics', + href: '/analytics', + description: 'Find the best opportunities', + }, + { + title: 'Blog', + href: '/blog', + description: + 'Stay up to date with the latest product developments at Sushi.', + }, + { + title: 'Academy', + href: '/academy', + description: 'Everything you need to get up to speed with DeFi.', + }, + { + title: 'Forum & Proposals', + href: 'https://forum.sushi.com', + description: 'View and discuss proposals for SushiSwap.', + }, + { + title: 'Participate', + href: 'https://snapshot.org/#/sushigov.eth', + description: + 'As a Sushi holder, you can vote on proposals to shape the future of SushiSwap.', + }, +] + +const PARTNER_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [ + { + title: 'Partner with Sushi', + href: '/partner', + description: 'Incentivize your token with Sushi rewards.', + }, + { + title: 'List enquiry', + href: '/tokenlist-request', + description: 'Get your token on our default token list.', + }, +] + +export const headerElements: NavigationElement[] = [ + { + title: 'Explore', + items: EXPLORE_NAVIGATION_LINKS, + show: 'mobile', + type: NavigationElementType.Dropdown, + }, + { + title: 'Swap', + href: '/swap', + show: 'desktop', + type: NavigationElementType.Single, + }, + { + title: 'Pools', + href: '/pool', + show: 'desktop', + type: NavigationElementType.Single, + }, + { + title: 'Bonds', + href: '/bonds', + show: 'desktop', + type: NavigationElementType.Single, + }, + { + title: 'Stake', + href: '/stake', + show: 'desktop', + type: NavigationElementType.Single, + }, + { + title: 'More', + items: TOOLS_NAVIGATION_LINKS, + show: 'desktop', + type: NavigationElementType.Dropdown, + }, + { + title: 'Partners', + items: PARTNER_NAVIGATION_LINKS, + show: 'desktop', + type: NavigationElementType.Dropdown, + }, +] diff --git a/apps/web/src/app/(evm)/analytics/header.tsx b/apps/web/src/app/(evm)/analytics/header.tsx index f6bcd3ca85..a1b95b2955 100644 --- a/apps/web/src/app/(evm)/analytics/header.tsx +++ b/apps/web/src/app/(evm)/analytics/header.tsx @@ -3,6 +3,8 @@ import { Navigation } from '@sushiswap/ui' import React, { FC } from 'react' +import { headerElements } from '../_common/header-elements' + export const Header: FC = () => { - return + return } diff --git a/apps/web/src/app/(evm)/bonds/header.tsx b/apps/web/src/app/(evm)/bonds/header.tsx index d9062fdaeb..6ac316f610 100644 --- a/apps/web/src/app/(evm)/bonds/header.tsx +++ b/apps/web/src/app/(evm)/bonds/header.tsx @@ -4,10 +4,12 @@ import { Navigation } from '@sushiswap/ui' import React, { FC } from 'react' import { SUPPORTED_CHAIN_IDS } from 'src/config' import { WagmiHeaderComponents } from 'src/lib/wagmi/components/wagmi-header-components' +import { headerElements } from '../_common/header-elements' export const Header: FC = () => { return ( } /> ) diff --git a/apps/web/src/app/(evm)/claims/components/Header.tsx b/apps/web/src/app/(evm)/claims/components/Header.tsx index d9062fdaeb..699acc9391 100644 --- a/apps/web/src/app/(evm)/claims/components/Header.tsx +++ b/apps/web/src/app/(evm)/claims/components/Header.tsx @@ -4,10 +4,12 @@ import { Navigation } from '@sushiswap/ui' import React, { FC } from 'react' import { SUPPORTED_CHAIN_IDS } from 'src/config' import { WagmiHeaderComponents } from 'src/lib/wagmi/components/wagmi-header-components' +import { headerElements } from '../../_common/header-elements' export const Header: FC = () => { return ( } /> ) diff --git a/apps/web/src/app/(evm)/pool/header.tsx b/apps/web/src/app/(evm)/pool/header.tsx index 6c93565318..2b93fa8062 100644 --- a/apps/web/src/app/(evm)/pool/header.tsx +++ b/apps/web/src/app/(evm)/pool/header.tsx @@ -5,11 +5,13 @@ import React, { FC } from 'react' import { SUPPORTED_CHAIN_IDS } from 'src/config' import { WagmiHeaderComponents } from 'src/lib/wagmi/components/wagmi-header-components' import { useChainId } from 'wagmi' +import { headerElements } from '../_common/header-elements' export const Header: FC = () => { const chainId = useChainId() return ( } chainId={chainId} /> diff --git a/apps/web/src/app/(evm)/stake/header.tsx b/apps/web/src/app/(evm)/stake/header.tsx index d9062fdaeb..6ac316f610 100644 --- a/apps/web/src/app/(evm)/stake/header.tsx +++ b/apps/web/src/app/(evm)/stake/header.tsx @@ -4,10 +4,12 @@ import { Navigation } from '@sushiswap/ui' import React, { FC } from 'react' import { SUPPORTED_CHAIN_IDS } from 'src/config' import { WagmiHeaderComponents } from 'src/lib/wagmi/components/wagmi-header-components' +import { headerElements } from '../_common/header-elements' export const Header: FC = () => { return ( } /> ) diff --git a/apps/web/src/app/(evm)/swap/header.tsx b/apps/web/src/app/(evm)/swap/header.tsx index 6c93565318..2b93fa8062 100644 --- a/apps/web/src/app/(evm)/swap/header.tsx +++ b/apps/web/src/app/(evm)/swap/header.tsx @@ -5,11 +5,13 @@ import React, { FC } from 'react' import { SUPPORTED_CHAIN_IDS } from 'src/config' import { WagmiHeaderComponents } from 'src/lib/wagmi/components/wagmi-header-components' import { useChainId } from 'wagmi' +import { headerElements } from '../_common/header-elements' export const Header: FC = () => { const chainId = useChainId() return ( } chainId={chainId} /> diff --git a/apps/web/src/app/(landing)/header.tsx b/apps/web/src/app/(landing)/header.tsx index fefe7859bf..5423a222ab 100644 --- a/apps/web/src/app/(landing)/header.tsx +++ b/apps/web/src/app/(landing)/header.tsx @@ -1,125 +1,7 @@ 'use client' -import { - Button, - Container, - EXPLORE_NAVIGATION_LINKS, - LinkInternal, - NavigationContainer, - NavigationListItem, - NavigationMenu, - NavigationMenuContent, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuList, - NavigationMenuTrigger, - OnramperButton, - PARTNER_NAVIGATION_LINKS, - TOOLS_NAVIGATION_LINKS, - navigationMenuTriggerStyle, -} from '@sushiswap/ui' import React, { FC } from 'react' export const Header: FC = () => { - return ( - - - - - - Explore - -
    - {EXPLORE_NAVIGATION_LINKS.map((component) => ( - - {component.description} - - ))} - - - Need to buy some more crypto? - - -
-
-
- - - - Swap - - - - - - - Pools - - - - - - - Bonds - - - - - - - Stake - - - - - - - Pay - - - - - More - -
    - {TOOLS_NAVIGATION_LINKS.map((component) => ( - - {component.description} - - ))} -
-
-
- - Partners - -
    - {PARTNER_NAVIGATION_LINKS.map((component) => ( - - {component.description} - - ))} -
-
-
-
-
- - - -
-
- ) + return <> } diff --git a/apps/web/src/app/(non-evm)/aptos/header.tsx b/apps/web/src/app/(non-evm)/aptos/header.tsx index 7e3c6cb9fe..ab655b1df7 100644 --- a/apps/web/src/app/(non-evm)/aptos/header.tsx +++ b/apps/web/src/app/(non-evm)/aptos/header.tsx @@ -9,7 +9,7 @@ export const Header: FC = () => { return ( } /> ) diff --git a/apps/web/src/app/_common/header-elements.ts b/apps/web/src/app/_common/header-elements.ts new file mode 100644 index 0000000000..e3a864106a --- /dev/null +++ b/apps/web/src/app/_common/header-elements.ts @@ -0,0 +1,50 @@ +import type { NavigationElementDropdown } from '@sushiswap/ui' + +export const EXPLORE_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [ + { + title: 'Swap', + href: '/swap', + description: 'The easiest way to trade.', + }, + { + title: 'Pools', + href: '/pools', + description: 'Earn fees by providing liquidity.', + }, + { + title: 'Bonds', + href: '/bonds', + description: 'Earn interest by locking up your assets.', + }, + { + title: 'Stake', + href: '/stake', + description: 'Earn protocol fees by staking SUSHI.', + }, + { + title: 'Analytics', + href: '/analytics', + description: 'Find the best opportunities', + }, + { + title: 'Blog', + href: '/blog', + description: + 'Stay up to date with the latest product developments at Sushi.', + }, + { + title: 'Academy', + href: '/academy', + description: 'Everything you need to get up to speed with DeFi.', + }, + { + title: 'Partner with Sushi', + href: '/partner', + description: 'Incentivize your token with Sushi rewards.', + }, + { + title: 'List enquiry', + href: '/tokenlist-request', + description: 'Get your token on our default token list.', + }, +] diff --git a/packages/ui/src/components/navigation-menu.tsx b/packages/ui/src/components/navigation-menu.tsx index 665704e29c..5ae73ea8fe 100644 --- a/packages/ui/src/components/navigation-menu.tsx +++ b/packages/ui/src/components/navigation-menu.tsx @@ -42,7 +42,7 @@ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName const NavigationMenuItem = NavigationMenuPrimitive.Item -const navigationMenuTriggerStyle = () => buttonVariants({ variant: 'ghost' }) +const navigationMenuTriggerStyle = buttonVariants({ variant: 'ghost' }) const NavigationMenuTrigger = React.forwardRef< React.ElementRef, @@ -51,7 +51,7 @@ const NavigationMenuTrigger = React.forwardRef< = ({ ) } -const navigationMenuItems = [ - { - title: 'Swap', - href: '/swap', - }, - { - title: 'Pools', - href: '/pool', - }, - { - title: 'Bonds', - href: '/bonds', - }, - { - title: 'Stake', - href: '/stake', - }, - { - title: 'More', - items: TOOLS_NAVIGATION_LINKS, - }, - { - title: 'Partners', - items: PARTNER_NAVIGATION_LINKS, - }, -] as const +export type NavigationElementShow = 'mobile' | 'desktop' | 'everywhere' + +const navigationElementShowMap: Record = { + mobile: 'md:hidden block', + desktop: 'md:block hidden', + everywhere: '', +} + +export enum NavigationElementType { + Single = 'single', + Dropdown = 'dropdown', + Custom = 'custom', +} + +export type NavigationElementSingle = { + title: string + href: string + show: NavigationElementShow + type: NavigationElementType.Single +} + +export type NavigationElementDropdown = { + title: string + items: { + title: string + href: string + description: string + }[] + show: NavigationElementShow + type: NavigationElementType.Dropdown +} + +export type NavigationElementCustom = { + item: React.ReactNode + show: NavigationElementShow + type: NavigationElementType.Custom +} + +export type NavigationElement = + | NavigationElementSingle + | NavigationElementDropdown + | NavigationElementCustom interface NavProps extends VariantProps { - leftElements?: (typeof navigationMenuItems)[number]['title'][] + leftElements: NavigationElement[] rightElement?: React.ReactNode - legacyBehavior?: boolean showOnramper?: boolean chainId?: number } const Navigation: React.FC = ({ - leftElements: _leftElements = navigationMenuItems.map((entry) => entry.title), + leftElements: _leftElements, rightElement, variant, - legacyBehavior = false, }) => { const leftElements = React.useMemo(() => { - const SimpleItem = (entry: (typeof navigationMenuItems)[number]) => { - if (!('href' in entry)) { - throw new Error('Invalid entry') - } - + const SingleItem = (entry: NavigationElementSingle) => { return ( - - {legacyBehavior ? ( - - {entry.title} - - ) : ( - - {entry.title} - - )} + + + {entry.title} + ) } - const DropdownItem = (entry: (typeof navigationMenuItems)[number]) => { - if (!('items' in entry)) { - throw new Error('Invalid entry') - } - + const DropdownItem = (entry: NavigationElementDropdown) => { return ( - + {entry.title}
    @@ -236,7 +135,6 @@ const Navigation: React.FC = ({ key={component.title} title={component.title} href={component.href} - legacyBehavior={legacyBehavior} > {component.description} @@ -247,39 +145,24 @@ const Navigation: React.FC = ({ ) } - return _leftElements.map((el) => { - const entry = navigationMenuItems.find((entry) => entry.title === el)! - - if ('href' in entry) { - return SimpleItem(entry) - } else { - return DropdownItem(entry) + return _leftElements.flatMap((el) => { + switch (el.type) { + case NavigationElementType.Single: + return SingleItem(el) + case NavigationElementType.Dropdown: + return DropdownItem(el) + case NavigationElementType.Custom: + return ( +
    el.item
    + ) } }) - }, [_leftElements, legacyBehavior]) + }, [_leftElements]) return ( - - - Explore - -
      - {EXPLORE_NAVIGATION_LINKS.map((component) => ( - - {component.description} - - ))} -
    -
    -
    - {leftElements} -
    + {leftElements}
    {rightElement ? rightElement : null} @@ -288,63 +171,49 @@ const Navigation: React.FC = ({ ) } -interface NavigationListItemProps extends React.ComponentPropsWithoutRef<'a'> { - legacyBehavior?: boolean -} +interface NavigationListItemProps extends React.ComponentPropsWithoutRef<'a'> {} const NavigationListItem = React.forwardRef< React.ElementRef<'a'>, NavigationListItemProps ->( - ( - { className, title, children, legacyBehavior = false, href, ...props }, - ref, - ) => { - return ( -
  • - - {legacyBehavior || !href ? ( - -
    {title}
    -

    - {children} -

    -
    - ) : ( - -
    {title}
    -

    - {children} -

    - - )} -
    -
  • - ) - }, -) +>(({ className, title, children, href, ...props }, ref) => { + return ( +
  • + + {!href ? ( + +
    {title}
    +

    + {children} +

    +
    + ) : ( + +
    {title}
    +

    + {children} +

    + + )} +
    +
  • + ) +}) NavigationListItem.displayName = 'NavListItem' -export { - EXPLORE_NAVIGATION_LINKS, - Navigation, - NavigationContainer, - NavigationListItem, - PARTNER_NAVIGATION_LINKS, - TOOLS_NAVIGATION_LINKS, -} +export { Navigation, NavigationContainer, NavigationListItem } From 778ce88ca7a4e014fd3c1ea11fdf94597abe0696 Mon Sep 17 00:00:00 2001 From: LufyCZ Date: Sat, 3 Aug 2024 12:31:50 +0000 Subject: [PATCH 2/3] feat(apps/web): add header where it's missing --- apps/web/src/app/(non-evm)/aptos/header.tsx | 24 +++++++++++++++++--- apps/web/src/app/partner/layout.tsx | 16 +++++++++++++ apps/web/src/app/privacy-policy/layout.tsx | 9 +++++++- apps/web/src/app/terms-of-service/layout.tsx | 9 +++++++- packages/ui/src/components/navigation.tsx | 1 - 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 apps/web/src/app/partner/layout.tsx diff --git a/apps/web/src/app/(non-evm)/aptos/header.tsx b/apps/web/src/app/(non-evm)/aptos/header.tsx index ab655b1df7..292d709b65 100644 --- a/apps/web/src/app/(non-evm)/aptos/header.tsx +++ b/apps/web/src/app/(non-evm)/aptos/header.tsx @@ -1,15 +1,33 @@ 'use client' -import { Navigation } from '@sushiswap/ui' +import { + Navigation, + NavigationElement, + NavigationElementType, +} from '@sushiswap/ui' import React, { FC } from 'react' import { UserProfile } from './(common)/ui/user-profile/user-profile' +const nagivationElements: NavigationElement[] = [ + { + title: 'Swap', + href: '/aptos/swap', + show: 'everywhere', + type: NavigationElementType.Single, + }, + { + title: 'Pool', + href: '/aptos/pool', + show: 'everywhere', + type: NavigationElementType.Single, + }, +] + export const Header: FC = () => { return ( } /> ) diff --git a/apps/web/src/app/partner/layout.tsx b/apps/web/src/app/partner/layout.tsx new file mode 100644 index 0000000000..b7b5bddcd3 --- /dev/null +++ b/apps/web/src/app/partner/layout.tsx @@ -0,0 +1,16 @@ +import { Navigation } from '@sushiswap/ui' +import { Metadata } from 'next' +import { headerElements } from '../(evm)/_common/header-elements' + +export const metadata: Metadata = { + title: 'Partner', +} + +export default function Layout({ children }: { children: React.ReactNode }) { + return ( + <> + +
    {children}
    + + ) +} diff --git a/apps/web/src/app/privacy-policy/layout.tsx b/apps/web/src/app/privacy-policy/layout.tsx index 59eeae3e28..774cc651ee 100644 --- a/apps/web/src/app/privacy-policy/layout.tsx +++ b/apps/web/src/app/privacy-policy/layout.tsx @@ -1,9 +1,16 @@ +import { Navigation } from '@sushiswap/ui' import { Metadata } from 'next' +import { headerElements } from '../(evm)/_common/header-elements' export const metadata: Metadata = { title: 'Privacy Policy', } export default function Layout({ children }: { children: React.ReactNode }) { - return
    {children}
    + return ( + <> + +
    {children}
    + + ) } diff --git a/apps/web/src/app/terms-of-service/layout.tsx b/apps/web/src/app/terms-of-service/layout.tsx index a90584e6a3..ecf29a4e4d 100644 --- a/apps/web/src/app/terms-of-service/layout.tsx +++ b/apps/web/src/app/terms-of-service/layout.tsx @@ -1,9 +1,16 @@ +import { Navigation } from '@sushiswap/ui' import { Metadata } from 'next' +import { headerElements } from '../(evm)/_common/header-elements' export const metadata: Metadata = { title: 'Terms Of Service', } export default function Layout({ children }: { children: React.ReactNode }) { - return
    {children}
    + return ( + <> + +
    {children}
    + + ) } diff --git a/packages/ui/src/components/navigation.tsx b/packages/ui/src/components/navigation.tsx index e102a98c1d..4ec91e5edc 100644 --- a/packages/ui/src/components/navigation.tsx +++ b/packages/ui/src/components/navigation.tsx @@ -95,7 +95,6 @@ export type NavigationElement = interface NavProps extends VariantProps { leftElements: NavigationElement[] rightElement?: React.ReactNode - showOnramper?: boolean chainId?: number } From 7227d50d044083b70cfe47158028f66a1661e4bf Mon Sep 17 00:00:00 2001 From: LufyCZ Date: Sat, 3 Aug 2024 12:43:41 +0000 Subject: [PATCH 3/3] fix(apps/aptos): links --- apps/web/next.config.mjs | 5 +++++ .../(common)/lib/edge/use-is-swap-maintenance.ts | 2 +- .../app/(non-evm)/aptos/pool/(landing)/layout.tsx | 15 ++++++++++----- apps/web/src/app/(non-evm)/aptos/pool/hero.tsx | 2 +- .../pool/ui/pools/tables/pools/PoolsTable.tsx | 2 +- .../tables/positions/pool-positions-table.tsx | 2 +- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index deaebdc6b5..17ae1114ca 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -63,6 +63,11 @@ const nextConfig = bundleAnalyzer({ permanent: true, destination: '/pool/:path*', }, + { + source: '/aptos', + permanent: true, + destination: '/aptos/swap', + }, { source: '/skale/swap', permanent: true, diff --git a/apps/web/src/app/(non-evm)/aptos/(common)/lib/edge/use-is-swap-maintenance.ts b/apps/web/src/app/(non-evm)/aptos/(common)/lib/edge/use-is-swap-maintenance.ts index 2146774b2c..6fca6d3f20 100644 --- a/apps/web/src/app/(non-evm)/aptos/(common)/lib/edge/use-is-swap-maintenance.ts +++ b/apps/web/src/app/(non-evm)/aptos/(common)/lib/edge/use-is-swap-maintenance.ts @@ -8,7 +8,7 @@ export const useIsSwapMaintenance = () => { return useQuery({ queryKey: ['useIsSwapMaintenance'], queryFn: async () => { - const resp = await fetch('/api/config/swap', { + const resp = await fetch('/aptos/api/config/swap', { next: { revalidate: 60 }, }) const data = await resp.json() diff --git a/apps/web/src/app/(non-evm)/aptos/pool/(landing)/layout.tsx b/apps/web/src/app/(non-evm)/aptos/pool/(landing)/layout.tsx index 93d02cb0e0..f3293409a3 100644 --- a/apps/web/src/app/(non-evm)/aptos/pool/(landing)/layout.tsx +++ b/apps/web/src/app/(non-evm)/aptos/pool/(landing)/layout.tsx @@ -22,20 +22,25 @@ export default function TabsLayout({ - + All Pools @@ -50,7 +55,7 @@ export default function TabsLayout({ My Rewards diff --git a/apps/web/src/app/(non-evm)/aptos/pool/hero.tsx b/apps/web/src/app/(non-evm)/aptos/pool/hero.tsx index 1901dd8a2c..5acef8fe01 100644 --- a/apps/web/src/app/(non-evm)/aptos/pool/hero.tsx +++ b/apps/web/src/app/(non-evm)/aptos/pool/hero.tsx @@ -32,7 +32,7 @@ export const Hero: FC = () => {
    diff --git a/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/pools/PoolsTable.tsx b/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/pools/PoolsTable.tsx index 7a49c13e58..0b9c8201b2 100644 --- a/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/pools/PoolsTable.tsx +++ b/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/pools/PoolsTable.tsx @@ -44,7 +44,7 @@ export const PoolsTable = () => { // } = useNetwork() const rowLink = useCallback((row: PoolExtended) => { - return `/pool/${row.id}` + return `/aptos/pool/${row.id}` }, []) const filtered = useMemo(() => { diff --git a/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/positions/pool-positions-table.tsx b/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/positions/pool-positions-table.tsx index 03c0c3cedb..f89eb5c5fd 100644 --- a/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/positions/pool-positions-table.tsx +++ b/apps/web/src/app/(non-evm)/aptos/pool/ui/pools/tables/positions/pool-positions-table.tsx @@ -61,7 +61,7 @@ export const PositionsTable = () => { }, [pools, tokenSymbols]) const rowLink = useCallback((row: PoolExtended) => { - return `/pool/${row.id}` + return `/aptos/pool/${row.id}` }, []) const state: Partial = useMemo(() => {