Skip to content

Commit

Permalink
fix: tables on mobile
Browse files Browse the repository at this point in the history
- proper scaling of tables on mobile
  • Loading branch information
Xeonus committed Aug 13, 2024
1 parent 202470e commit 368e980
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/components/Tables/AuraPoolLeaderboardTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export default function AuraPoolLeaderboardTable({ leaderboardInfo }:
{row.id}
</StyledTableCell>
<StyledTableCell
sx={{ display: { xs: 'none', md: 'table-cell' } }}
sx={{ display: { xs: 'table-cell', md: 'table-cell' } }}
>
<Box display="flex" alignItems="center" alignContent="center">
<Box mr={1}>
Expand All @@ -313,13 +313,13 @@ export default function AuraPoolLeaderboardTable({ leaderboardInfo }:
</StyledTableCell>
<StyledTableCell
align="right"
sx={{ display: { xs: 'none', md: 'table-cell' } }}
sx={{ display: { xs: 'table-cell', md: 'table-cell' } }}
>
{formatAmount(row.amount, 2) + ' auraBAL'}
</StyledTableCell>
<StyledTableCell
align="right"
sx={{ display: { xs: 'none', md: 'table-cell' } }}
sx={{ display: { xs: 'table-cell', md: 'table-cell' } }}
>
{formatAmount(row.fraction, 2) + ' %'}
</StyledTableCell>
Expand Down
16 changes: 8 additions & 8 deletions src/components/Tables/LockerTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,21 @@ const headCells: readonly HeadCell[] = [
numeric: false,
disablePadding: false,
label: 'Value ($)',
isMobileVisible: false,
isMobileVisible: true,
},
{
id: 'poolShare',
numeric: false,
disablePadding: false,
label: 'Relative Share (%)',
isMobileVisible: false,
isMobileVisible: true,
},
{
id: 'nrOfLocks',
numeric: false,
disablePadding: false,
label: '# Locks',
isMobileVisible: false
isMobileVisible: true
}
];

Expand Down Expand Up @@ -314,7 +314,7 @@ export default function LockerTable({
{row.id}
</StyledTableCell>
<StyledTableCell
sx={{display: {xs: 'none', md: 'table-cell'}}}
sx={{display: {xs: 'table-cell', md: 'table-cell'}}}
>
<Box display="flex" alignItems="center" alignContent="center">
<Box mr={1}>
Expand All @@ -336,7 +336,7 @@ export default function LockerTable({
component="th"
id={labelId}
scope="row"
sx={{display: {xs: 'none', md: 'table-cell'}}}
sx={{display: {xs: 'table-cell', md: 'table-cell'}}}
>
<Box display="flex" alignItems="center">
<Box mr={1}>
Expand All @@ -349,7 +349,7 @@ export default function LockerTable({
component="th"
id={labelId}
scope="row"
sx={{display: {xs: 'none', md: 'table-cell'}}}>
sx={{display: {xs: 'table-cell', md: 'table-cell'}}}>
<Box display="flex" alignItems="center">
<Box mr={1}>
{formatDollarAmount(row.lockedUSD)}
Expand All @@ -360,7 +360,7 @@ export default function LockerTable({
component="th"
id={labelId}
scope="row"
sx={{display: {xs: 'none', md: 'table-cell'}}}>
sx={{display: {xs: 'table-cell', md: 'table-cell'}}}>
<Box display="flex" alignItems="center">
<Box mr={1}>
{row.poolShare.toFixed(2)}%
Expand All @@ -371,7 +371,7 @@ export default function LockerTable({
component="th"
id={labelId}
scope="row"
sx={{display: {xs: 'none', md: 'table-cell'}}}>
sx={{display: {xs: 'table-cell', md: 'table-cell'}}}>
<Box display="flex" alignItems="center">
<Box mr={1}>
{row.nrOfLocks}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/AuraBAL/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import AuraBALMultiAreaChart from "../../components/Echarts/auraBAL/AuraBALMulti
import {ArbitrumNetworkInfo, EthereumNetworkInfo, PolygonNetworkInfo} from "../../constants/networks";
import React from "react";
import useGetSimpleTokenPrices from "../../data/balancer-api-v3/useGetSimpleTokenPrices";
import {isMobile} from "react-device-detect";


export default function AuraBAL() {
Expand Down Expand Up @@ -402,8 +403,12 @@ export default function AuraBAL() {
<Box p={1} display="flex" alignItems='center'>

</Box>
<Box sx={{
width: isMobile ? '430px' : 'auto',
maxWidth: '100%'
}}>
<AuraPoolLeaderboardTable leaderboardInfo={activeNetwork === EthereumNetworkInfo ? auraBalPoolLeaderboard : auraBalVaultLeaderboard}/>

</Box>
</Grid>
</Grid>
<Grid
Expand Down
6 changes: 6 additions & 0 deletions src/pages/AuraLocks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import CustomLinearProgress from "../../components/Progress/CustomLinearProgress
import AuraDailyUnlocksChart from "../../components/Echarts/AuraDailyUnlocksChart";
import {useAuraGlobalStats} from "../../data/aura/useAuraGlobalStats";
import useGetSimpleTokenPrices from "../../data/balancer-api-v3/useGetSimpleTokenPrices";
import {isMobile} from "react-device-detect";


const auraAddress = '0xc0c293ce456ff0ed870add98a0828dd4d2903dbf';
Expand Down Expand Up @@ -346,6 +347,10 @@ export default function AuraLocks() {
</Box>
</Grid>
</Grid>
<Box sx={{
width: isMobile ? '430px' : 'auto',
maxWidth: '100%'
}}>
<LockerTable lockerAccounts={lockers}
auraUSD={coinData?.data[auraAddress].price}
totalAmountLocked={totalLockedAmount}
Expand All @@ -354,6 +359,7 @@ export default function AuraLocks() {
rowsPerPage={rowsPerPage}
setRowsPerPage={setRowsPerPage}
/>
</Box>
</Grid>
</Grid>
</Box>) :
Expand Down

0 comments on commit 368e980

Please sign in to comment.