Skip to content

Commit

Permalink
chore: header now links to swap page
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasc committed Jan 27, 2023
1 parent 2766d42 commit 6473e19
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useConfig } from 'hooks/useConfig';
import Link from 'next/link';
import { useRouter } from 'next/router';
import React, { ComponentProps, useCallback, useMemo, useState } from 'react';
import React, { ComponentProps, useCallback, useMemo } from 'react';
import styles from './Header.module.css';
import paprTitle from 'public/logos/papr-title.png';
import paprMemeTitle from 'public/logos/paprMEME-title.png';
Expand Down Expand Up @@ -33,10 +33,7 @@ type Page = {
isNetworkSpecialCase?: boolean;
externalRedirect?: boolean;
};
const prodPages = (
underlyingAddress: string,
paprTokenAddress: string,
): Page[] => [
const prodPages: Page[] = [
{
name: 'Performance',
route: ``,
Expand All @@ -49,7 +46,7 @@ const prodPages = (
},
{
name: 'Swap ↗',
route: `https://app.uniswap.org/#/swap?chain=goerli&inputCurrency=${underlyingAddress}&outputCurrency=${paprTokenAddress}`,
route: `lp`,
externalRedirect: true,
},

Expand Down Expand Up @@ -87,23 +84,16 @@ type NavLinksProps = {
isHomePage: boolean;
};
function NavLinks({ activeRoute, isHomePage }: NavLinksProps) {
const { tokenName, underlyingAddress, paprTokenAddress } = useConfig();
const { tokenName } = useConfig();
const theme = useTheme();

const pages = useMemo(() => {
const productSpecificPages = tokenName === 'paprHero' ? paprHeroPages : [];
if (process.env.VERCEL_ENV === 'production') {
return [
...productSpecificPages,
...prodPages(underlyingAddress, paprTokenAddress),
];
return [...productSpecificPages, ...prodPages];
}
return [
...productSpecificPages,
...prodPages(underlyingAddress, paprTokenAddress),
...stagingPages,
];
}, [tokenName, underlyingAddress, paprTokenAddress]);
return [...productSpecificPages, ...prodPages, ...stagingPages];
}, [tokenName]);

return (
<ul className={styles.links}>
Expand Down

0 comments on commit 6473e19

Please sign in to comment.