mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* basic components and address page refactoring * second part of refactoring * third part of refactoring * NativeCoinValue component * more refactoring * rename TruncatedValue into TruncatedText * minor fixes * refactor block details * fix layout of value and fee in tx table * update screenshots * different units for tooltip and stats widget small value fix * update screenshots * update tx table screenshot * fix copy button vertical alignment
94 lines
3.0 KiB
TypeScript
94 lines
3.0 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { AddressWithdrawalsItem } from 'types/api/address';
|
|
import type { BlockWithdrawalsItem } from 'types/api/block';
|
|
import type { WithdrawalsItem } from 'types/api/withdrawals';
|
|
|
|
import config from 'configs/app';
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
|
|
import BlockEntity from 'ui/shared/entities/block/BlockEntity';
|
|
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
|
|
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
|
|
import NativeCoinValue from 'ui/shared/value/NativeCoinValue';
|
|
|
|
const feature = config.features.beaconChain;
|
|
|
|
type Props = ({
|
|
item: WithdrawalsItem;
|
|
view: 'list';
|
|
} | {
|
|
item: AddressWithdrawalsItem;
|
|
view: 'address';
|
|
} | {
|
|
item: BlockWithdrawalsItem;
|
|
view: 'block';
|
|
}) & { isLoading?: boolean };
|
|
|
|
const BeaconChainWithdrawalsListItem = ({ item, isLoading, view }: Props) => {
|
|
if (!feature.isEnabled) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<ListItemMobileGrid.Container gridTemplateColumns="100px auto">
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Index</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.index }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Validator index</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<Skeleton loading={ isLoading } display="inline-block">{ item.validator_index }</Skeleton>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
{ view !== 'block' && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Block</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<BlockEntity
|
|
number={ item.block_number }
|
|
isLoading={ isLoading }
|
|
textStyle="sm"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
{ view !== 'address' && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>To</ListItemMobileGrid.Label><ListItemMobileGrid.Value>
|
|
<AddressEntity
|
|
address={ item.receiver }
|
|
isLoading={ isLoading }
|
|
truncation="constant"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
{ view !== 'block' && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<TimeWithTooltip
|
|
timestamp={ item.timestamp }
|
|
isLoading={ isLoading }
|
|
display="inline-block"
|
|
/>
|
|
</ListItemMobileGrid.Value>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Value</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>
|
|
<NativeCoinValue amount={ item.amount } loading={ isLoading }/>
|
|
</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
</ListItemMobileGrid.Container>
|
|
);
|
|
};
|
|
|
|
export default BeaconChainWithdrawalsListItem;
|