Skip to content

Commit

Permalink
Merge branch 'data-api' of github.com:sushiswap/sushiswap into data-api
Browse files Browse the repository at this point in the history
  • Loading branch information
OlaStenberg committed Aug 7, 2024
2 parents 3e4e15f + ce94042 commit 38f2050
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 40 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/app/(cms)/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function Header() {
const navData: NavigationElement[] = [
{
title: 'Explore',
items: EXPLORE_NAVIGATION_LINKS,
items: EXPLORE_NAVIGATION_LINKS(),
show: 'everywhere',
type: NavigationElementType.Dropdown,
},
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/app/(evm)/[chainId]/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ export const Header: FC = () => {
const chainId = useChainId()
return (
<Navigation
leftElements={headerElements}
leftElements={headerElements(chainId)}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
chainId={chainId}
/>
)
}
6 changes: 5 additions & 1 deletion apps/web/src/app/(evm)/[chainId]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ChevronRightIcon } from '@heroicons/react/20/solid'
import { Button, LinkInternal, typographyVariants } from '@sushiswap/ui'
import { useChainId } from 'wagmi'

export default function NotFound() {
const chainId = useChainId()
return (
<div className="flex justify-center items-center pt-20 px-4">
<div className="flex flex-col gap-8 text-center">
Expand Down Expand Up @@ -30,7 +32,9 @@ export default function NotFound() {
icon={ChevronRightIcon}
iconPosition="end"
>
<LinkInternal href="/pool">See a list of our pools</LinkInternal>
<LinkInternal href={`/${chainId}/explore/pools`}>
See a list of our pools
</LinkInternal>
</Button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default async function Layout({
backUrl={
referer?.includes('/pool?')
? referer?.toString()
: `/${chainId}/explore`
: `/${chainId}/explore/pools`
}
address={pool.address}
pool={pool}
Expand Down
28 changes: 8 additions & 20 deletions apps/web/src/app/(evm)/_common/header-elements.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
import {
type NavigationElement,
NavigationElementDropdown,
NavigationElementType,
NavigationMenuLink,
OnramperButton,
navigationMenuTriggerStyle,
} from '@sushiswap/ui'
import { EXPLORE_NAVIGATION_LINKS } from 'src/app/_common/header-elements'

const MORE_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [
{
title: 'Pay',
href: 'https://pay.sushi.com',
description:
'Stream or create a vesting schedule with any ERC20 to any wallet.',
},
{
title: 'Bonds',
href: 'https://sushi.com/bonds',
description:
'Buy discounted tokens with vesting to support projects in a sustainable manner.',
},
]
import {
EXPLORE_NAVIGATION_LINKS,
MORE_NAVIGATION_LINKS,
} from 'src/app/_common/header-elements'
import { ChainId } from 'sushi'

export const headerElements: NavigationElement[] = [
export const headerElements = (chainId?: ChainId): NavigationElement[] => [
{
title: 'Explore',
items: EXPLORE_NAVIGATION_LINKS,
items: EXPLORE_NAVIGATION_LINKS(chainId),
show: 'mobile',
type: NavigationElementType.Dropdown,
},
Expand All @@ -38,7 +26,7 @@ export const headerElements: NavigationElement[] = [
},
{
title: 'Pools',
href: '/explore/pool',
href: `/${chainId ?? 1}/explore/pools`,
show: 'desktop',
type: NavigationElementType.Single,
},
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/app/(evm)/bonds/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ 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 (
<Navigation
leftElements={headerElements}
leftElements={headerElements(chainId)}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/app/(evm)/claims/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ 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 (
<Navigation
leftElements={headerElements}
leftElements={headerElements(chainId)}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/app/(evm)/stake/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ 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 (
<Navigation
leftElements={headerElements}
leftElements={headerElements(chainId)}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/app/(evm)/swap/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ export const Header: FC = () => {
const chainId = useChainId()
return (
<Navigation
leftElements={headerElements}
leftElements={headerElements(chainId)}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
chainId={chainId}
/>
)
}
61 changes: 58 additions & 3 deletions apps/web/src/app/_common/header-elements.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import type { NavigationElementDropdown } from '@sushiswap/ui'
import {
type NavigationElement,
type NavigationElementDropdown,
NavigationElementType,
} from '@sushiswap/ui'
import { ChainId } from 'sushi'

export const EXPLORE_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [
export const EXPLORE_NAVIGATION_LINKS = (
chainId?: ChainId,
): NavigationElementDropdown['items'] => [
{
title: 'Swap',
href: '/swap',
description: 'The easiest way to trade.',
},
{
title: 'Pools',
href: '/explore/pools',
href: `/${chainId ?? 1}/explore/pools`,
description: 'Earn fees by providing liquidity.',
},
{
Expand Down Expand Up @@ -43,3 +50,51 @@ export const EXPLORE_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [
description: 'Get your token on our default token list.',
},
]

export const MORE_NAVIGATION_LINKS: NavigationElementDropdown['items'] = [
{
title: 'Pay',
href: 'https://pay.sushi.com',
description:
'Stream or create a vesting schedule with any ERC20 to any wallet.',
},
{
title: 'Bonds',
href: 'https://sushi.com/bonds',
description:
'Buy discounted tokens with vesting to support projects in a sustainable manner.',
},
]

export const headerElements = (chainId?: ChainId): NavigationElement[] => [
{
title: 'Explore',
items: EXPLORE_NAVIGATION_LINKS(chainId),
show: 'mobile',
type: NavigationElementType.Dropdown,
},
{
title: 'Swap',
href: '/swap',
show: 'desktop',
type: NavigationElementType.Single,
},
{
title: 'Pools',
href: `/${chainId ?? 1}/explore/pools`,
show: 'desktop',
type: NavigationElementType.Single,
},
{
title: 'Stake',
href: '/stake',
show: 'desktop',
type: NavigationElementType.Single,
},
{
title: 'More',
items: MORE_NAVIGATION_LINKS,
show: 'desktop',
type: NavigationElementType.Dropdown,
},
]
4 changes: 2 additions & 2 deletions apps/web/src/app/partner/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Navigation } from '@sushiswap/ui'
import { Metadata } from 'next'
import { headerElements } from '../(evm)/_common/header-elements'
import { headerElements } from '../_common/header-elements'

export const metadata: Metadata = {
title: 'Partner',
Expand All @@ -9,7 +9,7 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<Navigation leftElements={headerElements} />
<Navigation leftElements={headerElements()} />
<div className="flex flex-col flex-1">{children}</div>
</>
)
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/privacy-policy/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Navigation } from '@sushiswap/ui'
import { Metadata } from 'next'
import { headerElements } from '../(evm)/_common/header-elements'
import { headerElements } from '../_common/header-elements'

export const metadata: Metadata = {
title: 'Privacy Policy',
Expand All @@ -9,7 +9,7 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<Navigation leftElements={headerElements} />
<Navigation leftElements={headerElements()} />
<div className="flex flex-col flex-1">{children}</div>
</>
)
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/app/terms-of-service/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Navigation } from '@sushiswap/ui'
import { Metadata } from 'next'
import { headerElements } from '../(evm)/_common/header-elements'
import { headerElements } from '../_common/header-elements'

export const metadata: Metadata = {
title: 'Terms Of Service',
Expand All @@ -9,7 +9,7 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<Navigation leftElements={headerElements} />
<Navigation leftElements={headerElements()} />
<div className="flex flex-col flex-1">{children}</div>
</>
)
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/components/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export type NavigationElement =
interface NavProps extends VariantProps<typeof navigationContainerVariants> {
leftElements: NavigationElement[]
rightElement?: React.ReactNode
chainId?: number
}

const Navigation: React.FC<NavProps> = ({
Expand Down

0 comments on commit 38f2050

Please sign in to comment.