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

feat: sidebar #1683

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d8fa6f3
archive: collapsible sidebar component
0xMasayoshi Sep 6, 2024
036176c
fix: SidebarContainer & background color
0xMasayoshi Sep 6, 2024
128254e
fix: checksum v3 factory on scroll
0xMasayoshi Sep 10, 2024
01d9168
chore: show splash on loading pool pages
0xMasayoshi Sep 10, 2024
51a148f
fix: portfolio settings style
0xMasayoshi Sep 10, 2024
f29b207
fix: red & green colors
0xMasayoshi Sep 10, 2024
88b15f9
fix: responsiveness in ConcentratedPositionsTable
0xMasayoshi Sep 10, 2024
57bb793
chore: update pool pages layout
0xMasayoshi Sep 10, 2024
e614aba
chore: always display label on explore charts legend
0xMasayoshi Sep 11, 2024
8fdd91f
chore: update sidebar layout
0xMasayoshi Sep 11, 2024
0390f6d
fix: hide header sidebar on smaller devices
0xMasayoshi Sep 11, 2024
396d04f
chore: mv sidebar to /app
0xMasayoshi Sep 11, 2024
8583c07
fix: sidebar padding
0xMasayoshi Sep 11, 2024
cdec641
chore: update page layouts
0xMasayoshi Sep 11, 2024
0b15f88
feat: sidebar functionality
0xMasayoshi Sep 11, 2024
4bf38c8
fix: only show sidebar on chain-gated pages
0xMasayoshi Sep 12, 2024
1529240
chore: update navbar
0xMasayoshi Sep 12, 2024
351ed3a
fix: header
0xMasayoshi Sep 12, 2024
c4e0aa3
fix: NavigationMenuTrigger style
0xMasayoshi Sep 12, 2024
4e0a9da
chore: mv /(trade) under /[chainId] and update chainId logic
0xMasayoshi Sep 13, 2024
ea80beb
fix: redirects
0xMasayoshi Sep 13, 2024
d16208d
Merge remote-tracking branch 'origin/master' into feat/sidebar
0xMasayoshi Sep 13, 2024
712328d
chore: mv hotjar to root evm layout
0xMasayoshi Sep 13, 2024
e7f90a2
feat: add sidebar to aptos
0xMasayoshi Sep 13, 2024
14488da
chore: mv /aptos/(common) -> /aptos/_common
0xMasayoshi Sep 14, 2024
516fbf1
fix: carousel position when sidebar open
0xMasayoshi Sep 14, 2024
0bea9f6
chore: add bg to layouts
0xMasayoshi Sep 14, 2024
a11d770
chore: add NonStandardChain types
0xMasayoshi Sep 17, 2024
17d0bfe
feat: add handling for unsupported networks on sidebar
0xMasayoshi Sep 17, 2024
6c75e55
chore: add support for nonstandard networks to NetworkSelector
0xMasayoshi Sep 18, 2024
92ea2ac
Merge remote-tracking branch 'origin/master' into feat/sidebar
0xMasayoshi Sep 22, 2024
99ec9b8
feat: mobile network selection behavior
0xMasayoshi Sep 23, 2024
a1098a9
fix: HeaderNetworkSelector behavior
0xMasayoshi Sep 24, 2024
769d098
chore: cleanup
0xMasayoshi Sep 24, 2024
9ac62e5
Merge remote-tracking branch 'origin/master' into feat/sidebar
0xMasayoshi Sep 24, 2024
c14510b
fix: build
0xMasayoshi Sep 24, 2024
1ab7d76
fix: stake layout
0xMasayoshi Sep 24, 2024
241ad96
fix: tests
0xMasayoshi Sep 24, 2024
9a33ac5
feat: twap/dca/xswap supportedNetworks
0xMasayoshi Sep 27, 2024
5f9d69a
feat: selected network sidebar state
0xMasayoshi Sep 27, 2024
7fc0e05
fix: header links
0xMasayoshi Sep 27, 2024
5a9bb07
fix: trade link in header
0xMasayoshi Sep 27, 2024
966e617
chore: add sidebar to /stake
0xMasayoshi Sep 28, 2024
e4ffb52
Merge remote-tracking branch 'origin/master' into feat/sidebar
0xMasayoshi Oct 1, 2024
ef79dda
chore: stake sidebar default closed
0xMasayoshi Oct 1, 2024
c5bb067
chore: tron sidebar support
0xMasayoshi Oct 2, 2024
0f17ed6
Merge remote-tracking branch 'origin/master' into feat/sidebar
0xMasayoshi Oct 2, 2024
eea413e
fix: tests
0xMasayoshi Oct 3, 2024
9d3fe09
fix: red & green colors
0xMasayoshi Oct 3, 2024
c4cb6b4
chore: PREFERRED_CHAINID_ORDER
0xMasayoshi Oct 3, 2024
b65e1f2
fix: /swap spacing on aptos & tron
0xMasayoshi Oct 3, 2024
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
5 changes: 0 additions & 5 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ const nextConfig = bundleAnalyzer({
permanent: true,
destination: 'https://medium.com/sushiswap-org',
},
{
source: '/skale/swap',
permanent: true,
destination: '/swap?chainId=2046399126',
},
{
source: '/swap/cross-chain:path*',
permanent: true,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"lodash.zip": "4.2.0",
"ms": "2.1.3",
"nanoid": "4.0.0",
"next": "14.2.11",
"next": "14.2.13",
"next-themes": "0.2.1",
"octokit": "2.1.0",
"petra-plugin-wallet-adapter": "0.4.5",
Expand Down
18 changes: 0 additions & 18 deletions apps/web/src/app/(evm)/(trade)/header.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions apps/web/src/app/(evm)/(trade)/layout.tsx

This file was deleted.

141 changes: 80 additions & 61 deletions apps/web/src/app/(evm)/[chainId]/(positions)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
'use client'

import { isPoolChainId } from '@sushiswap/graph-client/data-api'
import { Container, LinkInternal } from '@sushiswap/ui'
import { useSearchParams } from 'next/navigation'
import { POOL_SUPPORTED_NETWORKS } from 'src/config'
import { PathnameButton } from 'src/ui/pathname-button'
import { PoolsFiltersProvider } from 'src/ui/pool'
import { ChainId, ChainKey, isChainId } from 'sushi/chain'
import { SidebarContainer, SidebarProvider } from 'src/ui/sidebar'
import { ChainId, ChainKey } from 'sushi/chain'
import { Header } from '../header'
import notFound from '../not-found'
import { Hero } from './hero'

export default function TabsLayout({
export default function PositionsLayout({
children,
params,
}: {
Expand All @@ -17,69 +22,83 @@ export default function TabsLayout({
const chainId = +params.chainId as ChainId
const searchParams = useSearchParams()

if (!isChainId(chainId)) {
throw new Error('Must be a valid chain id')
if (!isPoolChainId(chainId)) {
return notFound()
}

return (
<>
<Container maxWidth="7xl" className="px-4 py-16">
<Hero chainId={chainId} />
</Container>
<Container
maxWidth="7xl"
className="px-4 flex justify-between flex-wrap-reverse gap-4 pb-4"
<SidebarProvider>
<Header chainId={chainId} />
<SidebarContainer
shiftContent
selectedNetwork={chainId}
supportedNetworks={POOL_SUPPORTED_NETWORKS}
unsupportedNetworkHref={'/ethereum/pool'}
>
<div className="flex flex-wrap items-center gap-2">
<LinkInternal
shallow={true}
scroll={false}
href={`/${ChainKey[chainId]}/pool?${searchParams.toString()}`}
<main className="flex flex-col h-full flex-1">
<Container maxWidth="7xl" className="px-4 py-16">
<Hero chainId={chainId} />
</Container>
<Container
maxWidth="7xl"
className="px-4 flex justify-between flex-wrap-reverse gap-4 pb-4"
>
<PathnameButton
id="my-positions"
pathname={`/${ChainKey[chainId]}/pool`}
asChild
size="sm"
>
My Positions
</PathnameButton>
</LinkInternal>
<LinkInternal
shallow={true}
scroll={false}
href={`/${ChainKey[chainId]}/rewards?${searchParams.toString()}`}
>
<PathnameButton
id="my-rewards"
pathname={`/${ChainKey[chainId]}/rewards`}
asChild
size="sm"
>
My Rewards
</PathnameButton>
</LinkInternal>
<LinkInternal
shallow={true}
scroll={false}
href={`/${ChainKey[chainId]}/migrate?${searchParams.toString()}`}
>
<PathnameButton
id="migrate"
pathname={`/${ChainKey[chainId]}/migrate`}
asChild
size="sm"
>
Migrate
</PathnameButton>
</LinkInternal>
</div>
</Container>
<section className="flex flex-col flex-1">
<div className="bg-gray-50 dark:bg-white/[0.02] border-t border-accent pt-4 pb-20 h-full">
<PoolsFiltersProvider>{children}</PoolsFiltersProvider>
</div>
</section>
</>
<div className="flex flex-wrap items-center gap-2">
<LinkInternal
shallow={true}
scroll={false}
href={`/${ChainKey[chainId]}/pool?${searchParams.toString()}`}
>
<PathnameButton
id="my-positions"
pathname={`/${ChainKey[chainId]}/pool`}
asChild
size="sm"
>
My Positions
</PathnameButton>
</LinkInternal>
<LinkInternal
shallow={true}
scroll={false}
href={`/${
ChainKey[chainId]
}/rewards?${searchParams.toString()}`}
>
<PathnameButton
id="my-rewards"
pathname={`/${ChainKey[chainId]}/rewards`}
asChild
size="sm"
>
My Rewards
</PathnameButton>
</LinkInternal>
<LinkInternal
shallow={true}
scroll={false}
href={`/${
ChainKey[chainId]
}/migrate?${searchParams.toString()}`}
>
<PathnameButton
id="migrate"
pathname={`/${ChainKey[chainId]}/migrate`}
asChild
size="sm"
>
Migrate
</PathnameButton>
</LinkInternal>
</div>
</Container>
<section className="flex flex-col flex-1">
<div className="bg-gray-50 dark:bg-white/[0.02] border-t border-accent pt-4 pb-10 min-h-screen">
<PoolsFiltersProvider>{children}</PoolsFiltersProvider>
</div>
</section>
</main>
</SidebarContainer>
</SidebarProvider>
)
}
13 changes: 9 additions & 4 deletions apps/web/src/app/(evm)/[chainId]/(positions)/pool/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use client'

import { Container } from '@sushiswap/ui'
import React from 'react'
import { ChainId } from 'sushi/chain'

import { notFound } from 'next/navigation'
import React from 'react'
import { POOL_SUPPORTED_NETWORKS } from 'src/config'
import { PositionsTab } from 'src/ui/pool/PositionsTab'
import { TableFiltersNetwork } from 'src/ui/pool/TableFiltersNetwork'
import { TableFiltersResetButton } from 'src/ui/pool/TableFiltersResetButton'
import { TableFiltersSearchToken } from 'src/ui/pool/TableFiltersSearchToken'
import { ChainId } from 'sushi/chain'
import { isSushiSwapChainId } from 'sushi/config'

export default function MyPositionsPage({
Expand All @@ -26,7 +26,12 @@ export default function MyPositionsPage({
<Container maxWidth="7xl" className="px-4">
<div className="flex flex-col sm:flex-row gap-3 mb-4">
<TableFiltersSearchToken />
<TableFiltersNetwork chainId={+chainId as ChainId} />
<TableFiltersNetwork
network={chainId}
supportedNetworks={POOL_SUPPORTED_NETWORKS}
unsupportedNetworkHref="/ethereum/pool"
className="lg:hidden block"
/>
<TableFiltersResetButton />
</div>
<PositionsTab chainId={chainId} />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { SidebarContainer } from 'src/ui/sidebar'
import { ChainId } from 'sushi/chain'
import {
SUSHIXSWAP_2_SUPPORTED_CHAIN_IDS,
isSushiXSwap2ChainId,
} from 'sushi/config'
import NotFound from '~evm/[chainId]/not-found'
import { Providers } from './providers'

export default function CrossChainSwapLayout({
children,
params,
}: { children: React.ReactNode; params: { chainId: string } }) {
const chainId = +params.chainId as ChainId

if (!isSushiXSwap2ChainId(chainId)) {
return NotFound()
}

return (
<Providers>
<SidebarContainer
selectedNetwork={chainId}
supportedNetworks={SUSHIXSWAP_2_SUPPORTED_CHAIN_IDS}
unsupportedNetworkHref="/ethereum/cross-chain-swap"
>
<main className="lg:p-4 mt-16 mb-[86px]">{children}</main>
</SidebarContainer>
</Providers>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ export default function CrossChainSwapLoading() {
return (
<Container maxWidth="lg" className="px-4">
<div className="flex flex-col gap-4">
<div />
<div className="flex flex-col gap-2 mb-4 sm:mt-10 mt-2">
<SkeletonBox className="w-[140px] h-[53px]" />
<SkeletonBox className="h-[20px] w-[280px]" />
</div>
<div className="flex gap-2">
<SkeletonBox className="h-[36px] w-[125px]" />
<SkeletonBox className="h-[36px] w-[125px]" />
<SkeletonBox className="h-[36px] w-[61px]" />
<SkeletonBox className="h-[36px] w-[56px]" />
<SkeletonBox className="h-[36px] w-[54px]" />
<SkeletonBox className="h-[36px] w-[136px]" />
</div>
<div className="flex flex-col gap-2.5">
<SkeletonBox className="w-full h-[169px]" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { Container } from '@sushiswap/ui'
import { CrossChainSwapWidget } from 'src/ui/swap/cross-chain/cross-chain-swap-widget'

import { Providers } from './providers'

export const metadata = {
title: 'Cross-Chain Swap',
description: 'SushiSwap Cross-Chain Swap',
}

export default async function CrossChainSwapPage() {
return (
<Providers>
<Container maxWidth="lg" className="px-4">
<CrossChainSwapWidget />
</Container>
</Providers>
<Container maxWidth="lg" className="px-4">
<CrossChainSwapWidget />
</Container>
)
}
28 changes: 28 additions & 0 deletions apps/web/src/app/(evm)/[chainId]/(trade)/dca/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { TWAP_SUPPORTED_CHAIN_IDS, isTwapSupportedChainId } from 'src/config'
import { SidebarContainer } from 'src/ui/sidebar'
import { ChainId } from 'sushi/chain'
import NotFound from '~evm/[chainId]/not-found'
import { Providers } from './providers'

export default function SwapDCALayout({
children,
params,
}: { children: React.ReactNode; params: { chainId: string } }) {
const chainId = +params.chainId as ChainId

if (!isTwapSupportedChainId(chainId)) {
return NotFound()
}

return (
<Providers>
<SidebarContainer
selectedNetwork={chainId}
supportedNetworks={TWAP_SUPPORTED_CHAIN_IDS}
unsupportedNetworkHref="/ethereum/dca"
>
<main className="lg:p-4 mt-16 mb-[86px]">{children}</main>
</SidebarContainer>
</Providers>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ export default function SimpleSwapLoading() {
return (
<Container maxWidth="lg" className="px-4">
<div className="flex flex-col gap-4">
<div />
<div className="flex flex-col gap-2 mb-4 sm:mt-10 mt-2">
<SkeletonBox className="w-[140px] h-[53px]" />
<SkeletonBox className="h-[20px] w-[280px]" />
</div>
<div className="flex gap-2">
<SkeletonBox className="h-[36px] w-[125px]" />
<SkeletonBox className="h-[36px] w-[125px]" />
<SkeletonBox className="h-[36px] w-[61px]" />
<SkeletonBox className="h-[36px] w-[56px]" />
<SkeletonBox className="h-[36px] w-[54px]" />
<SkeletonBox className="h-[36px] w-[136px]" />
</div>
<div className="flex flex-col gap-2.5">
<SkeletonBox className="w-full h-[142px]" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Container } from '@sushiswap/ui'
import dynamic from 'next/dynamic'
import { Providers } from './providers'

const TWAPPanel = dynamic(
() => import('src/ui/swap/twap/twap').then((it) => it.TWAPPanel),
Expand All @@ -14,10 +13,8 @@ export const metadata = {

export default function SwapDCAPage() {
return (
<Providers>
<Container maxWidth="lg" className="px-4">
<TWAPPanel />
</Container>
</Providers>
<Container maxWidth="lg" className="px-4">
<TWAPPanel />
</Container>
)
}
Loading
Loading