Skip to content

Commit

Permalink
Fixes Proposal Timeline (#1154)
Browse files Browse the repository at this point in the history
  • Loading branch information
devpavan04 authored Apr 28, 2023
1 parent f3d5a5e commit da52489
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
22 changes: 13 additions & 9 deletions apps/stats-dapp/src/containers/ProposalDetail/ProposalDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,19 @@ export const ProposalDetail = () => {
Timeline
</Typography>
<TimeLine className="translate-x-3">
{timeline.map((time, idx) => (
<TimeLineItem
key={`${time.at.toString()}-${idx}`}
title={time.status}
time={time.at}
txHash=""
externalUrl="#"
/>
))}
{timeline.map((time, idx) => {
const status = time.id.split('-')[1];

return (
<TimeLineItem
key={`${time.at.toString()}-${idx}`}
title={status === 'Open' ? 'Added' : status}
time={time.at}
txHash=""
externalUrl="#"
/>
);
})}
</TimeLine>
{/** Detail */}
<Typography variant="h5" fw="bold">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@webb-tools/icons';
import { Typography } from '../../typography';
import { shortenHex } from '../../utils';
import { formatDistanceToNow } from 'date-fns';
import { formatRelative } from 'date-fns';
import { forwardRef } from 'react';
import { twMerge } from 'tailwind-merge';

Expand Down Expand Up @@ -107,8 +107,8 @@ export const TimeLineItem = forwardRef<HTMLDivElement, TimeLineItemProps>(
>
{title}
</Typography>
<Typography variant="utility" className="inline-block uppercase">
{formatDistanceToNow(time, { addSuffix: true })}
<Typography variant="utility" className="inline-block capitalize">
{formatRelative(time, new Date()).replace('at', '-')}
</Typography>
</div>

Expand Down

0 comments on commit da52489

Please sign in to comment.