Skip to content

Commit a8d1ef4

Browse files
authored
Merge pull request #2177 from oasisprotocol/kaja/uil-dashboard-layout
Convert dashboard layouts to tailwind
2 parents a4cad42 + 58c6216 commit a8d1ef4

9 files changed

Lines changed: 29 additions & 34 deletions

File tree

.changelog/2177.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Convert dashboard layouts to tailwind.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { Separator } from '@oasisprotocol/ui-library/src/components/ui/separator'
2-
import { useScreenSize } from '../../hooks/useScreensize'
32

4-
export const LayoutDivider = () => <Separator className="my-8" />
3+
export const LayoutDivider = () => <Separator className="my-6" />
54
export const DashboardDivider = () => {
6-
const { isMobile } = useScreenSize()
7-
return <Separator className={isMobile ? 'mt-4 mb-8' : 'mb-8'} />
5+
return <Separator className="mb-6 md:mt-0 md:mb-6" />
86
}
97
export const CardDivider = () => <Separator className="my-10" />

src/app/components/Snapshots/Snapshot.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ export const Snapshot: FC<SnapshotProps> = ({ children, header, scope, title })
1616
<div className="grid grid-cols-12 gap-x-4 gap-y-2 px-4 pb-4 sm:px-0 sm:pb-0">
1717
<div className="col-span-12 md:col-span-6 lg:col-span-4">
1818
<AppendMobileSearch scope={scope}>
19-
<div className="flex mb-4 flex-col sm:flex-row sm:items-center gap-1">
19+
<div className="flex md:mb-6 flex-col sm:flex-row sm:items-center gap-1">
2020
<Typography variant="h2">{title}</Typography>
2121
{header}
2222
</div>
2323
</AppendMobileSearch>
2424
</div>
2525
</div>
2626

27-
<div className="grid grid-cols-12 gap-4 w-full pb-8">{children}</div>
27+
<div className="grid grid-cols-12 gap-4 w-full pb-6">{children}</div>
2828
</>
2929
)
3030
}

