Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix-aptos-links' into data-api
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMasayoshi committed Aug 7, 2024
2 parents ff46a8c + 7227d50 commit 6c6415a
Show file tree
Hide file tree
Showing 22 changed files with 376 additions and 464 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
5 changes: 5 additions & 0 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ const nextConfig = bundleAnalyzer({
permanent: true,
destination: '/pool/:path*',
},
{
source: '/aptos',
permanent: true,
destination: '/aptos/swap',
},
{
source: '/skale/swap',
permanent: true,
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
94 changes: 94 additions & 0 deletions apps/web/src/app/(evm)/_common/header-elements.ts
Original file line number Diff line number Diff line change
@@ -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,
},
]
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 6c6415a

Please sign in to comment.