Первый коммит

This commit is contained in:
Redsandyg
2025-06-02 13:04:22 +03:00
parent c0d101a79e
commit 00f5ecfb9c
31 changed files with 3483 additions and 101 deletions

View File

@@ -0,0 +1,51 @@
import { useMemo } from 'react';
import { MaterialReactTable, MRT_ColumnDef } from 'material-react-table';
import mockData from '../data/mockData';
function formatCurrency(amount: number) {
return amount?.toLocaleString('ru-RU', {
style: 'currency',
currency: 'RUB',
minimumFractionDigits: 0,
}) ?? '';
}
const statusColor: Record<string, string> = {
'Завершена': '#4caf50',
'Ожидается': '#ff9800',
'Ошибка': '#f44336',
};
export default function BillingPayoutsTable() {
const columns = useMemo<MRT_ColumnDef<any>[]>(
() => [
{ accessorKey: 'id', header: 'ID' },
{ accessorKey: 'amount', header: 'Сумма',
Cell: ({ cell }) => formatCurrency(cell.getValue() as number) },
{ accessorKey: 'date', header: 'Дата' },
{ accessorKey: 'status', header: 'Статус',
Cell: ({ cell }) => (
<span style={{ color: statusColor[cell.getValue() as string] || '#333', fontWeight: 600 }}>
{cell.getValue() as string}
</span>
)
},
{ accessorKey: 'method', header: 'Способ' },
],
[]
);
return (
<MaterialReactTable
columns={columns}
data={mockData.payouts}
enableColumnActions={false}
enableColumnFilters={false}
enableSorting={true}
enablePagination={true}
muiTableBodyCellProps={{ sx: { fontSize: 14 } }}
muiTableHeadCellProps={{ sx: { fontWeight: 700 } }}
initialState={{ pagination: { pageSize: 10, pageIndex: 0 } }}
/>
);
}