"use client"; import { LogsIcon } from "lucide-react"; import { PaginatedTable } from "../../../_components/PaginatedTable"; import Link from "next/link"; import { ColumnDef } from "@tanstack/react-table"; import { Log, Prisma, User } from "@repo/db"; export default () => { return ( <> ({ OR: [ { User: { firstname: { contains: searchTerm, mode: "insensitive" }, lastname: { contains: searchTerm, mode: "insensitive" }, publicId: { contains: searchTerm, mode: "insensitive" }, }, }, { deviceId: { contains: searchTerm, mode: "insensitive" } }, { ip: { contains: searchTerm, mode: "insensitive" } }, ], }) as Prisma.LogWhereInput } columns={ [ { header: "ID", accessorKey: "id", }, { header: "Aktion", accessorKey: "action", cell: ({ row }) => { const action = row.original.type; if (action !== "PROFILE_CHANGE") { return {action}; } else { return ( {`${row.original.field} von "${row.original.oldValue}" zu "${row.original.newValue}"`} ); } }, }, { header: "IP", accessorKey: "ip", }, { header: "Browser-ID", accessorKey: "deviceId", }, { header: "Zeitstempel", accessorKey: "timestamp", cell: (info) => new Date(info.getValue()).toLocaleString("de-DE"), }, { header: "Benutzer", accessorKey: "userId", cell: ({ row }) => { return ( {row.original.User ? `${row.original.User.firstname} ${row.original.User.lastname} - ${row.original.User.publicId}` : "Unbekannt"} ); }, }, ] as ColumnDef[] } leftOfSearch={ Account Log } /> ); };