mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import React from 'react';
|
|
|
|
import type { TxStateChange } from 'types/api/txStateChanges';
|
|
|
|
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
|
|
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
|
|
|
|
import { getStateElements } from './utils';
|
|
|
|
interface Props {
|
|
data: TxStateChange;
|
|
isLoading?: boolean;
|
|
}
|
|
|
|
const TxStateListItem = ({ data, isLoading }: Props) => {
|
|
|
|
const { before, after, change, tag, tokenId } = getStateElements(data, isLoading);
|
|
|
|
return (
|
|
<ListItemMobileGrid.Container>
|
|
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Address</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value py="3px" display="flex" flexWrap="nowrap" columnGap={ 3 }>
|
|
<AddressEntity
|
|
address={ data.address }
|
|
isLoading={ isLoading }
|
|
truncation="constant"
|
|
/>
|
|
{ tag }
|
|
</ListItemMobileGrid.Value>
|
|
|
|
{ before && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Before</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>{ before }</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
{ after && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>After</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>{ after }</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
{ change && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Change</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value>{ change }</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
{ tokenId && (
|
|
<>
|
|
<ListItemMobileGrid.Label isLoading={ isLoading }>Token ID</ListItemMobileGrid.Label>
|
|
<ListItemMobileGrid.Value py="0">{ tokenId }</ListItemMobileGrid.Value>
|
|
</>
|
|
) }
|
|
|
|
</ListItemMobileGrid.Container>
|
|
);
|
|
};
|
|
|
|
export default TxStateListItem;
|