diff --git a/nym-wallet/src/pages/balance/components/vesting-timeline.tsx b/nym-wallet/src/pages/balance/components/vesting-timeline.tsx index b477472354..0b5b2cb3c0 100644 --- a/nym-wallet/src/pages/balance/components/vesting-timeline.tsx +++ b/nym-wallet/src/pages/balance/components/vesting-timeline.tsx @@ -3,7 +3,7 @@ import { Box, Tooltip, Typography } from '@mui/material' import { format } from 'date-fns' import { ClientContext } from '../../../context/main' -const calculateNubPosition = (arrLength: number, index: number) => (1 / arrLength) * 100 * (index + 1) +const calculateMarkerPosition = (arrLength: number, index: number) => (1 / arrLength) * 100 * index export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ percentageComplete }) => { const { @@ -12,7 +12,7 @@ export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ perc const nextPeriod = typeof currentVestingPeriod === 'object' && !!vestingAccountInfo?.periods - ? Number(vestingAccountInfo?.periods[currentVestingPeriod.In]?.start_time) + ? Number(vestingAccountInfo?.periods[currentVestingPeriod.In + 1]?.start_time) : undefined return ( @@ -20,19 +20,19 @@ export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ perc - {vestingAccountInfo?.periods.map((period, i, arr) => ( - - = calculateNubPosition(arr.length, i) ? '#121726' : '#B9B9B9'} - style={{ cursor: 'pointer' }} - /> - + = calculateMarkerPosition(arr.length, i) ? '#121726' : '#B9B9B9'} + tooltipText={format(new Date(Number(period.start_time) * 1000), 'HH:mm do MMM yyyy')} + key={i} + /> ))} + {nextPeriod && ( @@ -42,3 +42,13 @@ export const VestingTimeline: React.FC<{ percentageComplete: number }> = ({ perc ) } + +const Marker: React.FC<{ tooltipText: string; color: string; position: string }> = ({ + tooltipText, + color, + position, +}) => ( + + + +)