From d8fa6f319a84db5f7f779294a112aa8d3ec63f9e Mon Sep 17 00:00:00 2001 From: 0xMasayoshi <0xMasayoshi@protonmail.com> Date: Fri, 6 Sep 2024 18:43:57 +0800 Subject: [PATCH 01/46] archive: collapsible sidebar component --- apps/web/src/app/(evm)/(trade)/header.tsx | 18 -- apps/web/src/app/(evm)/(trade)/layout.tsx | 14 +- .../(evm)/[chainId]/(positions)/layout.tsx | 108 ++++++------ .../app/(evm)/[chainId]/explore/layout.tsx | 73 ++++---- apps/web/src/app/(evm)/[chainId]/header.tsx | 18 -- apps/web/src/app/(evm)/[chainId]/layout.tsx | 13 +- .../[chainId]/pool/incentivize/layout.tsx | 49 +++--- .../pool/v2/[address]/(landing)/layout.tsx | 30 ++-- .../pool/v2/[address]/(manage)/layout.tsx | 26 +-- .../pool/v2/[address]/migrate/layout.tsx | 26 +-- .../(evm)/[chainId]/pool/v2/add/layout.tsx | 50 +++--- apps/web/src/app/(evm)/bonds/header.tsx | 18 -- apps/web/src/app/(evm)/bonds/layout.tsx | 2 +- apps/web/src/app/(evm)/header.tsx | 44 +++++ apps/web/src/app/(evm)/stake/header.tsx | 18 -- apps/web/src/app/(evm)/stake/layout.tsx | 29 ++-- apps/web/src/app/layout.tsx | 3 +- .../wagmi/components/user-portfolio/index.tsx | 6 +- .../components/wagmi-header-components.tsx | 2 - packages/ui/src/components/index.ts | 1 + packages/ui/src/components/navigation.tsx | 32 +++- packages/ui/src/components/sidebar.tsx | 159 ++++++++++++++++++ 22 files changed, 473 insertions(+), 266 deletions(-) delete mode 100644 apps/web/src/app/(evm)/(trade)/header.tsx delete mode 100644 apps/web/src/app/(evm)/[chainId]/header.tsx delete mode 100644 apps/web/src/app/(evm)/bonds/header.tsx create mode 100644 apps/web/src/app/(evm)/header.tsx delete mode 100644 apps/web/src/app/(evm)/stake/header.tsx create mode 100644 packages/ui/src/components/sidebar.tsx diff --git a/apps/web/src/app/(evm)/(trade)/header.tsx b/apps/web/src/app/(evm)/(trade)/header.tsx deleted file mode 100644 index 94558372a6..0000000000 --- a/apps/web/src/app/(evm)/(trade)/header.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' - -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 { useChainId } from 'wagmi' -import { headerElements } from '../_common/header-elements' - -export const Header: FC = () => { - const chainId = useChainId() - return ( - } - /> - ) -} diff --git a/apps/web/src/app/(evm)/(trade)/layout.tsx b/apps/web/src/app/(evm)/(trade)/layout.tsx index 38318e300e..7ff189bde0 100644 --- a/apps/web/src/app/(evm)/(trade)/layout.tsx +++ b/apps/web/src/app/(evm)/(trade)/layout.tsx @@ -1,6 +1,5 @@ -import { HotJar } from '@sushiswap/ui' - -import { Header } from './header' +import { HotJar, Sidebar, SidebarProvider } from '@sushiswap/ui' +import { Header } from '../header' import { Providers } from './providers' export default function TradeLayout({ @@ -9,8 +8,13 @@ export default function TradeLayout({ return ( <> -
-
{children}
+ +
+
+ +
{children}
+
+ diff --git a/apps/web/src/app/(evm)/[chainId]/(positions)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/(positions)/layout.tsx index e99da70f8c..fba00d9286 100644 --- a/apps/web/src/app/(evm)/[chainId]/(positions)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/(positions)/layout.tsx @@ -1,6 +1,6 @@ 'use client' -import { Container, LinkInternal } from '@sushiswap/ui' +import { Container, LinkInternal, SidebarAwareContainer } from '@sushiswap/ui' import { useSearchParams } from 'next/navigation' import { PathnameButton } from 'src/ui/pathname-button' import { PoolsFiltersProvider } from 'src/ui/pool' @@ -23,61 +23,65 @@ export default function TabsLayout({ return ( <> - - - - -
- - + + + + +
+ - My Positions - - - - + My Positions + + + - My Rewards - - - - + My Rewards + + + - Migrate - - -
-
-
+ + Migrate + + +
+
+ +
- {children} + + {children} +
diff --git a/apps/web/src/app/(evm)/[chainId]/explore/layout.tsx b/apps/web/src/app/(evm)/[chainId]/explore/layout.tsx index 1e95440144..8a87381628 100644 --- a/apps/web/src/app/(evm)/[chainId]/explore/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/explore/layout.tsx @@ -1,7 +1,6 @@ import { isPoolChainId } from '@sushiswap/graph-client/data-api' import { isSteerChainId } from '@sushiswap/steer-sdk' -import { Container } from '@sushiswap/ui' -import { LinkInternal } from '@sushiswap/ui' +import { Container, LinkInternal, SidebarAwareContainer } from '@sushiswap/ui' import { notFound } from 'next/navigation' import React from 'react' @@ -26,50 +25,56 @@ export default async function ExploreLayout({ return ( <> - - - + + + + +
- -
- - - All Pools - - - {isSteerChainId(chainId) ? ( + + +
- Smart Pools + All Pools - ) : ( - - Smart Pools - - )} -
-
+ {isSteerChainId(chainId) ? ( + + + Smart Pools + + + ) : ( + + Smart Pools + + )} +
+
+
- {children} + + {children} +
diff --git a/apps/web/src/app/(evm)/[chainId]/header.tsx b/apps/web/src/app/(evm)/[chainId]/header.tsx deleted file mode 100644 index 94558372a6..0000000000 --- a/apps/web/src/app/(evm)/[chainId]/header.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' - -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 { useChainId } from 'wagmi' -import { headerElements } from '../_common/header-elements' - -export const Header: FC = () => { - const chainId = useChainId() - return ( - } - /> - ) -} diff --git a/apps/web/src/app/(evm)/[chainId]/layout.tsx b/apps/web/src/app/(evm)/[chainId]/layout.tsx index 623f202f64..7ac0097a09 100644 --- a/apps/web/src/app/(evm)/[chainId]/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/layout.tsx @@ -1,7 +1,7 @@ -import { HotJar } from '@sushiswap/ui' +import { HotJar, Sidebar, SidebarProvider } from '@sushiswap/ui' import { isSupportedChainId } from 'src/config' -import { Header } from './header' +import { Header } from '../header' import notFound from './not-found' import { Providers } from './providers' @@ -16,8 +16,13 @@ export default function PoolLayout({ return ( <> -
-
{children}
+ +
+
+ +
{children}
+
+ diff --git a/apps/web/src/app/(evm)/[chainId]/pool/incentivize/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/incentivize/layout.tsx index 49afc9279d..6aca21f61f 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/incentivize/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/incentivize/layout.tsx @@ -1,4 +1,8 @@ -import { Container, typographyVariants } from '@sushiswap/ui' +import { + Container, + SidebarAwareContainer, + typographyVariants, +} from '@sushiswap/ui' import { BackButton } from 'src/ui/pool/BackButton' export const metadata = { @@ -8,28 +12,33 @@ export const metadata = { export default function Layout({ children }: { children: React.ReactNode }) { return ( <> - -
-
- -

- Incentivize Liquidity -

+ + +
+
+ +

+ Incentivize Liquidity +

+
+

+ Add rewards to a pool to incentivize liquidity providers joining + in. +

-

- Add rewards to a pool to incentivize liquidity providers joining in. -

-
- + +
- - {children} - + + + {children} + +
diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx index e144a1444e..da62d9cdb0 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx @@ -1,5 +1,5 @@ import { V2Pool, getV2Pool } from '@sushiswap/graph-client/data-api' -import { Container } from '@sushiswap/ui' +import { Container, SidebarAwareContainer } from '@sushiswap/ui' import { unstable_cache } from 'next/cache' import { headers } from 'next/headers' import { notFound } from 'next/navigation' @@ -42,21 +42,23 @@ export default async function Layout({ const referer = headersList.get('referer') return ( <> - - - + + + + +
- {children} + {children}
diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx index ac78d9d3bd..38940a5062 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx @@ -1,4 +1,4 @@ -import { Container, LinkInternal } from '@sushiswap/ui' +import { Container, LinkInternal, SidebarAwareContainer } from '@sushiswap/ui' import React from 'react' import { ChainId, ChainKey } from 'sushi/chain' @@ -13,16 +13,18 @@ export default function Layout({ const chainId = +_chainId as ChainId return ( - -
- - ← Pool - - {children} -
-
+ + +
+ + ← Pool + + {children} +
+
+
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx index d30aa39a5c..60063f8cce 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx @@ -1,4 +1,4 @@ -import { Container, LinkInternal } from '@sushiswap/ui' +import { Container, LinkInternal, SidebarAwareContainer } from '@sushiswap/ui' import React from 'react' import { ChainId, ChainKey } from 'sushi/chain' @@ -12,16 +12,18 @@ export default function Layout({ const chainId = +params.chainId as ChainId return ( - -
- - ← Back - - {children} -
-
+ + +
+ + ← Back + + {children} +
+
+
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/add/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/add/layout.tsx index 7a929e95e8..45315925d1 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/add/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/add/layout.tsx @@ -1,4 +1,8 @@ -import { Container, typographyVariants } from '@sushiswap/ui' +import { + Container, + SidebarAwareContainer, + typographyVariants, +} from '@sushiswap/ui' import { BackButton } from 'src/ui/pool/BackButton' @@ -9,29 +13,33 @@ export const metadata = { export default function Layout({ children }: { children: React.ReactNode }) { return ( <> - -
-
- -

- Add Liquidity -

+ + +
+
+ +

+ Add Liquidity +

+
+

+ Create a new pool or create a liquidity position on an existing + pool. +

-

- Create a new pool or create a liquidity position on an existing - pool. -

-
- + +
- - {children} - + + + {children} + +
diff --git a/apps/web/src/app/(evm)/bonds/header.tsx b/apps/web/src/app/(evm)/bonds/header.tsx deleted file mode 100644 index 94558372a6..0000000000 --- a/apps/web/src/app/(evm)/bonds/header.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' - -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 { useChainId } from 'wagmi' -import { headerElements } from '../_common/header-elements' - -export const Header: FC = () => { - const chainId = useChainId() - return ( - } - /> - ) -} diff --git a/apps/web/src/app/(evm)/bonds/layout.tsx b/apps/web/src/app/(evm)/bonds/layout.tsx index a62982ac1e..beace0f291 100644 --- a/apps/web/src/app/(evm)/bonds/layout.tsx +++ b/apps/web/src/app/(evm)/bonds/layout.tsx @@ -1,6 +1,6 @@ import { HotJar } from '@sushiswap/ui' -import { Header } from './header' +import { Header } from '../header' import { Providers } from './providers' export const metadata = { diff --git a/apps/web/src/app/(evm)/header.tsx b/apps/web/src/app/(evm)/header.tsx new file mode 100644 index 0000000000..fd31fa4d39 --- /dev/null +++ b/apps/web/src/app/(evm)/header.tsx @@ -0,0 +1,44 @@ +'use client' + +import { ChevronDownIcon } from '@heroicons/react-v1/solid' +import { Badge, Navigation, SidebarToggle } from '@sushiswap/ui' +import { NetworkIcon } from '@sushiswap/ui/icons/NetworkIcon' +import { SushiWithTextIcon } from '@sushiswap/ui/icons/SushiWithTextIcon' +import React, { FC } from 'react' +import { UserPortfolio } from 'src/lib/wagmi/components/user-portfolio' +import { useAccount, useChainId } from 'wagmi' +import { headerElements } from './_common/header-elements' + +export const Header: FC = () => { + const chainId = useChainId() + const { address } = useAccount() + + return ( +
+
+ + + + ) : ( +
+ ) + } + > + + + + +
+ } + /> +
+ ) +} diff --git a/apps/web/src/app/(evm)/stake/header.tsx b/apps/web/src/app/(evm)/stake/header.tsx deleted file mode 100644 index 94558372a6..0000000000 --- a/apps/web/src/app/(evm)/stake/header.tsx +++ /dev/null @@ -1,18 +0,0 @@ -'use client' - -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 { useChainId } from 'wagmi' -import { headerElements } from '../_common/header-elements' - -export const Header: FC = () => { - const chainId = useChainId() - return ( - } - /> - ) -} diff --git a/apps/web/src/app/(evm)/stake/layout.tsx b/apps/web/src/app/(evm)/stake/layout.tsx index e49a382204..8620564334 100644 --- a/apps/web/src/app/(evm)/stake/layout.tsx +++ b/apps/web/src/app/(evm)/stake/layout.tsx @@ -1,7 +1,7 @@ -import { Container } from '@sushiswap/ui' +import { Container, Sidebar, SidebarProvider } from '@sushiswap/ui' import { HotJar } from '@sushiswap/ui' import { BarHeader } from 'src/ui/stake' -import { Header } from './header' +import { Header } from '../header' import { Providers } from './providers' export const metadata = { @@ -13,17 +13,22 @@ export default function Layout({ children }: { children: React.ReactNode }) { return ( <> -
-
- - - -
-
- {children} + +
+
+ +
+ + + +
+
+ {children} +
+
-
-
+
+ diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 1766db4a9c..0a66875411 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -1,6 +1,7 @@ import '@sushiswap/ui/index.css' import { ToastContainer } from '@sushiswap/notifications' +// import { Sidebar } from '@sushiswap/ui' import type { Metadata } from 'next' import { Inter, Roboto_Mono } from 'next/font/google' import React from 'react' @@ -56,7 +57,7 @@ export default function RootLayout({ - + {children} diff --git a/apps/web/src/lib/wagmi/components/user-portfolio/index.tsx b/apps/web/src/lib/wagmi/components/user-portfolio/index.tsx index a042eef653..7d0d83294a 100644 --- a/apps/web/src/lib/wagmi/components/user-portfolio/index.tsx +++ b/apps/web/src/lib/wagmi/components/user-portfolio/index.tsx @@ -82,7 +82,7 @@ export const UserPortfolio = () => { return ( + } content={content} diff --git a/apps/web/src/lib/wagmi/components/wagmi-header-components.tsx b/apps/web/src/lib/wagmi/components/wagmi-header-components.tsx index 7ead52c63b..2705d66d04 100644 --- a/apps/web/src/lib/wagmi/components/wagmi-header-components.tsx +++ b/apps/web/src/lib/wagmi/components/wagmi-header-components.tsx @@ -11,7 +11,6 @@ import { import { Suspense, useEffect } from 'react' import { useAccount } from 'wagmi' import { HeaderNetworkSelector } from './header-network-selector' -import { UserPortfolio } from './user-portfolio' interface WagmiHeaderComponentsProps { chainIds: ChainId[] @@ -42,7 +41,6 @@ export const WagmiHeaderComponents: React.FC = ({ return ( - ) } diff --git a/packages/ui/src/components/index.ts b/packages/ui/src/components/index.ts index eaed0e2200..c1a0537adb 100644 --- a/packages/ui/src/components/index.ts +++ b/packages/ui/src/components/index.ts @@ -45,6 +45,7 @@ export * from './scroll-area' export * from './select' export * from './separator' export * from './settings' +export * from './sidebar' export * from './skeleton' export * from './slider' export * from './slot' diff --git a/packages/ui/src/components/navigation.tsx b/packages/ui/src/components/navigation.tsx index b512585cea..f75db870ce 100644 --- a/packages/ui/src/components/navigation.tsx +++ b/packages/ui/src/components/navigation.tsx @@ -3,7 +3,9 @@ import Link from 'next/link' import * as React from 'react' import classNames from 'classnames' +// import { ChevronDown } from 'lucide-react' import { SushiIcon } from '../icons/SushiIcon' +// import { SushiWithTextIcon } from '../icons/SushiWithTextIcon' import { LinkInternal } from './link' import { navigationMenuTriggerStyle } from './navigation-menu' import { @@ -14,6 +16,7 @@ import { NavigationMenuList, NavigationMenuTrigger, } from './navigation-menu' +// import { SidebarToggle } from './sidebar' const COMPANY_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [ { @@ -61,11 +64,13 @@ const SUPPORT_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [ const navigationContainerVariants = cva( 'px-4 sticky flex items-center flex-grow gap-4 top-0 z-50 min-h-[56px] max-h-[56px] h-[56px]', + // 'px-4 ml-2 mr-12 sticky flex items-center flex-grow gap-4 top-6 z-50 min-h-[56px] max-h-[56px] h-[56px]', { variants: { variant: { default: 'bg-gray-100 dark:bg-slate-900 border-b border-gray-200 dark:border-slate-800', + // 'bg-gray-100 dark:bg-slate-900 border border-gray-200 dark:border-slate-800 rounded-xl', transparent: '', }, }, @@ -78,14 +83,35 @@ const navigationContainerVariants = cva( interface NavContainerProps extends VariantProps { children: React.ReactNode + className?: string } +// const NavigationContainer: React.FC = ({ +// children, +// variant, +// }) => { +// return ( +//
+//
+// +// +// +// +//
+//
+// {children} +//
+//
+// ) +// } + const NavigationContainer: React.FC = ({ children, variant, + className, }) => { return ( -
+
{children}
@@ -141,12 +167,14 @@ export type NavigationElement = interface NavProps extends VariantProps { leftElements: NavigationElement[] rightElement?: React.ReactNode + className?: string } const Navigation: React.FC = ({ leftElements: _leftElements, rightElement, variant, + className, }) => { const leftElements = React.useMemo(() => { const SingleItem = (entry: NavigationElementSingle) => { @@ -214,7 +242,7 @@ const Navigation: React.FC = ({ }, [_leftElements]) return ( - +
diff --git a/packages/ui/src/components/sidebar.tsx b/packages/ui/src/components/sidebar.tsx new file mode 100644 index 0000000000..ebcb83d357 --- /dev/null +++ b/packages/ui/src/components/sidebar.tsx @@ -0,0 +1,159 @@ +'use client' + +import classNames from 'classnames' +import Link from 'next/link' +import { + Dispatch, + FC, + ReactNode, + SetStateAction, + createContext, + useContext, + useState, +} from 'react' +import { Chain } from 'sushi' +import { ROUTE_PROCESSOR_5_SUPPORTED_CHAIN_IDS } from 'sushi/config' +import { NetworkIcon } from '../icons/NetworkIcon' +import { AptosCircle } from '../icons/network' +import { Button, ButtonProps } from './button' +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, +} from './command' + +interface SidebarContextType { + isOpen: boolean + setIsOpen: Dispatch> | null +} + +// Create the context +const SidebarContext = createContext({ + isOpen: false, + setIsOpen: null, +}) + +export const useSidebar = () => { + return useContext(SidebarContext) +} + +interface SidebarProviderProps { + children: ReactNode + defaultOpen?: boolean +} + +export const SidebarProvider: FC = ({ + children, + defaultOpen = false, +}) => { + const [isOpen, setIsOpen] = useState(defaultOpen) + + return ( + + {children} + + ) +} + +export const SidebarToggle: FC> = (props) => { + const { isOpen, setIsOpen } = useSidebar() + + return - - ) : null} - {!hideNewPositionButton ? ( - - - - ) : null} +
+ + Hide closed + + setHide((prev) => !prev)} + />
+ {!hideNewSmartPositionButton ? ( + + + + ) : null} + {!hideNewPositionButton ? ( + + + + ) : null}
From 57bb793aeef5be685a6ae309bd5b59b81ea14334 Mon Sep 17 00:00:00 2001 From: 0xMasayoshi <0xMasayoshi@protonmail.com> Date: Wed, 11 Sep 2024 01:10:50 +0800 Subject: [PATCH 08/46] chore: update pool pages layout --- .../pool/v2/[address]/(landing)/layout.tsx | 27 ++- .../pool/v2/[address]/(manage)/layout.tsx | 50 ++++- .../pool/v2/[address]/migrate/layout.tsx | 56 +++-- .../pool/v3/[address]/(landing)/layout.tsx | 27 ++- .../v3/[address]/(manage)/[position]/page.tsx | 16 +- .../v3/[address]/(manage)/create/page.tsx | 17 +- .../pool/v3/[address]/(manage)/layout.tsx | 47 +++- .../v3/[address]/(manage)/positions/page.tsx | 25 +-- .../v3/[address]/smart/(overview)/layout.tsx | 39 ---- .../v3/[address]/smart/(overview)/page.tsx | 13 +- .../v3/[address]/smart/[vault]/layout.tsx | 62 ------ .../pool/v3/[address]/smart/[vault]/page.tsx | 16 +- .../pool/v3/[address]/smart/layout.tsx | 55 +++++ apps/web/src/ui/pool/PoolHeader.tsx | 36 ++-- apps/web/src/ui/pool/PoolPageV2.tsx | 2 +- apps/web/src/ui/pool/PoolPageV3.tsx | 200 +++++++++--------- 16 files changed, 367 insertions(+), 321 deletions(-) delete mode 100644 apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/layout.tsx delete mode 100644 apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/layout.tsx create mode 100644 apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/layout.tsx diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx index 1d028e4b27..f22762bbed 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(landing)/layout.tsx @@ -41,22 +41,21 @@ export default async function Layout({ const headersList = headers() const referer = headersList.get('referer') return ( - <> - - - + +
{children}
- +
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx index ac78d9d3bd..0d54e841d6 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/(manage)/layout.tsx @@ -1,8 +1,15 @@ -import { Container, LinkInternal } from '@sushiswap/ui' +import { V2Pool, getV2Pool } from '@sushiswap/graph-client/data-api' +import { Container } from '@sushiswap/ui' +import { unstable_cache } from 'next/cache' +import { headers } from 'next/headers' import React from 'react' +import { PoolHeader } from 'src/ui/pool/PoolHeader' import { ChainId, ChainKey } from 'sushi/chain' +import { isSushiSwapV2ChainId } from 'sushi/config' +import { isAddress } from 'viem' +import notFound from '../../../../not-found' -export default function Layout({ +export default async function Layout({ children, params, }: { @@ -12,17 +19,38 @@ export default function Layout({ const { chainId: _chainId, address } = params const chainId = +_chainId as ChainId + if ( + !isSushiSwapV2ChainId(chainId) || + !isAddress(address, { strict: false }) + ) { + return notFound() + } + + const pool = (await unstable_cache( + async () => getV2Pool({ chainId, address }), + ['pool', `${chainId}:${address}`], + { + revalidate: 60 * 15, + }, + )()) as V2Pool + + const headersList = headers() + const referer = headersList.get('referer') return ( - -
- - ← Pool - + + +
{children} -
+
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx index d30aa39a5c..7ed6665248 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v2/[address]/migrate/layout.tsx @@ -1,27 +1,57 @@ -import { Container, LinkInternal } from '@sushiswap/ui' +import { V2Pool, getV2Pool } from '@sushiswap/graph-client/data-api' +import { Container } from '@sushiswap/ui' +import { unstable_cache } from 'next/cache' +import { headers } from 'next/headers' import React from 'react' +import { PoolHeader } from 'src/ui/pool/PoolHeader' import { ChainId, ChainKey } from 'sushi/chain' +import { isSushiSwapV2ChainId } from 'sushi/config' +import { isAddress } from 'viem' +import notFound from '../../../../not-found' -export default function Layout({ +export default async function Layout({ children, params, }: { children: React.ReactNode - params: { chainId: string } + params: { chainId: string; address: string } }) { - const chainId = +params.chainId as ChainId + const { chainId: _chainId, address } = params + const chainId = +_chainId as ChainId + + if ( + !isSushiSwapV2ChainId(chainId) || + !isAddress(address, { strict: false }) + ) { + return notFound() + } + + const pool = (await unstable_cache( + async () => getV2Pool({ chainId, address }), + ['pool', `${chainId}:${address}`], + { + revalidate: 60 * 15, + }, + )()) as V2Pool + + const headersList = headers() + const referer = headersList.get('referer') return ( - -
- - ← Back - + + +
{children} -
+
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(landing)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(landing)/layout.tsx index 4a00f4dbe2..58c9864df3 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(landing)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(landing)/layout.tsx @@ -40,22 +40,21 @@ export default async function Layout({ const headersList = headers() const referer = headersList.get('referer') return ( - <> - - - + +
{children}
- +
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/[position]/page.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/[position]/page.tsx index 7eb19a67d3..6f5d083f5f 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/[position]/page.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/[position]/page.tsx @@ -1,21 +1,7 @@ -import { LinkInternal } from '@sushiswap/ui' import { V3PositionView } from 'src/ui/pool/V3PositionView' -import { ChainId, ChainKey } from 'sushi/chain' export default async function V3PositionsPage({ params, }: { params: { chainId: string; address: string; position: string } }) { - const chainId = +params.chainId as ChainId - - return ( -
- - ← Pool - - -
- ) + return } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/create/page.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/create/page.tsx index b8e871d787..87478dc125 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/create/page.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/create/page.tsx @@ -1,9 +1,8 @@ -import { LinkInternal } from '@sushiswap/ui' import { notFound } from 'next/navigation' import React from 'react' import { ConcentratedLiquidityProvider } from 'src/ui/pool/ConcentratedLiquidityProvider' import { NewPosition } from 'src/ui/pool/NewPosition' -import { type ChainId, ChainKey } from 'sushi' +import { type ChainId } from 'sushi' import { isSushiSwapV3ChainId } from 'sushi/config' import { isAddress } from 'viem' @@ -21,16 +20,8 @@ export default async function PositionsCreatePage({ } return ( -
- - ← Positions - - - - -
+ + + ) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/layout.tsx index dcad7af911..aca50e0594 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/layout.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/layout.tsx @@ -1,14 +1,57 @@ +import { V3Pool, getV3Pool } from '@sushiswap/graph-client/data-api' import { Container } from '@sushiswap/ui' +import { unstable_cache } from 'next/cache' +import { headers } from 'next/headers' +import { notFound } from 'next/navigation' import React from 'react' +import { PoolHeader } from 'src/ui/pool/PoolHeader' +import { ChainId, ChainKey } from 'sushi/chain' +import { isSushiSwapV3ChainId } from 'sushi/config' +import { isAddress } from 'viem' -export default function Layout({ +export default async function Layout({ children, + params, }: { children: React.ReactNode + params: { chainId: string; address: string } }) { + const { chainId: _chainId, address } = params + const chainId = +_chainId as ChainId + + if ( + !isSushiSwapV3ChainId(chainId) || + !isAddress(address, { strict: false }) + ) { + return notFound() + } + + const pool = (await unstable_cache( + async () => getV3Pool({ chainId, address }), + ['pool', `${chainId}:${address}`], + { + revalidate: 60 * 15, + }, + )()) as V3Pool + + const headersList = headers() + const referer = headersList.get('referer') + return ( - {children} + +
+ {children} +
) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/positions/page.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/positions/page.tsx index 032b991ffd..9cb099760c 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/positions/page.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/(manage)/positions/page.tsx @@ -1,10 +1,9 @@ import { V3Pool, getV3Pool } from '@sushiswap/graph-client/data-api' -import { LinkInternal } from '@sushiswap/ui' import { unstable_cache } from 'next/cache' import { notFound } from 'next/navigation' import { PoolsFiltersProvider } from 'src/ui/pool' import { ConcentratedPositionsTable } from 'src/ui/pool/ConcentratedPositionsTable' -import { ChainId, ChainKey } from 'sushi/chain' +import { ChainId } from 'sushi/chain' import { isSushiSwapV3ChainId } from 'sushi/config' import { isAddress } from 'viem' @@ -32,20 +31,12 @@ export default async function ManageV3PoolPage({ )()) as V3Pool return ( -
- - ← Pool - - - - -
+ + + ) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/layout.tsx deleted file mode 100644 index 7d8fa5a7bf..0000000000 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/layout.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { - CardDescription, - CardHeader, - CardTitle, - Container, - LinkInternal, -} from '@sushiswap/ui' -import React from 'react' -import { ChainId, ChainKey } from 'sushi/chain' - -export default async function Layout({ - children, - params, -}: { - children: React.ReactNode - params: { chainId: string; address: string } -}) { - const { chainId: _chainId, address } = params - const chainId = +_chainId as ChainId - return ( -
- - - ← Pool details - - - Available Strategies - - Choose one of the following strategies: - - - - {children} -
- ) -} diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/page.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/page.tsx index 9d16dcffc9..897d3b787f 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/page.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/(overview)/page.tsx @@ -3,6 +3,7 @@ import { getVaults, isSmartPoolChainId, } from '@sushiswap/graph-client/data-api' +import { CardDescription, CardHeader, CardTitle } from '@sushiswap/ui' import { unstable_cache } from 'next/cache' import { SteerCarousel } from 'src/ui/pool/Steer/SteerCarousel' import { ChainId } from 'sushi/chain' @@ -46,5 +47,15 @@ export default async function VaultOverviewPage({ return notFound(chainId) } - return + return ( + <> + + Available Strategies + + Choose one of the following strategies: + + + + + ) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/layout.tsx deleted file mode 100644 index 6aab3fd63a..0000000000 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/layout.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { getVault, isSmartPoolChainId } from '@sushiswap/graph-client/data-api' -import { Container, LinkInternal } from '@sushiswap/ui' -import { unstable_cache } from 'next/cache' -import { notFound } from 'next/navigation' -import React from 'react' -import { ChainId, ChainKey } from 'sushi/chain' -import { isAddress } from 'viem' - -export default async function Layout({ - children, - params, -}: { - children: React.ReactNode - params: { chainId: string; vault: string; address: string } -}) { - const { chainId: _chainId, address, vault: vaultAddress } = params - const chainId = +_chainId as ChainId - - if ( - !isSmartPoolChainId(chainId) || - !isAddress(vaultAddress, { strict: false }) - ) { - return notFound() - } - - const vault = await unstable_cache( - async () => - await getVault({ - chainId, - vaultAddress, - }), - ['vault', `${chainId}:${vaultAddress}`], - { revalidate: 60 * 15 }, - )() - - if (!vault) { - notFound() - } - - return ( - -
- - ← Strategies - - {vault.isDeprecated && ( -
-
This vault is deprecated.
-
- {"It will not accrue any fees and won't be readjusted."} -
-
- )} - - {children} -
-
- ) -} diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/page.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/page.tsx index b85c6ac517..be82526e59 100644 --- a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/page.tsx +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/[vault]/page.tsx @@ -9,7 +9,6 @@ import { getTokenRatios, getVaultPositions } from '@sushiswap/steer-sdk' import formatDistanceStrict from 'date-fns/formatDistanceStrict' import formatDistanceToNow from 'date-fns/formatDistanceToNow' import { unstable_cache } from 'next/cache' -import { notFound } from 'next/navigation' import { SteerStrategyGeneric } from 'src/ui/pool/Steer/SteerStrategies' import { SteerBaseStrategy } from 'src/ui/pool/Steer/SteerStrategies/SteerBaseStrategy' import type { ChainId } from 'sushi' @@ -18,6 +17,7 @@ import { Token } from 'sushi/currency' import { formatNumber } from 'sushi/format' import { tickToPrice } from 'sushi/pool/sushiswap-v3' import { PublicClient, createPublicClient, isAddress } from 'viem' +import notFound from '../../../../../not-found' function getPriceExtremes( vault: VaultV1, @@ -121,5 +121,17 @@ export default async function SteerVaultPage({ const Component = SteerBaseStrategy - return + return ( + <> + {vault.isDeprecated && ( +
+
This vault is deprecated.
+
+ {"It will not accrue any fees and won't be readjusted."} +
+
+ )} + + + ) } diff --git a/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/layout.tsx b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/layout.tsx new file mode 100644 index 0000000000..61257bfd77 --- /dev/null +++ b/apps/web/src/app/(evm)/[chainId]/pool/v3/[address]/smart/layout.tsx @@ -0,0 +1,55 @@ +import { V3Pool, getV3Pool } from '@sushiswap/graph-client/data-api' +import { Container } from '@sushiswap/ui' +import { unstable_cache } from 'next/cache' +import { headers } from 'next/headers' +import { notFound } from 'next/navigation' +import { PoolHeader } from 'src/ui/pool/PoolHeader' +import { ChainId, ChainKey } from 'sushi/chain' +import { isSushiSwapV3ChainId } from 'sushi/config' +import { isAddress } from 'viem' + +export default async function Layout({ + children, + params, +}: { + children: React.ReactNode + params: { chainId: string; address: string } +}) { + const { chainId: _chainId, address } = params + const chainId = +_chainId as ChainId + + if ( + !isSushiSwapV3ChainId(chainId) || + !isAddress(address, { strict: false }) + ) { + return notFound() + } + + const pool = (await unstable_cache( + async () => getV3Pool({ chainId, address }), + ['pool', `${chainId}:${address}`], + { + revalidate: 60 * 15, + }, + )()) as V3Pool + + const headersList = headers() + const referer = headersList.get('referer') + return ( + + +
+ {children} +
+
+ ) +} diff --git a/apps/web/src/ui/pool/PoolHeader.tsx b/apps/web/src/ui/pool/PoolHeader.tsx index 04e6ada6be..889c257753 100644 --- a/apps/web/src/ui/pool/PoolHeader.tsx +++ b/apps/web/src/ui/pool/PoolHeader.tsx @@ -27,6 +27,7 @@ type PoolHeader = { } priceRange?: string hasEnabledStrategies?: boolean + showAddLiquidityButton?: boolean } export const PoolHeader: FC = ({ @@ -35,6 +36,7 @@ export const PoolHeader: FC = ({ pool, apy, priceRange, + showAddLiquidityButton = false, }) => { const [token0, token1] = useMemo(() => { if (!pool) return [undefined, undefined] @@ -67,7 +69,7 @@ export const PoolHeader: FC = ({ href={backUrl} className="text-blue hover:underline text-sm" > - ← Pools + ← Back
@@ -107,21 +109,23 @@ export const PoolHeader: FC = ({ : 'UNKNOWN'}
- + {showAddLiquidityButton ? ( + + ) : null}
diff --git a/apps/web/src/ui/pool/PoolPageV2.tsx b/apps/web/src/ui/pool/PoolPageV2.tsx index 27f7347144..5a40b09e97 100644 --- a/apps/web/src/ui/pool/PoolPageV2.tsx +++ b/apps/web/src/ui/pool/PoolPageV2.tsx @@ -15,7 +15,7 @@ interface PoolPageV2 { export const PoolPageV2: FC = ({ pool }) => { return ( - + {/* */}
diff --git a/apps/web/src/ui/pool/PoolPageV3.tsx b/apps/web/src/ui/pool/PoolPageV3.tsx index baf6012aea..063a55d024 100644 --- a/apps/web/src/ui/pool/PoolPageV3.tsx +++ b/apps/web/src/ui/pool/PoolPageV3.tsx @@ -52,114 +52,112 @@ const Pool: FC<{ pool: V3Pool }> = ({ pool }) => { const fiatValues = useTokenAmountDollarValues({ chainId, amounts: reserves }) return ( - -
- {pool.hasEnabledSteerVault && ( - - {`This pool has been activated to leverage our smart pool feature. Smart pools are designed to optimize the + + {pool.hasEnabledSteerVault && ( + + {`This pool has been activated to leverage our smart pool feature. Smart pools are designed to optimize the allocation of liquidity within customized price ranges, thereby improving trading efficiency. They achieve this by enhancing liquidity depth around the current price, which results in higher fee earnings for liquidity providers (LPs) and allows the market to dictate the distribution of LPs' positions based on rational decisions.`}{' '} - To create a smart pool position, click{' '} - - here - - - )} -
- -
- - - Pool Liquidity - - {formatUSD(fiatValues[0] + fiatValues[1])} - - - - - Tokens - - - - - - - - -
- Statistics -
-
-
- -
-
- Volume (24h) - {poolStats ? ( -
- {formatUSD(poolStats.volumeUSD1d ?? 0)}{' '} - 0 - ? 'text-green' - : 'text-red', - )} - > - ({poolStats['volumeUSD1dChange'].toFixed(2)} - %) - -
- ) : ( - - )} -
-
- Fees (24h) - {poolStats ? ( -
- {formatUSD(poolStats.feesUSD1d ?? 0)}{' '} - 0 - ? 'text-green' - : 'text-red', - )} - > - ({poolStats['feesUSD1dChange'].toFixed(2)} - %) - -
- ) : ( - - )} -
+ To create a smart pool position, click{' '} + + here + + + )} +
+ +
+ + + Pool Liquidity + + {formatUSD(fiatValues[0] + fiatValues[1])} + + + + + Tokens + + + + + + + + +
+ Statistics
- -
-
-
-
- + + + +
+
+ Volume (24h) + {poolStats ? ( +
+ {formatUSD(poolStats.volumeUSD1d ?? 0)}{' '} + 0 + ? 'text-green' + : 'text-red', + )} + > + ({poolStats['volumeUSD1dChange'].toFixed(2)} + %) + +
+ ) : ( + + )} +
+
+ Fees (24h) + {poolStats ? ( +
+ {formatUSD(poolStats.feesUSD1d ?? 0)}{' '} + 0 + ? 'text-green' + : 'text-red', + )} + > + ({poolStats['feesUSD1dChange'].toFixed(2)} + %) + +
+ ) : ( + + )} +
+
+
+
- -
+
+ +
+ + ) } From e614aba4bc34bc4d6dfe7bcf92bc6d12555d23b4 Mon Sep 17 00:00:00 2001 From: 0xMasayoshi <0xMasayoshi@protonmail.com> Date: Wed, 11 Sep 2024 16:44:08 +0800 Subject: [PATCH 09/46] chore: always display label on explore charts legend --- apps/web/src/ui/explore/tvl-chart.tsx | 26 +++++++++++++----------- apps/web/src/ui/explore/volume-chart.tsx | 26 +++++++++++++----------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/apps/web/src/ui/explore/tvl-chart.tsx b/apps/web/src/ui/explore/tvl-chart.tsx index 7bb1dd21de..7e37fb465c 100644 --- a/apps/web/src/ui/explore/tvl-chart.tsx +++ b/apps/web/src/ui/explore/tvl-chart.tsx @@ -63,11 +63,11 @@ export const TVLChart: FC = ({ data, chainId }) => { if (v2TVLNode) v2TVLNode.innerHTML = params[0].data[1] ? formatUSD(params[0].data[1]) - : 'v2' + : '' if (v3TVLNode) v3TVLNode.innerHTML = params[1].data[1] ? formatUSD(params[1].data[1]) - : 'v3' + : '' }, []) const onMouseLeave = useCallback(() => { @@ -79,8 +79,8 @@ export const TVLChart: FC = ({ data, chainId }) => { if (tvlNode) tvlNode.innerHTML = formatUSD(combinedTVL) if (dateNode) dateNode.innerHTML = format(new Date(currentDate), 'dd MMM yyyy HH:mm aa') - if (v2TVLNode) v2TVLNode.innerHTML = 'v2' - if (v3TVLNode) v3TVLNode.innerHTML = 'v3' + if (v2TVLNode) v2TVLNode.innerHTML = '' + if (v3TVLNode) v3TVLNode.innerHTML = '' }, [combinedTVL, currentDate]) const DEFAULT_OPTION: EChartsOption = useMemo( @@ -200,17 +200,19 @@ export const TVLChart: FC = ({ data, chainId }) => {
-
- - v2 +
+ + + v2 + -
-
- - v3 +
+ + + v3 + -
diff --git a/apps/web/src/ui/explore/volume-chart.tsx b/apps/web/src/ui/explore/volume-chart.tsx index 182f1e776c..3d051bb6b0 100644 --- a/apps/web/src/ui/explore/volume-chart.tsx +++ b/apps/web/src/ui/explore/volume-chart.tsx @@ -53,11 +53,11 @@ export const VolumeChart: FC = ({ data, chainId }) => { if (v2VolumeNode) v2VolumeNode.innerHTML = params[0].data[1] ? formatUSD(params[0].data[1]) - : 'v2' + : '' if (v3VolumeNode) v3VolumeNode.innerHTML = params[1].data[1] ? formatUSD(params[1].data[1]) - : 'v3' + : '' }, []) const onMouseLeave = useCallback(() => { @@ -68,8 +68,8 @@ export const VolumeChart: FC = ({ data, chainId }) => { if (volumeNode) volumeNode.innerHTML = formatUSD(totalVolume) if (dateNode) dateNode.innerHTML = 'Past month' - if (v2VolumeNode) v2VolumeNode.innerHTML = 'v2' - if (v3VolumeNode) v3VolumeNode.innerHTML = 'v3' + if (v2VolumeNode) v2VolumeNode.innerHTML = '' + if (v3VolumeNode) v3VolumeNode.innerHTML = '' }, [totalVolume]) const DEFAULT_OPTION: EChartsOption = useMemo( @@ -166,17 +166,19 @@ export const VolumeChart: FC = ({ data, chainId }) => {
-
- - v2 +
+ + + v2 + -
-
- - v3 +
+ + + v3 + -
From 8fdd91f3efbc475a4513de26c15df9bb23380874 Mon Sep 17 00:00:00 2001 From: 0xMasayoshi <0xMasayoshi@protonmail.com> Date: Wed, 11 Sep 2024 19:22:27 +0800 Subject: [PATCH 10/46] chore: update sidebar layout --- apps/web/src/app/(evm)/header.tsx | 6 ++---- apps/web/src/app/(evm)/layout.tsx | 2 +- apps/web/src/app/layout.tsx | 3 +-- packages/ui/src/components/sidebar.tsx | 17 +++++++---------- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/apps/web/src/app/(evm)/header.tsx b/apps/web/src/app/(evm)/header.tsx index fd31fa4d39..a5b4cf9bac 100644 --- a/apps/web/src/app/(evm)/header.tsx +++ b/apps/web/src/app/(evm)/header.tsx @@ -14,8 +14,8 @@ export const Header: FC = () => { const { address } = useAccount() return ( -
-
+
+
{
} /> diff --git a/apps/web/src/app/(evm)/layout.tsx b/apps/web/src/app/(evm)/layout.tsx index a6c67e73b6..6f0a2cc42a 100644 --- a/apps/web/src/app/(evm)/layout.tsx +++ b/apps/web/src/app/(evm)/layout.tsx @@ -17,7 +17,7 @@ export default function EvmLayout({ children }: { children: React.ReactNode }) { const cookie = headers().get('cookie') return ( -
+
{children}
diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 0a66875411..1766db4a9c 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -1,7 +1,6 @@ import '@sushiswap/ui/index.css' import { ToastContainer } from '@sushiswap/notifications' -// import { Sidebar } from '@sushiswap/ui' import type { Metadata } from 'next' import { Inter, Roboto_Mono } from 'next/font/google' import React from 'react' @@ -57,7 +56,7 @@ export default function RootLayout({ - + {children} diff --git a/packages/ui/src/components/sidebar.tsx b/packages/ui/src/components/sidebar.tsx index 8f1426c062..7a46581a66 100644 --- a/packages/ui/src/components/sidebar.tsx +++ b/packages/ui/src/components/sidebar.tsx @@ -15,6 +15,7 @@ import { Chain } from 'sushi' import { ROUTE_PROCESSOR_5_SUPPORTED_CHAIN_IDS } from 'sushi/config' import { NetworkIcon } from '../icons/NetworkIcon' import { AptosCircle } from '../icons/network' +import { useBreakpoint } from '../lib' import { Button, ButtonProps } from './button' import { Command, @@ -75,12 +76,12 @@ export const SidebarContainer: FC = ({ const { isOpen } = useSidebar() return ( -
+
{children} @@ -122,14 +123,10 @@ export const SidebarContainer: FC = ({ export const Sidebar = () => { const { isOpen } = useSidebar() + return !isOpen ? null : ( -