data table

This commit is contained in:
PxlLoewe
2025-02-06 00:18:44 +01:00
parent 71b401f8ab
commit be5128053f
6 changed files with 161 additions and 15 deletions

View File

@@ -1,22 +1,33 @@
'use client';
import { useSession } from 'next-auth/react';
import Link from 'next/link';
import { useEffect } from 'react';
import { PrismaClient } from '@repo/db';
import { PaginatedTable } from '../app/_components/PaginatedTable';
export default async function Home() {
const prisma = new PrismaClient();
export default function Home() {
const { data: session, update } = useSession();
useEffect(() => {
update();
}, []);
return (
<div>
<h1 className="text-5xl">Hub</h1>
{!session && <h2 className="text-error text-xl">Not signed in</h2>}
{session?.user?.firstname && <h1>Hi, {session?.user?.firstname}</h1>}
<Link href="/logout">
<button className="btn">Logout</button>
</Link>
<PaginatedTable
prismaGetter={prisma.user.findMany}
columns={[
{
header: 'ID',
accessorKey: 'id',
},
{
header: 'First Name',
accessorKey: 'firstname',
},
{
header: 'Last Name',
accessorKey: 'lastname',
},
]}
/>
</div>
);
}