generated from defi-wonderland/web3-react-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.
closes ZKS-103 closes ZKS-114 closes ZKS-116 closes ZKS-117 closes ZKS-113 Description: - Add chain page details HTML structure - Add dashboard chain navigation FYI: Currently using mock data so all chains show data from chain id: 324. Since ecosystemData mock has all available chains, chain page change is shown in route but rendered data is just 324 temporary.
- Loading branch information
Showing
20 changed files
with
326 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { InfoBox, Title } from '~/components'; | ||
import { useData } from '~/hooks'; | ||
|
||
export const ChainInformation = () => { | ||
const { t } = useTranslation(); | ||
const { chainData } = useData(); | ||
|
||
return ( | ||
<article> | ||
<Title title={t('CHAIN.CHAININFORMATION.title')} /> | ||
<div> | ||
<InfoBox title={t('CHAIN.CHAININFORMATION.chainType')} description={chainData?.chainType} /> | ||
<InfoBox title={t('CHAIN.CHAININFORMATION.lastBlock')} description={chainData?.l2ChainInfo.lastBlock} /> | ||
<InfoBox | ||
title={t('CHAIN.CHAININFORMATION.lastBlockVerified')} | ||
description={chainData?.l2ChainInfo.lastBlockVerified} | ||
/> | ||
<InfoBox title={t('CHAIN.CHAININFORMATION.transactionsPerSecond')} description={chainData?.l2ChainInfo.tps} /> | ||
<InfoBox | ||
title={t('CHAIN.CHAININFORMATION.totalBatchesCommitted')} | ||
description={chainData?.batchesInfo.commited} | ||
/> | ||
<InfoBox title={t('CHAIN.CHAININFORMATION.totalBatchesExecuted')} description={chainData?.batchesInfo.proved} /> | ||
<InfoBox | ||
title={t('CHAIN.CHAININFORMATION.totalBatchesVerified')} | ||
description={chainData?.batchesInfo.verified} | ||
/> | ||
<InfoBox | ||
title={t('CHAIN.CHAININFORMATION.averageBlockTime')} | ||
description={chainData?.l2ChainInfo.avgBlockTime} | ||
/> | ||
</div> | ||
</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,19 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { InfoBox, Title } from '~/components'; | ||
import { useData } from '~/hooks'; | ||
|
||
export const FeeParams = () => { | ||
const { t } = useTranslation(); | ||
const { chainData } = useData(); | ||
|
||
return ( | ||
<article> | ||
<Title title={t('CHAIN.FEEPARAMS.title')} /> | ||
<div> | ||
<InfoBox title={t('CHAIN.FEEPARAMS.batch')} description={chainData?.feeParams.batchOverheadL1Gas} /> | ||
<InfoBox title={t('CHAIN.FEEPARAMS.compute')} description={chainData?.feeParams.maxPubdataPerBatch} /> | ||
<InfoBox title={t('CHAIN.FEEPARAMS.maxGasBatch')} description={chainData?.feeParams.maxL2GasPerBatch} /> | ||
</div> | ||
</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,13 @@ | ||
interface InfoBoxProps { | ||
title: string; | ||
description: string | number; | ||
} | ||
|
||
export const InfoBox = ({ title, description }: InfoBoxProps) => { | ||
return ( | ||
<div> | ||
<p>{title}</p> | ||
<p>{description}</p> | ||
</div> | ||
); | ||
}; |
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,22 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { InfoBox, Title } from '~/components'; | ||
import { useData } from '~/hooks'; | ||
|
||
export const TVL = () => { | ||
const { t } = useTranslation(); | ||
const { chainData } = useData(); | ||
|
||
return ( | ||
<article> | ||
<Title title={t('CHAIN.RPC.title')} /> | ||
<div> | ||
{chainData?.metadata?.publicRpcs && | ||
chainData.metadata.publicRpcs.map((rpc, index) => ( | ||
<div key={index}> | ||
<InfoBox title={t('CHAIN.RPC.status')} description={rpc.url} /> | ||
</div> | ||
))} | ||
</div> | ||
</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,20 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { InfoBox, Title } from '~/components'; | ||
import { useData } from '~/hooks'; | ||
|
||
export const RPC = () => { | ||
const { t } = useTranslation(); | ||
const { chainData } = useData(); | ||
|
||
return ( | ||
<article> | ||
<Title title={t('CHAIN.TVL.title')} /> | ||
<div> | ||
{chainData?.tvl && | ||
Object.entries(chainData.tvl).map(([token, value]) => ( | ||
<InfoBox key={token} title={token} description={value.toString()} /> | ||
))} | ||
</div> | ||
</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
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,12 @@ | ||
import { ChainInformation, FeeParams, RPC, TVL } from '~/components'; | ||
|
||
export const ChainDescription = () => { | ||
return ( | ||
<section> | ||
<ChainInformation /> | ||
<TVL /> | ||
<RPC /> | ||
<FeeParams /> | ||
</section> | ||
); | ||
}; |
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,49 @@ | ||
import { useTranslation } from 'next-i18next'; | ||
import { useRouter } from 'next/router'; | ||
import { InfoBox } from '~/components'; | ||
import { useData } from '~/hooks'; | ||
import { formatTimestampToDate } from '~/utils'; | ||
|
||
export const ChainMetadata = () => { | ||
const { t } = useTranslation(); | ||
const { chainData, ecosystemData } = useData(); | ||
const router = useRouter(); | ||
const data = chainData?.metadata; | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => { | ||
const selectedChainId = event.target.value; | ||
router.push(`/${selectedChainId}`); | ||
}; | ||
|
||
const handleBack = () => { | ||
router.back(); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div> | ||
<div> | ||
{/* <img></img> */} | ||
<select onChange={handleChange} value={data?.chainName || ''}> | ||
{ecosystemData?.chains.map((chain) => ( | ||
<option key={chain.id} value={chain.id}> | ||
{chain.name} | ||
</option> | ||
))} | ||
</select> | ||
<span>{data?.chainId}</span> | ||
</div> | ||
|
||
<button onClick={handleBack}>{t('CHAIN.backButton')}</button> | ||
</div> | ||
|
||
<div> | ||
<InfoBox title={t('CHAIN.website')} description={data?.websiteUrl} /> | ||
<InfoBox title={t('CHAIN.explorer')} description={data?.explorerUrl} /> | ||
<InfoBox title={t('CHAIN.launchDate')} description={formatTimestampToDate(data?.launchDate)} /> | ||
<InfoBox title={t('CHAIN.environment')} description={data?.environment} /> | ||
<InfoBox title={t('CHAIN.nativeToken')} description={data?.nativeToken} /> | ||
</div> | ||
</div> | ||
); | ||
}; |
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,16 @@ | ||
import { InfoBox } from '~/components'; | ||
|
||
interface InfoCardProps { | ||
title: string; | ||
} | ||
|
||
export const InfoCard = ({ title }: InfoCardProps) => { | ||
return ( | ||
<section> | ||
<h2>{title}</h2> | ||
<div> | ||
<InfoBox title='Website' description='https://www.example.com' /> | ||
</div> | ||
</section> | ||
); | ||
}; |
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,11 @@ | ||
import { ChainMetadata } from './ChainMetadata'; | ||
import { ChainDescription } from './ChainDescription'; | ||
|
||
export const ChainDetail = () => { | ||
return ( | ||
<div> | ||
<ChainMetadata /> | ||
<ChainDescription /> | ||
</div> | ||
); | ||
}; |
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
Oops, something went wrong.