mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
* cookie for storing time format value * rename TimeAgo component * add toggle to tables (pt. 1) * move TimeWithTooltip component * add toggle to tables (pt. 2) * change implementation of toggle component * remove unnecessary timestamp label * update screenshots * more screenshot updates * [skip ci] update clock icon * update screenshots
83 lines
3.1 KiB
TypeScript
83 lines
3.1 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { OptimisticL2DisputeGamesItem } from 'types/api/optimisticL2';
|
|
|
|
import config from 'configs/app';
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import CopyToClipboard from 'ui/shared/CopyToClipboard';
|
|
import BlockEntityL2 from 'ui/shared/entities/block/BlockEntityL2';
|
|
import HashStringShorten from 'ui/shared/HashStringShorten';
|
|
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
|
|
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
|
|
|
|
const rollupFeature = config.features.rollup;
|
|
|
|
type Props = { item: OptimisticL2DisputeGamesItem; isLoading?: boolean };
|
|
|
|
const OptimisticL2DisputeGamesListItem = ({ item, isLoading }: Props) => {
|
|
if (!rollupFeature.isEnabled || rollupFeature.type !== 'optimistic') {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ListItemMobileGrid.Container>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Index</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value fontWeight={ 600 } color="text">
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.index }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Game type</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.game_type }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Address</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value color="text">
|
|
<Skeleton loading={ isLoading } display="flex" overflow="hidden" w="100%" alignItems="center">
|
|
<HashStringShorten hash={ item.contract_address_hash } type="long"/>
|
|
<CopyToClipboard text={ item.contract_address_hash } ml={ 2 } isLoading={ isLoading }/>
|
|
</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>L2 block #</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<BlockEntityL2
|
|
isLoading={ isLoading }
|
|
number={ item.l2_block_number }
|
|
noIcon
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<TimeWithTooltip
|
|
timestamp={ item.created_at }
|
|
isLoading={ isLoading }
|
|
display="inline-block"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Status</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value color="text">
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.status }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
{ item.resolved_at && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Resolution age</ListItemMobileGrid.Label><ListItemMobileGrid.Value>
|
|
<TimeWithTooltip
|
|
timestamp={ item.resolved_at }
|
|
isLoading={ isLoading }
|
|
display="inline-block"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
</ListItemMobileGrid.Container>
|
|
);
|
|
};
|
|
|
|
export default OptimisticL2DisputeGamesListItem;
|