From d92df9ada3256e5db9e90b3e9675d462806264ca Mon Sep 17 00:00:00 2001 From: Gala Date: Wed, 3 Aug 2022 12:24:21 +0200 Subject: [PATCH] fixing dark mode colours --- .../balance/components/vesting-timeline.tsx | 24 +++++++++++--- nym-wallet/src/pages/balance/vesting.tsx | 32 ++++++++++++++++--- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/nym-wallet/src/pages/balance/components/vesting-timeline.tsx b/nym-wallet/src/pages/balance/components/vesting-timeline.tsx index 47fea9e9b1..dd8d4e7d8c 100644 --- a/nym-wallet/src/pages/balance/components/vesting-timeline.tsx +++ b/nym-wallet/src/pages/balance/components/vesting-timeline.tsx @@ -1,5 +1,6 @@ /* eslint-disable react/no-array-index-key */ import React, { useContext } from 'react'; +import { useTheme } from '@mui/material/styles'; import { Box, Tooltip, Typography } from '@mui/material'; import { format } from 'date-fns'; import { AppContext } from '../../../context/main'; @@ -21,6 +22,9 @@ export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ perc userBalance: { currentVestingPeriod, vestingAccountInfo }, } = useContext(AppContext); + const theme = useTheme(); + const { mode } = theme.palette; + const nextPeriod = typeof currentVestingPeriod === 'object' && !!vestingAccountInfo?.periods ? Number(vestingAccountInfo?.periods[currentVestingPeriod.In + 1]?.start_time) @@ -29,19 +33,31 @@ export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ perc return ( - - + + {vestingAccountInfo?.periods.map((period, i, arr) => ( = calculateMarkerPosition(arr.length, i) ? '#121726' : '#B9B9B9'} + color={ + +percentageComplete.toFixed(2) >= calculateMarkerPosition(arr.length, i) + ? mode === 'light' + ? 'text.dark' + : theme.palette.success.main + : '#B9B9B9' + } tooltipText={format(new Date(Number(period.start_time) * 1000), 'HH:mm do MMM yyyy')} key={i} /> ))} diff --git a/nym-wallet/src/pages/balance/vesting.tsx b/nym-wallet/src/pages/balance/vesting.tsx index 2ff85cf4bf..a3a52a44b1 100644 --- a/nym-wallet/src/pages/balance/vesting.tsx +++ b/nym-wallet/src/pages/balance/vesting.tsx @@ -65,20 +65,44 @@ const VestingSchedule = () => { ))} - + (t.palette.mode === 'light' ? t.palette.nym.text.muted : 'text.primary'), + borderBottom: 'none', + textTransform: 'uppercase', + }} + > {userBalance.tokenAllocation?.vesting || 'n/a'} / {userBalance.originalVesting?.amount.amount}{' '} {clientDetails?.display_mix_denom.toUpperCase()} - + (t.palette.mode === 'light' ? t.palette.nym.text.muted : 'text.primary'), + borderBottom: 'none', + }} + > {vestingPeriod(userBalance.currentVestingPeriod, userBalance.originalVesting?.number_of_periods)} - + (t.palette.mode === 'light' ? t.palette.nym.text.muted : 'text.primary'), + borderBottom: 'none', + }} + > {`${vestedPercentage}%`} - + (t.palette.mode === 'light' ? t.palette.nym.text.muted : 'text.primary'), + borderBottom: 'none', + textTransform: 'uppercase', + }} + align="right" + > {userBalance.tokenAllocation?.vested || 'n/a'} / {userBalance.originalVesting?.amount.amount}{' '} {clientDetails?.display_mix_denom.toUpperCase()}