Skip to content

Commit 16d7b16

Browse files
committed
Update Boxes on Consensus pages
1 parent 0e0bd60 commit 16d7b16

6 files changed

Lines changed: 35 additions & 92 deletions

File tree

src/app/components/ConsensusEvents/ConsensusEventsList.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
3-
import Box from '@mui/material/Box'
43
import { ConsensusScope } from '../../../types/searchScope'
54
import { ConsensusEvent } from '../../../oasis-nexus/api'
65
import { TablePagination, TablePaginationProps } from '../Table/TablePagination'
@@ -55,9 +54,9 @@ export const ConsensusEventsList: FC<{
5554
</div>
5655
))}
5756
{pagination && (
58-
<Box sx={{ display: 'flex', justifyContent: 'center' }}>
57+
<div className="flex justify-center">
5958
<TablePagination {...pagination} />
60-
</Box>
59+
</div>
6160
)}
6261
</>
6362
)

src/app/pages/ConsensusAccountDetailsPage/BalanceDistribution.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { FC } from 'react'
22
import { useTranslation } from 'react-i18next'
3-
import Box from '@mui/material/Box'
43
import Card from '@mui/material/Card'
54
import CardContent from '@mui/material/CardContent'
65
import { Skeleton } from '@oasisprotocol/ui-library/src/components/ui/skeleton'
@@ -74,7 +73,7 @@ const BalanceDistributionContent: FC<BalanceDistributionContentProps> = ({ accou
7473
value: totalValue,
7574
})}
7675
</Typography>
77-
<Box sx={{ height: isMobile ? '100px' : '250px' }}>
76+
<div className="h-[100px] md:h-[250px]">
7877
<PieChart
7978
compact={isMobile}
8079
data={data}
@@ -88,7 +87,7 @@ const BalanceDistributionContent: FC<BalanceDistributionContentProps> = ({ accou
8887
label: (label: string) => label,
8988
}}
9089
/>
91-
</Box>
90+
</div>
9291
</>
9392
)
9493
}

src/app/pages/ConsensusAccountDetailsPage/ConsensusAccountTransactionsCard.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { ConsensusAccountDetailsContext } from './hooks'
77
import { LinkableCardLayout } from 'app/components/LinkableCardLayout'
88
import { useScreenSize } from '../../hooks/useScreensize'
99
import { ConsensusTransactionMethodFilter } from '../../components/Transactions/ConsensusTransactionMethodFilter'
10-
import Box from '@mui/material/Box'
1110
import { transactionsContainerId } from '../../utils/tabAnchors'
1211

1312
export const ConsensusAccountTransactionsCard: FC<ConsensusAccountDetailsContext> = context => {
@@ -18,14 +17,9 @@ export const ConsensusAccountTransactionsCard: FC<ConsensusAccountDetailsContext
1817
<LinkableCardLayout
1918
containerId={transactionsContainerId}
2019
title={
21-
<Box
22-
sx={{
23-
display: 'flex',
24-
justifyContent: 'end',
25-
}}
26-
>
20+
<div className="flex justify-end">
2721
{!isMobile && <ConsensusTransactionMethodFilter value={txMethod} setValue={setTxMethod} />}
28-
</Box>
22+
</div>
2923
}
3024
>
3125
{isMobile && <ConsensusTransactionMethodFilter value={txMethod} setValue={setTxMethod} expand />}

src/app/pages/ConsensusBlockDetailPage/ConsensusBlockTransactionsCard.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
getConsensusTransactionMethodFilteringParam,
1515
ConsensusTxMethodFilterOption,
1616
} from '../../components/ConsensusTransactionMethod'
17-
import Box from '@mui/material/Box'
1817
import { transactionsContainerId } from '../../utils/tabAnchors'
1918

2019
const TransactionList: FC<{
@@ -66,14 +65,9 @@ export const ConsensusBlockTransactionsCard: FC<ConsensusBlockDetailsContext> =
6665
<LinkableCardLayout
6766
containerId={transactionsContainerId}
6867
title={
69-
<Box
70-
sx={{
71-
display: 'flex',
72-
justifyContent: 'end',
73-
}}
74-
>
68+
<div className="flex justify-end">
7569
{!isMobile && <ConsensusTransactionMethodFilter value={txMethod} setValue={setTxMethod} />}
76-
</Box>
70+
</div>
7771
}
7872
>
7973
{isMobile && <ConsensusTransactionMethodFilter value={txMethod} setValue={setTxMethod} expand />}

src/app/pages/ConsensusDashboardPage/RuntimePreview.tsx

Lines changed: 19 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { FC, ReactNode, useState } from 'react'
22
import { Link as RouterLink } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
4-
import Box from '@mui/material/Box'
54
import { Button } from '@oasisprotocol/ui-library/src/components/ui/button'
65
import Link from '@mui/material/Link'
76
import Typography from '@mui/material/Typography'
@@ -38,18 +37,6 @@ const StyledList = styled(InlineDescriptionList)(({ theme }) => ({
3837
},
3938
}))
4039

