Files
explore/ui/epochs/EpochsTableItem.tsx

70 lines
2.2 KiB
TypeScript

import React from 'react';
import type { CeloEpochListItem } from 'types/api/epochs';
import { Skeleton } from '@luxfi/ui/skeleton';
import { TableCell, TableRow } from '@luxfi/ui/table';
import EpochEntity from 'ui/shared/entities/epoch/EpochEntity';
import CeloEpochStatus from 'ui/shared/statusTag/CeloEpochStatus';
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
import NativeCoinValue from 'ui/shared/value/NativeCoinValue';
interface Props {
item: CeloEpochListItem;
isLoading?: boolean;
};
const EpochsTableItem = ({ item, isLoading }: Props) => {
return (
<TableRow>
<TableCell verticalAlign="middle">
<div className="flex gap-2">
<EpochEntity number={ String(item.number) } noIcon className="font-bold" isLoading={ isLoading }/>
<Skeleton loading={ isLoading } color="text.secondary" fontWeight={ 500 }><span>{ item.type }</span></Skeleton>
<TimeWithTooltip
timestamp={ item.timestamp }
isLoading={ isLoading }
color="text.secondary"
display="inline-block"
fontWeight="400"
/>
</div>
</TableCell>
<TableCell verticalAlign="middle">
<CeloEpochStatus
isFinalized={ item.is_finalized }
loading={ isLoading }
/>
</TableCell>
<TableCell verticalAlign="middle">
<Skeleton loading={ isLoading }>
{ item.start_block_number } - { item.end_block_number || '' }
</Skeleton>
</TableCell>
<TableCell verticalAlign="middle" isNumeric>
<NativeCoinValue
amount={ item.distribution?.community_transfer?.value }
noSymbol
loading={ isLoading }
/>
</TableCell>
<TableCell verticalAlign="middle" isNumeric>
<NativeCoinValue
amount={ item.distribution?.carbon_offsetting_transfer?.value }
noSymbol
loading={ isLoading }
/>
</TableCell>
<TableCell verticalAlign="middle" isNumeric>
<NativeCoinValue
amount={ item.distribution?.transfers_total?.value }
noSymbol
loading={ isLoading }
/>
</TableCell>
</TableRow>
);
};
export default EpochsTableItem;