| import type { StickyColumnConfig, TableConfig } from "@/components/tables/core"; |
| import type { TableId } from "./table-settings"; |
|
|
| |
| |
| |
| export const STICKY_COLUMNS: Record<TableId, StickyColumnConfig[]> = { |
| transactions: [ |
| { id: "select", width: 50 }, |
| { id: "date", width: 110 }, |
| { id: "description", width: 320 }, |
| ], |
| invoices: [ |
| { id: "select", width: 50 }, |
| { id: "invoiceNumber", width: 180 }, |
| ], |
| customers: [{ id: "name", width: 320 }], |
| vault: [ |
| { id: "select", width: 50 }, |
| { id: "title", width: 250 }, |
| ], |
| }; |
|
|
| |
| |
| |
| |
| export const SORT_FIELD_MAPS: Record<TableId, Record<string, string>> = { |
| transactions: { |
| date: "date", |
| description: "name", |
| amount: "amount", |
| category: "category", |
| counterparty: "counterparty", |
| tags: "tags", |
| bank_account: "bank_account", |
| method: "method", |
| assigned: "assigned", |
| status: "attachment", |
| }, |
| invoices: { |
| invoiceNumber: "invoice_number", |
| status: "status", |
| dueDate: "due_date", |
| customer: "customer", |
| amount: "amount", |
| issueDate: "issue_date", |
| }, |
| customers: { |
| name: "name", |
| contact: "contact", |
| email: "email", |
| invoices: "invoices", |
| projects: "projects", |
| industry: "industry", |
| country: "country", |
| totalRevenue: "total_revenue", |
| outstanding: "outstanding", |
| lastInvoice: "last_invoice", |
| tags: "tags", |
| }, |
| vault: {}, |
| }; |
|
|
| |
| |
| |
| export const NON_REORDERABLE_COLUMNS: Record<TableId, Set<string>> = { |
| transactions: new Set(["select", "date", "description", "actions"]), |
| invoices: new Set(["select", "invoiceNumber", "actions"]), |
| customers: new Set(["name", "actions"]), |
| vault: new Set(["select", "title", "actions"]), |
| }; |
|
|
| |
| |
| |
| export const ROW_HEIGHTS: Record<TableId, number> = { |
| transactions: 45, |
| invoices: 57, |
| customers: 45, |
| vault: 45, |
| }; |
|
|
| |
| |
| |
| export const SUMMARY_GRID_HEIGHTS: Partial<Record<TableId, number>> = { |
| invoices: 180, |
| customers: 180, |
| }; |
|
|
| |
| |
| |
| export const TABLE_CONFIGS: Record<TableId, TableConfig> = { |
| transactions: { |
| tableId: "transactions", |
| stickyColumns: STICKY_COLUMNS.transactions, |
| sortFieldMap: SORT_FIELD_MAPS.transactions, |
| nonReorderableColumns: NON_REORDERABLE_COLUMNS.transactions, |
| rowHeight: ROW_HEIGHTS.transactions, |
| }, |
| invoices: { |
| tableId: "invoices", |
| stickyColumns: STICKY_COLUMNS.invoices, |
| sortFieldMap: SORT_FIELD_MAPS.invoices, |
| nonReorderableColumns: NON_REORDERABLE_COLUMNS.invoices, |
| rowHeight: ROW_HEIGHTS.invoices, |
| summaryGridHeight: SUMMARY_GRID_HEIGHTS.invoices, |
| }, |
| customers: { |
| tableId: "customers", |
| stickyColumns: STICKY_COLUMNS.customers, |
| sortFieldMap: SORT_FIELD_MAPS.customers, |
| nonReorderableColumns: NON_REORDERABLE_COLUMNS.customers, |
| rowHeight: ROW_HEIGHTS.customers, |
| summaryGridHeight: SUMMARY_GRID_HEIGHTS.customers, |
| }, |
| vault: { |
| tableId: "vault", |
| stickyColumns: STICKY_COLUMNS.vault, |
| sortFieldMap: SORT_FIELD_MAPS.vault, |
| nonReorderableColumns: NON_REORDERABLE_COLUMNS.vault, |
| rowHeight: ROW_HEIGHTS.vault, |
| }, |
| }; |
|
|
| |
| |
| |
| export function getTableConfig(tableId: TableId): TableConfig { |
| return TABLE_CONFIGS[tableId]; |
| } |
|
|