diff --git a/next.config.mjs b/next.config.mjs index e769fd5..99d9088 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -8,6 +8,9 @@ const nextConfig = { return config; }, output: 'standalone', + env: { + appVersion: process.env.npm_package_version, + }, }; export default nextConfig; diff --git a/package-lock.json b/package-lock.json index 9c1ed7b..7843c0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,13 @@ { "name": "next-finances", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "next-finances", - "version": "1.0.0", + "version": "1.0.1", + "license": "MIT", "dependencies": { "@hookform/resolvers": "^3.3.4", "@lucia-auth/adapter-prisma": "^4.0.0", diff --git a/package.json b/package.json index ee21928..2cb23d4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "next-finances", "description": "A finances application to keep track of my personal spendings", "homepage": "https://github.com/MarkusThielker/next-finances", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "author": { "name": "Markus Thielker" diff --git a/src/app/account/page.tsx b/src/app/account/page.tsx index 4cd88f9..fae73de 100644 --- a/src/app/account/page.tsx +++ b/src/app/account/page.tsx @@ -20,26 +20,25 @@ export default async function AccountPage() { } let paymentCount = 0; + paymentCount = await prismaClient.payment.count({ + where: { + userId: user.id, + }, + }); + let entityCount = 0; - let categoryCount = 0; + entityCount = await prismaClient.entity.count({ + where: { + userId: user.id, + }, + }); - if (process.env.NODE_ENV === 'development') { - paymentCount = await prismaClient.payment.count({ - where: { - userId: user.id, - }, - }); - entityCount = await prismaClient.entity.count({ - where: { - userId: user.id, - }, - }); - categoryCount = await prismaClient.category.count({ - where: { - userId: user.id, - }, - }); - } + let categoryCount = 0; + categoryCount = await prismaClient.category.count({ + where: { + userId: user.id, + }, + }); return (
@@ -91,6 +90,23 @@ export default async function AccountPage() { +
+

Version {process.env.appVersion}

+
+ + Source Code + + + Changelog + +
+
); } diff --git a/src/app/payments/columns.tsx b/src/app/payments/columns.tsx index b092e50..32a2157 100644 --- a/src/app/payments/columns.tsx +++ b/src/app/payments/columns.tsx @@ -50,7 +50,15 @@ export const columns = ( header: 'Category', cell: ({row}) => { const category = categories.find((category) => category.id === row.original.categoryId); - return category?.name ?? '-'; + return ( +
+ + + +

{category?.name ?? '-'}

+
+ ); }, }, { diff --git a/src/components/ui/data-table.tsx b/src/components/ui/data-table.tsx index 33815e4..c522f86 100644 --- a/src/components/ui/data-table.tsx +++ b/src/components/ui/data-table.tsx @@ -4,8 +4,9 @@ import { ColumnDef, flexRender, getCoreRowModel, getPaginationRowModel, useReact import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'; import { Button } from '@/components/ui/button'; -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; interface DataTableProps { columns: ColumnDef[]; @@ -20,6 +21,7 @@ export function DataTable({ pagination, className, }: DataTableProps) { + const table = useReactTable({ data, columns, @@ -27,6 +29,13 @@ export function DataTable({ getPaginationRowModel: pagination ? getPaginationRowModel() : undefined, }); + const [pageSize, setPageSize] = useState(50); + useEffect(() => { + if (pagination) { + table.setPageSize(pageSize); + } + }, [table, pagination, pageSize]); + return (
@@ -57,7 +66,8 @@ export function DataTable({ data-state={row.getIsSelected() && 'selected'} > {row.getVisibleCells().map((cell) => ( - + {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} @@ -75,43 +85,62 @@ export function DataTable({
{ pagination && ( -
- - + + + +
) }