diff --git a/src/components/common/table-columns/MINER_LEADERBOARD_COLUMNS.tsx b/src/components/common/table-columns/MINER_LEADERBOARD_COLUMNS.tsx index 048127d..44fea80 100644 --- a/src/components/common/table-columns/MINER_LEADERBOARD_COLUMNS.tsx +++ b/src/components/common/table-columns/MINER_LEADERBOARD_COLUMNS.tsx @@ -8,8 +8,24 @@ import { formatMonetaryValue } from '@/utils/formatter'; const columnHelper = createColumnHelper(); export const MINER_LEADERBOARD_COLUMNS = [ + columnHelper.display({ + id: 'rank', + header: 'Rank', + cell: ({ row: { index }, table: { getState } }) => { + const { pageIndex, pageSize } = getState().pagination; + const properIndex = pageIndex * pageSize + (index + 1); + + return
{properIndex}
; + }, + enableSorting: false, + meta: { + header: { + className: 'justify-center' + } + } + }), columnHelper.accessor('id', { - id: 'id', + id: 'miner', header: 'Miner', cell: (props) => ( props.getValue(), - enableSorting: true + enableSorting: false }), columnHelper.accessor('totalRewards', { id: 'total_rewards', header: 'Total Rewards', cell: (props) => formatMonetaryValue(props.getValue(), 5), - enableSorting: true + enableSorting: false }) ]; diff --git a/src/components/ui/composites/data-table/DataTable.tsx b/src/components/ui/composites/data-table/DataTable.tsx index fe50138..cd822fe 100644 --- a/src/components/ui/composites/data-table/DataTable.tsx +++ b/src/components/ui/composites/data-table/DataTable.tsx @@ -70,7 +70,12 @@ export const DataTable = ({ data-sortable={header.column.getCanSort()} className="data-[sortable=true]:cursor-pointer data-[sortable=true]:hover:text-muted-foreground/70" > -
+
{header.isPlaceholder ? null : flexRender( diff --git a/src/types/react-table.d.ts b/src/types/react-table.d.ts new file mode 100644 index 0000000..a0fb74b --- /dev/null +++ b/src/types/react-table.d.ts @@ -0,0 +1,9 @@ +import '@tanstack/react-table'; // or vue, svelte, solid, qwik, etc. + +declare module '@tanstack/react-table' { + interface ColumnMeta { + header?: { + className: string; + }; + } +}