src/app/pages/ConsensusDashboardPage/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { FC } from 'react'
2-
import Grid from '@mui/material/Grid'
32
import { DashboardDivider } from '../../components/Divider'
43
import { isLocalnet } from '../../utils/route-utils'
54
import { PageLayout } from '../../components/PageLayout'
@@ -28,12 +27,12 @@ export const ConsensusDashboardPage: FC = () => {
2827
{!isLocal && <ConsensusSnapshot scope={scope} />}
2928
<DashboardDivider />
3029
{!isLocal && (
31-
<Grid container spacing={4}>
32-
<Grid item xs={12} lg={6} sx={{ display: 'flex' }}>
30+
<div className="grid grid-cols-12 gap-x-6">
31+
<div className="col-span-12 lg:col-span-6 flex">
3332
<TotalTransactions chartContainerHeight={350} scope={scope} />
34-
</Grid>
33+
</div>
3534
<LatestBlocksGrid scope={scope} />
36-
</Grid>
35+
</div>
3736
)}
3837
{isLocal && <LatestBlocksGrid scope={scope} />}
3938
<ValidatorsCard scope={scope} />
@@ -54,8 +53,8 @@ export const ConsensusDashboardPage: FC = () => {
5453

5554
const LatestBlocksGrid = ({ scope }: { scope: ConsensusScope }) => {
5655
return (
57-
<Grid item xs={12} lg={6} sx={{ display: 'flex' }}>
56+
<div className="col-span-12 lg:col-span-6 flex">
5857
<LatestConsensusBlocks scope={scope} />
59-
</Grid>
58+
</div>
6059
)
6160
}

src/app/pages/ParatimeDashboardPage/LatestRuntimeBlocks.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const LatestRuntimeBlocks: FC<{ scope: RuntimeScope }> = ({ scope }) => {
4545
const { t } = useTranslation()
4646

4747
return (
48-
<Card>
48+
<Card sx={{ width: '100%' }}>
4949
<CardHeader
5050
disableTypography
5151
component="h3"

src/app/pages/ParatimeDashboardPage/index.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { FC } from 'react'
22
import { DashboardDivider } from '../../components/Divider'
3-
import Grid from '@mui/material/Grid'
4-
import { useScreenSize } from '../../hooks/useScreensize'
53
import { isLocalnet } from '../../utils/route-utils'
64
import { Social } from '../../components/Social'
75
import { LearningMaterials } from './LearningMaterials'
@@ -18,7 +16,6 @@ import { LatestRoflApps } from './LatestRoflApps'
1816
import { paraTimesConfig } from '../../../config'
1917

2018
export const ParatimeDashboardPage: FC = () => {
21-
const { isMobile } = useScreenSize()
2219
const scope = useRuntimeScope()
2320
const isLocal = isLocalnet(scope.network)
2421
const { txMethod, setTxMethod } = useRuntimeTxMethodParam()
@@ -28,28 +25,28 @@ export const ParatimeDashboardPage: FC = () => {
2825
{!isLocal && <ParaTimeSnapshot scope={scope} />}
2926
<DashboardDivider />
3027
<LatestRuntimeTransactions scope={scope} txMethod={txMethod} setTxMethod={setTxMethod} />
31-
<Grid container spacing={4}>
32-
<Grid item xs={12} lg={6} sx={{ display: 'flex', order: isMobile ? 1 : 0 }}>
28+
<div className="grid grid-cols-1 lg:grid-cols-2 gap-x-6">
29+
<div className="flex order-1 md:order-0">
3330
<LearningMaterials scope={scope} />
34-
</Grid>
35-
<Grid item xs={12} lg={6}>
31+
</div>
32+
<div className="flex">
3633
<LatestRuntimeBlocks scope={scope} />
37-
</Grid>
38-
<Grid item xs={12}>
34+
</div>
35+
<div className="col-span-1 lg:col-span-2">
3936
<TopTokens scope={scope} />
4037
{paraTimesConfig[scope.layer]?.offerRoflTxTypes && <LatestRoflApps scope={scope} />}
41-
</Grid>
42-
</Grid>
38+
</div>
39+
</div>
4340
{!isLocal && (
4441
<>
45-
<Grid container spacing={4}>
46-
<Grid item xs={12} lg={6}>
42+
<div className="grid grid-cols-12 gap-x-6">
43+
<div className="col-span-12 lg:col-span-6">
4744
<TransactionsStats scope={scope} />
48-
</Grid>
49-
<Grid item xs={12} lg={6}>
45+
</div>
46+
<div className="col-span-12 lg:col-span-6">
5047
<TotalTransactions scope={scope} />
51-
</Grid>
52-
</Grid>
48+
</div>
49+
</div>
5350
<Social />
5451
</>
5552
)}

src/app/pages/TokenDashboardPage/TokenSnapshot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const TokenSnapshot: FC<{ scope: RuntimeScope; address: string }> = ({ sc
2222
</AppendMobileSearch>
2323
</div>
2424
</div>
25-
<div className="grid grid-cols-12 gap-4 w-full pb-8">
25+
<div className="grid grid-cols-12 gap-4 w-full md:pb-6">
2626
<div className="col-span-12 lg:col-span-3">
2727
<TokenTotalTransactionsCard scope={scope} address={address} />
2828
</div>

src/app/pages/ValidatorDetailsPage/ValidatorSnapshot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ValidatorSnapshot: FC<ValidatorSnapshotProps> = ({ scope, validator
2929
</AppendMobileSearch>
3030
</div>
3131
</div>
32-
<div className="grid grid-cols-12 gap-4 w-full pb-8">
32+
<div className="grid grid-cols-12 gap-4 w-full md:pb-6">
3333
<div className="col-span-12 lg:col-span-3">
3434
<EscrowDistributionCard validator={validator} />
3535
</div>

src/styles/theme/defaultTheme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export const defaultTheme = createTheme({
343343
},
344344
},
345345
[theme.breakpoints.up('sm')]: {
346-
marginBottom: theme.spacing(5),
346+
marginBottom: '24px',
347347
padding: theme.spacing(5, 5, 0),
348348
},
349349
}),

0 commit comments

Comments
 (0)