From a9c055ddab59503f15823979db99ce5dfb9282ff Mon Sep 17 00:00:00 2001 From: Zeke Abshire Date: Fri, 22 Nov 2024 18:50:19 -0600 Subject: [PATCH] Cloned example to /test/table --- src/app/test/table/page.tsx | 84 +++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/app/test/table/page.tsx diff --git a/src/app/test/table/page.tsx b/src/app/test/table/page.tsx new file mode 100644 index 0000000..27421d5 --- /dev/null +++ b/src/app/test/table/page.tsx @@ -0,0 +1,84 @@ +import { auth } from "~/server/auth"; +import { + Table, + TableBody, + TableCaption, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "~/app/_components/ui/table"; +import { UserNav } from "~/app/_components/user-nav"; +import { DataTable } from "~/app/_components/data-table"; +import { z } from "zod"; +import { promises as fs } from "fs"; +import path from "path"; +import { columns } from "~/app/_components/columns"; +import { taskSchema } from "~/app/_components/schema"; + +async function getTasks() { + const data = await fs.readFile( + path.join(process.cwd(), "src/app/_data/tasks.json"), + ); + + const tasks = JSON.parse(data.toString()); + + return z.array(taskSchema).parse(tasks); +} + +export default async function Home() { + const session = await auth(); + if (!session) { +
+

Not signed in

+
; + } + + const tasks = await getTasks(); + + return ( +
+

+ {session?.user.name ? `${session.user.name}'s notes` : "notes"} +

+ +
+ {/* + A list of your recent invoices. + + + Invoice + Status + Method + Amount + + + + + INV001 + Paid + Credit Card + $250.00 + + +
*/} +
+
+
+

+ Welcome back! +

+

+ Here's a list of your tasks for this month! +

+
+
+ +
+
+ +
+
+
+ ); +}