Skip to content

Commit

Permalink
feat: chain page navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiti committed Jul 22, 2024
1 parent 7e85a23 commit ac9389a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
1 change: 1 addition & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"status": "Status"
},
"FEEPARAMS": {
"title": "Fee params",
"batch": "Batch Overhead L1 Gas",
"compute": "Compute Overhead Part",
"maxGasBatch": "Max Gas per Batch"
Expand Down
1 change: 1 addition & 0 deletions public/locales/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"status": "Estado"
},
"FEEPARAMS": {
"title": "Parámetros de gas",
"batch": "Sobrecarga de lote L1 Gas",
"compute": "Parte de sobrecarga de cómputo",
"maxGasBatch": "Máximo gas por lote"
Expand Down
25 changes: 21 additions & 4 deletions src/containers/ChainDetail/ChainDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
import { useTranslation } from 'next-i18next';
import { useRouter } from 'next/router';
import { InfoBox } from '~/components';
import { useData } from '~/hooks';

export const ChainDescription = () => {
const { t } = useTranslation();
const { chainData } = useData();
const { chainData, ecosystemData } = useData();
const router = useRouter();

const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
const selectedChainId = event.target.value;
router.push(`/${selectedChainId}`);
};

const handleBack = () => {
router.back();
};

return (
<div>
<div>
<div>
{/* <img></img> */}
<button>{chainData?.name}</button>
<span></span>
<select onChange={handleChange} value={chainData?.chainId || ''}>
{ecosystemData?.chains.map((chain) => (
<option key={chain.id} value={chain.id}>
{chain.name}
</option>
))}
</select>
<span>{chainData?.chainId}</span>
</div>

<button>{t('CHAIN.backButton')}</button>
<button onClick={handleBack}>{t('CHAIN.backButton')}</button>
</div>

<div>
Expand Down
14 changes: 13 additions & 1 deletion src/containers/ChainDetail/ChainInformation.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import { useTranslation } from 'next-i18next';
import { InfoCard } from './InfoCard';

export const ChainInformation = () => {
return <div>ChainInformation</div>;
const { t } = useTranslation();

return (
<section>
<InfoCard title={t('CHAIN.CHAININFORMATION.title')} />
<InfoCard title={t('CHAIN.ZKCHAINTVL.title')} />
<InfoCard title={t('CHAIN.RPC.title')} />
<InfoCard title={t('CHAIN.FEEPARAMS.title')} />
</section>
);
};
16 changes: 16 additions & 0 deletions src/containers/ChainDetail/InfoCard.tsx
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>
);
};
5 changes: 4 additions & 1 deletion src/containers/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { styled } from '@mui/material/styles';
import { IconButton } from '@mui/material';
import LightModeIcon from '@mui/icons-material/LightMode';
import DarkModeIcon from '@mui/icons-material/DarkMode';
import Link from 'next/link';

import { useCustomTheme } from '~/hooks/useContext/useTheme';
import { zIndex, HEADER_HEIGHT } from '~/utils';
Expand All @@ -12,7 +13,9 @@ export const Header = () => {

return (
<StyledHeader>
<Logo>Logo</Logo>
<Link href='/' passHref>
<Logo>Logo</Logo>
</Link>
<SIconButton onClick={changeTheme}>{theme === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}</SIconButton>
<ConnectButton />
</StyledHeader>
Expand Down

0 comments on commit ac9389a

Please sign in to comment.