Files
explore/ui/nameDomains/NameDomainsTableItem.tsx
tom goriunovandGitHub f982eb07a0 Time format toggle for table views (#2729)
* 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
2025-06-03 14:01:12 +02:00

47 lines
1.4 KiB
TypeScript

import React from 'react';
import type * as bens from '@blockscout/bens-types';
import dayjs from 'lib/date/dayjs';
import { TableCell, TableRow } from 'toolkit/chakra/table';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import EnsEntity from 'ui/shared/entities/ens/EnsEntity';
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
type Props = bens.Domain & {
isLoading?: boolean;
};
const NameDomainsTableItem = ({
isLoading,
name,
resolved_address: resolvedAddress,
registration_date: registrationDate,
expiry_date: expiryDate,
protocol,
}: Props) => {
return (
<TableRow>
<TableCell verticalAlign="middle">
<EnsEntity domain={ name } protocol={ protocol } isLoading={ isLoading } fontWeight={ 600 }/>
</TableCell>
<TableCell verticalAlign="middle">
{ resolvedAddress && <AddressEntity address={ resolvedAddress } isLoading={ isLoading } fontWeight={ 500 }/> }
</TableCell>
<TableCell verticalAlign="middle" pl={ 9 }>
<TimeWithTooltip timestamp={ registrationDate } isLoading={ isLoading }/>
</TableCell>
<TableCell verticalAlign="middle">
<TimeWithTooltip
timestamp={ expiryDate }
isLoading={ isLoading }
color={ expiryDate && dayjs(expiryDate).diff(dayjs(), 'day') < 30 ? 'red.600' : 'inherit' }
/>
</TableCell>
</TableRow>
);
};
export default React.memo(NameDomainsTableItem);