41-
const StyledBox = styled(Box)(() => ({
42-
border: `2px solid ${COLORS.brandDark}`,
43-
borderRadius: '12px',
44-
height: '180px',
45-
display: 'flex',
46-
flex: 1,
47-
justifyContent: 'center',
48-
alignItems: 'center',
49-
boxShadow: '0px 34px 24px -9px #324DAB1F',
50-
overflow: 'hidden',
51-
}))
52-
5340
const StyledTypography = styled(Typography)(() => ({
5441
fontSize: '18px',
5542
fontWeight: 700,
@@ -60,33 +47,6 @@ const StyledTypography = styled(Typography)(() => ({
6047
alignItems: 'center',
6148
}))
6249

63-
const StyledDisabledRuntime = styled(Box)(({ theme }) => ({
64-
display: 'flex',
65-
gap: 3,
66-
paddingTop: theme.spacing(3),
67-
flexDirection: 'row',
68-
alignItems: 'center',
69-
[theme.breakpoints.between('md', 'xl')]: {
70-
flexDirection: 'column',
71-
alignItems: 'flex-start',
72-
},
73-
}))
74-
75-
const StyledEnabledRuntime = styled(Box)(({ theme }) => ({
76-
flex: 1,
77-
height: '100%',
78-
paddingTop: theme.spacing(3),
79-
paddingBottom: theme.spacing(3),
80-
[theme.breakpoints.down('lg')]: {
81-
paddingBottom: theme.spacing(5),
82-
borderBottom: `1px solid ${COLORS.grayMediumLight}`,
83-
},
84-
[theme.breakpoints.up('lg')]: {
85-
paddingRight: theme.spacing(4),
86-
borderRight: `1px solid ${COLORS.grayMediumLight}`,
87-
},
88-
}))
89-
9050
type RuntimeProps = {
9151
prominentItem?: boolean
9252
network: Network
@@ -134,12 +94,12 @@ export const DisabledRuntimePreview: FC<DisabledRuntimePreviewProps> = ({ runtim
13494
const runtimeLabel = layerLabels[runtime]
13595

13696
return (
137-
<StyledDisabledRuntime>
97+
<div className="flex gap-2 pt-6 flex-row items-center md:flex-col md:items-start">
13898
<StyledTypography>{runtimeLabel}</StyledTypography>
139-
<Box>
99+
<div>
140100
<Badge variant="info">{t('paratimes.inactive')}</Badge>
141-
</Box>
142-
</StyledDisabledRuntime>
101+
</div>
102+
</div>
143103
)
144104
}
145105

@@ -161,8 +121,8 @@ const RuntimePreview: FC<RuntimePreviewProps> = ({ prominentItem, network, runti
161121
const dashboardLink = RouteUtils.getDashboardRoute({ network, layer: runtime })
162122
const runtimeStatus = status ? (status.outOfDate ? 'outdated' : 'stable') : 'inactive'
163123
return (
164-
<StyledEnabledRuntime>
165-
<Box sx={{ marginBottom: 4 }}>
124+
<div className="flex-1 h-full pb-6 border-b border-gray-200 lg:p-0 lg:pr-4 lg:border-b-0 lg:border-r">
125+
<div className="mb-4">
166126
<StyledTypography>
167127
{status ? (
168128
<>
@@ -175,14 +135,14 @@ const RuntimePreview: FC<RuntimePreviewProps> = ({ prominentItem, network, runti
175135
<>{runtimeLabel}</>
176136
)}
177137
</StyledTypography>
178-
</Box>
138+
</div>
179139
<StyledList>
180140
<dt>{t('common.status')}:</dt>
181141
<dd>
182-
<Box>
142+
<div>
183143
{runtimeStatus === 'stable' && <Badge variant="success">{t('common.online')}</Badge>}
184144
{runtimeStatus === 'outdated' && <Badge variant="error">{t('paratimes.outdated')}</Badge>}
185-
</Box>
145+
</div>
186146
</dd>
187147
<dt>{t('paratimes.blockNumber')}</dt>
188148
<dd>
@@ -201,7 +161,7 @@ const RuntimePreview: FC<RuntimePreviewProps> = ({ prominentItem, network, runti
201161
<dt>{t('paratimes.nodes')} </dt>
202162
<dd>{status?.activeNodes ? t('paratimes.activeNodes', { nodes: status?.activeNodes }) : '-'} </dd>
203163
</StyledList>
204-
<Box sx={{ display: 'flex', gap: 3 }}>
164+
<div className="flex gap-2">
205165
<ChartsContainer status={status}>
206166
{panel === 'transactions' && (
207167
<TransactionsChartCard
@@ -233,9 +193,9 @@ const RuntimePreview: FC<RuntimePreviewProps> = ({ prominentItem, network, runti
233193
/>
234194
</ChartsContainer>
235195
)}
236-
</Box>
196+
</div>
237197
{!prominentItem && (
238-
<Box sx={{ display: 'flex', justifyContent: 'center', paddingTop: 3 }}>
198+
<div className="flex justify-center pt-2">
239199
{status && (
240200
<>
241201
<PanelButton
@@ -252,9 +212,9 @@ const RuntimePreview: FC<RuntimePreviewProps> = ({ prominentItem, network, runti
252212
/>
253213
</>
254214
)}
255-
</Box>
215+
</div>
256216
)}
257-
</StyledEnabledRuntime>
217+
</div>
258218
)
259219
}
260220

@@ -296,16 +256,16 @@ const ChartsContainer: FC<ChartsContainerProps> = ({ children, status }) => {
296256
const { t } = useTranslation()
297257

298258
return (
299-
<StyledBox>
300-
<Box gap={3} sx={{ flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
301-
{status && <Box sx={{ width: '100%' }}>{children}</Box>}
259+
<div className="flex flex-1 items-center justify-center h-[180px] border-1 border-gray-200 rounded-md overflow-hidden">
260+
<div className="flex flex-1 flex-col items-center gap-2">
261+
{status && <div className="w-full">{children}</div>}
302262
{!status && (
303263
<>
304264
<FilterNoneIcon sx={{ color: COLORS.brandDark, fontSize: '33px' }} />
305265
{t('paratimes.noData')}
306266
</>
307267
)}
308-
</Box>
309-
</StyledBox>
268+
</div>
269+
</div>
310270
)
311271
}

src/app/pages/ConsensusDashboardPage/SnapshotStaked.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { FC } from 'react'
22
import { Trans, useTranslation } from 'react-i18next'
3-
import Box from '@mui/material/Box'
4-
import Typography from '@mui/material/Typography'
5-
import { COLORS } from '../../../styles/theme/colors'
63
import { Ticker } from '../../../types/ticker'
74
import { RoundedBalance } from '../../components/RoundedBalance'
85
import { SnapshotTextCard } from '../../components/Snapshots/SnapshotCard'
@@ -22,14 +19,14 @@ export const SnapshotStaked: FC<SnapshotStakedProps> = ({ totalStaked, ticker })
2219
title={t('common.staked')}
2320
label={
2421
percentageValue !== undefined && (
25-
<Box sx={{ display: 'flex', alignItems: 'center', gap: 3 }}>
26-
<Typography sx={{ fontSize: 12, color: COLORS.grayMedium }}>
22+
<div className="flex items-center gap-2">
23+
<span className="text-xs text-gray-400">
2724
<Trans
2825
t={t}
2926
i18nKey="consensusSnapshot.totalCirculation"
3027
components={{
3128
StakedPercentage: (
32-
<Typography component="span" sx={{ fontSize: '24px', color: COLORS.grayExtraDark }}>
29+
<span className="text-2xl text-gray-800">
3330
{t('common.valuePair', {
3431
value: percentageValue,
3532
formatParams: {
@@ -39,20 +36,20 @@ export const SnapshotStaked: FC<SnapshotStakedProps> = ({ totalStaked, ticker })
3936
} satisfies Intl.NumberFormatOptions,
4037
},
4138
})}
42-
</Typography>
39+
</span>
4340
),
4441
}}
4542
/>
46-
</Typography>
47-
</Box>
43+
</span>
44+
</div>
4845
)
4946
}
5047
alignWithCardsWithActions
5148
>
5249
{totalStaked && (
53-
<Box sx={{ wordBreak: 'break-all', lineHeight: 1 }}>
50+
<div className="break-all leading-none">
5451
<RoundedBalance value={totalStaked} ticker={ticker} compactLargeNumbers />
55-
</Box>
52+
</div>
5653
)}
5754
</SnapshotTextCard>
5855
)

0 commit comments

Comments
 (0)