Skip to content

Commit

Permalink
Prepare the TokenGasUsed card
Browse files Browse the repository at this point in the history
(But disable it for now, since we are lacking the required information)
  • Loading branch information
csillag committed Jun 30, 2023
1 parent 6287ffe commit ddcbbcc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/app/pages/TokenDashboardPage/TokenGasUsedCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import { SnapshotCard } from '../../components/Snapshots/SnapshotCard'
import { COLORS } from '../../../styles/theme/colors'
import { useRequiredScopeParam } from '../../hooks/useScopeParam'
import { useLoaderData } from 'react-router-dom'
import { useAccount } from '../AccountDetailsPage/hook'

export const TokenGasUsedCard: FC = () => {
const { t } = useTranslation()
const scope = useRequiredScopeParam()

const address = useLoaderData() as string

const { account, isFetched } = useAccount(scope, address)

console.log('Account', account)

return (
<SnapshotCard title={t('common.gasUsed')} withConstantHeight>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%' }}>
{isFetched && (
<>
<Typography
component="span"
sx={{
fontSize: '48px',
fontWeight: 700,
color: COLORS.brandDark,
}}
>
{
// TODO: return "gas used" here, when it becomes available
account?.stats.num_txns
}
</Typography>
</>
)}
</Box>
</SnapshotCard>
)
}
1 change: 1 addition & 0 deletions src/app/pages/TokenDashboardPage/TokenSnapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const TokenSnapshot: FC = () => {
</StyledGrid>
<StyledGrid item xs={22} md={6}>
<TokenTypeCard />
{/*<TokenGasUsedCard /> TODO: use this when gas used becomes available */}
</StyledGrid>
</Grid>
</>
Expand Down

0 comments on commit ddcbbcc

Please sign in to comment.