fixed styles, improved PaginatedTableStyling

This commit is contained in:
PxlLoewe
2025-02-22 23:20:46 +01:00
parent 52888787cf
commit cd5c57beba
11 changed files with 87 additions and 69 deletions

View File

@@ -5,16 +5,6 @@ import Link from 'next/link';
export default () => {
return (
<>
<p className="text-2xl font-semibold text-left flex items-center gap-2 justify-between">
<span className="flex items-center gap-2">
<PartyPopperIcon className="w-5 h-5" /> Events
</span>
<Link href={'/admin/event/new'}>
<button className="btn btn-sm btn-outline btn-primary">
Erstellen
</button>
</Link>
</p>
<PaginatedTable
showEditButton
prismaModel="event"
@@ -28,6 +18,18 @@ export default () => {
accessorKey: 'hidden',
},
]}
leftOfSearch={
<span className="flex items-center gap-2">
<PartyPopperIcon className="w-5 h-5" /> Events
</span>
}
rightOfSearch={
<Link href={'/admin/event/new'}>
<button className="btn btn-sm btn-outline btn-primary">
Erstellen
</button>
</Link>
}
/>
</>
);

View File

@@ -1,42 +1,46 @@
import { DatabaseBackupIcon } from "lucide-react";
import { PaginatedTable } from "../../../_components/PaginatedTable";
import Link from "next/link";
import { DatabaseBackupIcon } from 'lucide-react';
import { PaginatedTable } from '../../../_components/PaginatedTable';
import Link from 'next/link';
export default () => {
return (
<>
<p className="text-2xl font-semibold text-left flex items-center gap-2 justify-between">
<span className="flex items-center gap-2">
<DatabaseBackupIcon className="w-5 h-5" /> Stationen
</span>
<Link href={"/admin/station/new"}>
<button className="btn btn-sm btn-outline btn-primary">
Erstellen
</button>
</Link>
</p>
<PaginatedTable
showEditButton
prismaModel="station"
searchFields={["bosCallsign", "bosUse", "country", "operator"]}
searchFields={['bosCallsign', 'bosUse', 'country', 'operator']}
columns={[
{
header: "BOS Name",
accessorKey: "bosCallsign",
header: 'BOS Name',
accessorKey: 'bosCallsign',
},
{
header: "Bos Use",
accessorKey: "bosUse",
header: 'Bos Use',
accessorKey: 'bosUse',
},
{
header: "Country",
accessorKey: "country",
header: 'Country',
accessorKey: 'country',
},
{
header: "operator",
accessorKey: "operator",
header: 'operator',
accessorKey: 'operator',
},
]}
leftOfSearch={
<span className="flex items-center gap-2">
<DatabaseBackupIcon className="w-5 h-5" /> Stationen
</span>
}
rightOfSearch={
<p className="text-2xl font-semibold text-left flex items-center gap-2 justify-between">
<Link href={'/admin/station/new'}>
<button className="btn btn-sm btn-outline btn-primary">
Erstellen
</button>
</Link>
</p>
}
/>
</>
);

View File

@@ -1,34 +1,36 @@
import { User2 } from "lucide-react";
import { PaginatedTable } from "../../../_components/PaginatedTable";
import { User2 } from 'lucide-react';
import { PaginatedTable } from '../../../_components/PaginatedTable';
export default async () => {
return (
<>
<p className="text-2xl font-semibold text-left flex items-center gap-2">
<User2 className="w-5 h-5" /> Benutzer
</p>
<PaginatedTable
showEditButton
prismaModel="user"
searchFields={["publicId", "firstname", "lastname", "email"]}
searchFields={['publicId', 'firstname', 'lastname', 'email']}
columns={[
{
header: "ID",
accessorKey: "publicId",
header: 'ID',
accessorKey: 'publicId',
},
{
header: "Vorname",
accessorKey: "firstname",
header: 'Vorname',
accessorKey: 'firstname',
},
{
header: "Nachname",
accessorKey: "lastname",
header: 'Nachname',
accessorKey: 'lastname',
},
{
header: "Email",
accessorKey: "email",
header: 'Email',
accessorKey: 'email',
},
]}
leftOfSearch={
<p className="text-2xl font-semibold text-left flex items-center gap-2">
<User2 className="w-5 h-5" /> Benutzer
</p>
}
/>
</>
);

View File

@@ -6,6 +6,9 @@ import {
} from '@radix-ui/react-icons';
import { HorizontalNav, VerticalNav } from '../_components/Nav';
import { Toaster } from 'react-hot-toast';
import { redirect } from 'next/navigation';
import { getServerSession } from '../api/auth/[...nextauth]/auth';
import { headers } from 'next/headers';
export const metadata: Metadata = {
title: 'Create Next App',
@@ -17,6 +20,10 @@ export default async function RootLayout({
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await getServerSession();
if (!session) redirect(`/login`);
return (
<div
className="hero min-h-screen"