From f87068fbebeb9e3411d98a0cda154ae7c8dcb230 Mon Sep 17 00:00:00 2001 From: Nehar Tale Date: Sat, 25 Jan 2025 14:36:33 +0100 Subject: [PATCH] feat: Add transaction type column to columns.tsx files --- client/src/components/transaction/columns.tsx | 6 +++++ client/src/pages/(secure)/columns.tsx | 23 ++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/client/src/components/transaction/columns.tsx b/client/src/components/transaction/columns.tsx index 406b63f..d83e7f2 100644 --- a/client/src/components/transaction/columns.tsx +++ b/client/src/components/transaction/columns.tsx @@ -61,12 +61,18 @@ export const columns: ColumnDef[] = [ accessorKey: 'Description', header: 'Description', }, + { + accessorKey: 'type', + header: () =>
Type
, + cell: ({ row }) =>
{row.original.Type}
, + }, { accessorKey: 'amount', header: () =>
Amount
, cell: ({ row }) =>
{row.original.Amount}
, }, + { id: 'actions', enableHiding: false, diff --git a/client/src/pages/(secure)/columns.tsx b/client/src/pages/(secure)/columns.tsx index a2e89ad..172bbac 100644 --- a/client/src/pages/(secure)/columns.tsx +++ b/client/src/pages/(secure)/columns.tsx @@ -16,29 +16,16 @@ import { import { useUserData, type Transaction } from '@/components/context/userData'; export const columns: ColumnDef[] = [ - { - accessorKey: 'CreatedAt', - header: 'Created At', - cell: ({ row }) => { - const rawDate = row.getValue('CreatedAt') as string; - const date = new Date(rawDate); - if (isNaN(date.getTime())) throw new Error('Invalid date'); - - return ( -
- {date.toLocaleString('en-US', { - dateStyle: 'short', - timeStyle: 'medium', - })} -
- ); - }, - }, { accessorKey: 'Description', header: 'Description', }, +{ + accessorKey: 'type', + header: () =>
Type
, + cell: ({ row }) =>
{row.original.Type}
, + }, { accessorKey: 'amount',