generated from defi-wonderland/web3-nextjs-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feat/mobile-table
- Loading branch information
Showing
17 changed files
with
205 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Box } from '@mui/material'; | ||
import { Skeleton } from '@mui/material'; | ||
|
||
export const SkeletonTokens = () => { | ||
return ( | ||
<Box width='100%'> | ||
{/* Breadcrumb Skeleton */} | ||
<Skeleton variant='text' width='20%' height={40} sx={{ marginBottom: 2, borderRadius: 4 }} /> | ||
|
||
{/* Title Skeleton */} | ||
<Skeleton variant='text' width='40%' height={80} sx={{ marginBottom: 4, borderRadius: 4 }} /> | ||
|
||
{/* Main Container Skeleton for Locked Assets */} | ||
<Skeleton variant='rectangular' width='100%' height={500} sx={{ borderRadius: 4, marginBottom: 12 }} /> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { Table, Typography } from '@mui/material'; | ||
|
||
import { TotalValueLockedProps } from '~/types'; | ||
import { | ||
STableContainer, | ||
STableHead, | ||
STableRow, | ||
STableCellHead, | ||
STableCell, | ||
STableBody, | ||
LogoCell, | ||
TokenAvatar, | ||
STitle, | ||
} from '~/components'; | ||
|
||
export const TokensTable = ({ tvl }: TotalValueLockedProps) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<article> | ||
<STitle>{t('TOKENS.title')}</STitle> | ||
<STableContainer> | ||
<Table> | ||
<STableHead> | ||
<STableRow> | ||
<STableCellHead>{t('CHAIN.TVL.chain')}</STableCellHead> | ||
<STableCellHead>{t('CHAIN.TVL.price')}</STableCellHead> | ||
<STableCellHead>{t('CHAIN.TVL.tvl')}</STableCellHead> | ||
</STableRow> | ||
</STableHead> | ||
|
||
<STableBody> | ||
{tvl.map((token, index) => ( | ||
<STableRow key={index}> | ||
<LogoCell> | ||
<TokenAvatar alt={token.tokenName} src={token.imageUrl} /> | ||
<Typography> | ||
{token.tokenName} ({token.token}) | ||
</Typography> | ||
</LogoCell> | ||
|
||
<STableCell>${token.price.toLocaleString()}</STableCell> | ||
|
||
<STableCell>${((token.total * token.price) / 1e18).toLocaleString()}</STableCell> | ||
</STableRow> | ||
))} | ||
</STableBody> | ||
</Table> | ||
</STableContainer> | ||
</article> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { styled } from '@mui/material'; | ||
|
||
import { useData } from '~/hooks'; | ||
import { Breadcrumb } from '~/components'; | ||
import { TokensTable } from './TokensTable'; | ||
import { SkeletonTokens } from './SkeletonTokens'; | ||
|
||
export const Tokens = () => { | ||
const { ecosystemData, isEcosystemLoading } = useData(); | ||
const tvl = ecosystemData?.l1Tvl || []; | ||
return ( | ||
<TokensContainer> | ||
{isEcosystemLoading && <SkeletonTokens />} | ||
{!isEcosystemLoading && ( | ||
<> | ||
<Breadcrumb isChain={false} /> | ||
<TokensTable tvl={tvl} /> | ||
</> | ||
)} | ||
</TokensContainer> | ||
); | ||
}; | ||
|
||
const TokensContainer = styled('main')(({ theme }) => ({ | ||
padding: '0 7rem', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
width: '100%', | ||
gap: '4rem', | ||
marginTop: '4rem', | ||
marginBottom: '4rem', | ||
[theme.breakpoints.down('sm')]: { | ||
padding: '0 1rem', | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; | ||
import { GetStaticProps } from 'next'; | ||
import { useTranslation } from 'next-i18next'; | ||
|
||
import { CustomHead } from '~/components'; | ||
import { Tokens } from '~/containers'; | ||
import { getConfig } from '~/config'; | ||
|
||
const { DEFAULT_LANG, SUPPORTED_LANGUAGES } = getConfig(); | ||
|
||
const TokensPage = () => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<CustomHead title={t('HOME.search')} /> | ||
<Tokens /> | ||
</> | ||
); | ||
}; | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale }) => { | ||
const i18Config = await serverSideTranslations(locale || DEFAULT_LANG, ['common'], null, SUPPORTED_LANGUAGES); | ||
|
||
return { | ||
props: { | ||
...i18Config, | ||
}, | ||
}; | ||
}; | ||
|
||
export default TokensPage; |
Oops, something went wrong.