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 f012ebf + a375ef1 commit 8239d85
Show file tree
Hide file tree
Showing 29 changed files with 514 additions and 457 deletions.
4 changes: 2 additions & 2 deletions apps/tron/src/app/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ export const Navigation: FC = () => {
<NavigationMenuItem className="hidden lg:block">
<NavigationMenuLink
href="/swap"
className={navigationMenuTriggerStyle()}
className={navigationMenuTriggerStyle}
>
Swap
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem className="hidden lg:block">
<NavigationMenuLink
href="/pool"
className={navigationMenuTriggerStyle()}
className={navigationMenuTriggerStyle}
>
Pool
</NavigationMenuLink>
Expand Down
25 changes: 16 additions & 9 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const bundleAnalyzer = withBundleAnalyzer({
enabled: false && process.env.NODE_ENV !== 'development',
})

const FURO_URL = 'https://furo.sushi.com'
const FURO_URL = 'https://pay.sushi.com'

/** @type {import('next').NextConfig} */
const nextConfig = bundleAnalyzer({
Expand Down Expand Up @@ -63,11 +63,26 @@ const nextConfig = bundleAnalyzer({
permanent: true,
destination: '/pool/:path*',
},
{
source: '/aptos',
permanent: true,
destination: '/aptos/swap',
},
{
source: '/skale/swap',
permanent: true,
destination: '/swap?chainId=2046399126',
},
{
source: '/furo',
permanent: true,
destination: `${FURO_URL}`,
},
{
source: '/furo/:path*',
permanent: true,
destination: `${FURO_URL}/:path*`,
},
]
},
async rewrites() {
Expand All @@ -94,14 +109,6 @@ const nextConfig = bundleAnalyzer({
// ],
// destination: '/pay/:path*',
// },
{
source: '/furo',
destination: `${FURO_URL}/furo`,
},
{
source: '/furo/:path*',
destination: `${FURO_URL}/furo/:path*`,
},
]
},
})
Expand Down
118 changes: 34 additions & 84 deletions apps/web/src/app/(cms)/header.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 (
<NavigationContainer>
<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Explore</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="w-[400px] gap-3 p-4">
{EXPLORE_NAVIGATION_LINKS.map((component) => (
<NavigationListItem
key={component.title}
title={component.title}
href={component.href}
>
{component.description}
</NavigationListItem>
))}
{/* <OnramperButton>
<NavigationListItem title="Buy Crypto">
Need to buy some more crypto?
</NavigationListItem>
</OnramperButton> */}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
{navData.map(({ title, href, links, className }) => {
if (href && !links) {
return (
<NavigationMenuItem key={href} className={className}>
<NavigationMenuLink
href={href}
className={buttonVariants({ variant: 'ghost' })}
>
{title}
</NavigationMenuLink>
</NavigationMenuItem>
)
}

return (
<NavigationMenuItem key={title} className={className}>
<NavigationMenuTrigger>{title}</NavigationMenuTrigger>
<NavigationMenuContent>
<ul className="w-[400px] gap-3 p-4">
{links?.map(({ name, href }) => (
<NavigationListItem
key={`${title}-${name}`}
title={name.split('-')?.[0]}
href={href}
>
{name.split('-')?.[1]}
</NavigationListItem>
))}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
)
})}
</NavigationMenuList>
</NavigationMenu>
</NavigationContainer>
)
return <Navigation leftElements={navData} />
}
2 changes: 2 additions & 0 deletions apps/web/src/app/(evm)/[chainId]/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Navigation
leftElements={headerElements}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
chainId={chainId}
/>
Expand Down
68 changes: 68 additions & 0 deletions apps/web/src/app/(evm)/_common/header-elements.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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.',
},
]

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: '/explore/pool',
show: 'desktop',
type: NavigationElementType.Single,
},
{
title: 'Stake',
href: '/stake',
show: 'desktop',
type: NavigationElementType.Single,
},
{
type: NavigationElementType.Custom,
item: (
<OnramperButton>
<NavigationMenuLink className={navigationMenuTriggerStyle}>
Buy Crypto
</NavigationMenuLink>
</OnramperButton>
),
show: 'desktop',
},
{
title: 'More',
items: MORE_NAVIGATION_LINKS,
show: 'desktop',
type: NavigationElementType.Dropdown,
},
]
2 changes: 2 additions & 0 deletions apps/web/src/app/(evm)/bonds/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Navigation
leftElements={headerElements}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/app/(evm)/claims/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Navigation
leftElements={headerElements}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/app/(evm)/stake/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Navigation
leftElements={headerElements}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
/>
)
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/app/(evm)/swap/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Navigation
leftElements={headerElements}
rightElement={<WagmiHeaderComponents chainIds={SUPPORTED_CHAIN_IDS} />}
chainId={chainId}
/>
Expand Down
Loading

0 comments on commit 8239d85

Please sign in to comment.