Files
explore/ui/address/epochRewards/AddressEpochRewardsTable.tsx
tom goriunovandGitHub 537f572f7d Add address highlight provider to transaction page and lists (#3266)
* add address highlight provider to the transaction page

* add address highlight provider to lists

* fix tests
2026-02-20 08:02:52 +01:00

49 lines
1.6 KiB
TypeScript

import React from 'react';
import type { AddressEpochRewardsItem } from 'types/api/address';
import { AddressHighlightProvider } from 'lib/contexts/addressHighlight';
import { TableBody, TableColumnHeader, TableHeaderSticky, TableRoot, TableRow } from 'toolkit/chakra/table';
import TimeFormatToggle from 'ui/shared/time/TimeFormatToggle';
import AddressEpochRewardsTableItem from './AddressEpochRewardsTableItem';
type Props = {
items: Array<AddressEpochRewardsItem>;
isLoading?: boolean;
top: number;
};
const AddressEpochRewardsTable = ({ items, isLoading, top }: Props) => {
return (
<AddressHighlightProvider>
<TableRoot minW="1000px" style={{ tableLayout: 'auto' }}>
<TableHeaderSticky top={ top }>
<TableRow>
<TableColumnHeader>
Epoch
<TimeFormatToggle/>
</TableColumnHeader>
<TableColumnHeader>Reward type</TableColumnHeader>
<TableColumnHeader>Associated address</TableColumnHeader>
<TableColumnHeader isNumeric>Value</TableColumnHeader>
</TableRow>
</TableHeaderSticky>
<TableBody>
{ items.map((item, index) => {
return (
<AddressEpochRewardsTableItem
key={ item.epoch_number + item.type + item.account.hash + item.associated_account.hash + (isLoading ? String(index) : '') }
item={ item }
isLoading={ isLoading }
/>
);
}) }
</TableBody>
</TableRoot>
</AddressHighlightProvider>
);
};
export default AddressEpochRewardsTable;