removed static props for PageAlert

This commit is contained in:
PxlLoewe
2025-05-27 11:19:18 -07:00
parent f54d3ab040
commit 5d5b2dc91f
12 changed files with 70 additions and 142 deletions

View File

@@ -25,7 +25,7 @@ RUN apk add --no-cache libc6-compat
WORKDIR /usr/app WORKDIR /usr/app
COPY --from=builder /usr/app/out/json/ . COPY --from=builder /usr/app/out/json/ .
RUN pnpm install --frozen-lockfile RUN pnpm install
# Build the project # Build the project
COPY --from=builder /usr/app/out/full/ . COPY --from=builder /usr/app/out/full/ .

View File

@@ -23,7 +23,7 @@ RUN apk add --no-cache libc6-compat
WORKDIR /usr/app WORKDIR /usr/app
COPY --from=builder /usr/app/out/json/ . COPY --from=builder /usr/app/out/json/ .
RUN pnpm install --frozen-lockfile RUN pnpm install
# Build the project # Build the project
COPY --from=builder /usr/app/out/full/ . COPY --from=builder /usr/app/out/full/ .

View File

@@ -25,7 +25,7 @@ RUN apk add --no-cache libc6-compat
WORKDIR /usr/app WORKDIR /usr/app
COPY --from=builder /usr/app/out/json/ . COPY --from=builder /usr/app/out/json/ .
RUN pnpm install --frozen-lockfile RUN pnpm install
# Build the project # Build the project
COPY --from=builder /usr/app/out/full/ . COPY --from=builder /usr/app/out/full/ .

View File

@@ -1,5 +1,8 @@
FROM node:22-alpine AS base FROM node:22-alpine AS base
ARG DATABASE_URL
ENV DATABASE_URL=${DATABASE_URL}
ENV PNPM_HOME="/usr/local/pnpm" ENV PNPM_HOME="/usr/local/pnpm"
ENV PATH="${PNPM_HOME}:${PATH}" ENV PATH="${PNPM_HOME}:${PATH}"
RUN corepack enable && corepack prepare pnpm@latest --activate RUN corepack enable && corepack prepare pnpm@latest --activate
@@ -23,7 +26,7 @@ RUN apk add --no-cache libc6-compat
WORKDIR /usr/app WORKDIR /usr/app
COPY --from=builder /usr/app/out/json/ . COPY --from=builder /usr/app/out/json/ .
RUN pnpm install --frozen-lockfile RUN pnpm install
# Build the project # Build the project
COPY --from=builder /usr/app/out/full/ . COPY --from=builder /usr/app/out/full/ .

View File

@@ -15,8 +15,8 @@ interface AppointmentModalProps {
ref: RefObject<HTMLDialogElement | null>; ref: RefObject<HTMLDialogElement | null>;
participantModal: RefObject<HTMLDialogElement | null>; participantModal: RefObject<HTMLDialogElement | null>;
appointmentsTableRef: React.RefObject<PaginatedTableRef | null>; appointmentsTableRef: React.RefObject<PaginatedTableRef | null>;
appointmentForm: UseFormReturn<EventAppointmentOptionalDefaults, any, undefined>; appointmentForm: UseFormReturn<EventAppointmentOptionalDefaults>;
participantForm: UseFormReturn<Participant, any, undefined>; participantForm: UseFormReturn<Participant>;
} }
export const AppointmentModal = ({ export const AppointmentModal = ({

View File

@@ -1,36 +1,34 @@
import { DatabaseBackupIcon, PartyPopperIcon } from 'lucide-react'; import { PartyPopperIcon } from "lucide-react";
import { PaginatedTable } from '../../../_components/PaginatedTable'; import { PaginatedTable } from "../../../_components/PaginatedTable";
import Link from 'next/link'; import Link from "next/link";
export default () => { export default function Page() {
return ( return (
<> <>
<PaginatedTable <PaginatedTable
showEditButton showEditButton
prismaModel="event" prismaModel="event"
columns={[ columns={[
{ {
header: 'Name', header: "Name",
accessorKey: 'name', accessorKey: "name",
}, },
{ {
header: 'Versteckt', header: "Versteckt",
accessorKey: 'hidden', accessorKey: "hidden",
}, },
]} ]}
leftOfSearch={ leftOfSearch={
<span className="flex items-center gap-2"> <span className="flex items-center gap-2">
<PartyPopperIcon className="w-5 h-5" /> Events <PartyPopperIcon className="w-5 h-5" /> Events
</span> </span>
} }
rightOfSearch={ rightOfSearch={
<Link href={'/admin/event/new'}> <Link href={"/admin/event/new"}>
<button className="btn btn-sm btn-outline btn-primary"> <button className="btn btn-sm btn-outline btn-primary">Erstellen</button>
Erstellen </Link>
</button> }
</Link> />
} </>
/> );
</> }
);
};

View File

@@ -1,14 +1,9 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { import { DiscordLogoIcon, InstagramLogoIcon, ReaderIcon } from "@radix-ui/react-icons";
DiscordLogoIcon,
InstagramLogoIcon,
ReaderIcon,
} from "@radix-ui/react-icons";
import { HorizontalNav, VerticalNav } from "../_components/Nav"; import { HorizontalNav, VerticalNav } from "../_components/Nav";
import { Toaster } from "react-hot-toast"; import { Toaster } from "react-hot-toast";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { getServerSession } from "../api/auth/[...nextauth]/auth"; import { getServerSession } from "../api/auth/[...nextauth]/auth";
import { headers } from "next/headers";
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Create Next App", title: "Create Next App",
@@ -65,9 +60,7 @@ export default async function RootLayout({
</div> </div>
{/* Center: Copyright */} {/* Center: Copyright */}
<p className="text-sm"> <p className="text-sm">Copyright © {new Date().getFullYear()} - Virtual Air Rescue</p>
Copyright © {new Date().getFullYear()} - Virtual Air Rescue
</p>
{/* Right: Social Icons */} {/* Right: Social Icons */}
<div className="flex gap-4"> <div className="flex gap-4">

View File

@@ -1,46 +0,0 @@
import { PaginatedTable } from "../../../_components/PaginatedTable";
export default async () => {
return (
<>
<PaginatedTable
prismaModel="user"
searchFields={["publicId", "firstname", "lastname", "email"]}
columns={[
{
header: "Station",
accessorKey: "station",
},
{
header: "Alarmzeit",
accessorKey: "alarm",
},
{
header: "Status 3",
accessorKey: "s3",
},
{
header: "Status 4",
accessorKey: "s4",
},
{
header: "Status 7",
accessorKey: "s7",
},
{
header: "Status 8",
accessorKey: "s8",
},
{
header: "Status 1",
accessorKey: "s1",
},
{
header: "Flugzeit",
accessorKey: "fz",
},
]}
/>
</>
);
};

View File

@@ -1,7 +1,6 @@
import { NotebookText } from "lucide-react"; import { NotebookText } from "lucide-react";
import LogbookTable from "./_components/LogbookTable";
export default () => { const page = () => {
return ( return (
<div className="grid grid-cols-6 gap-4"> <div className="grid grid-cols-6 gap-4">
<div className="col-span-full"> <div className="col-span-full">
@@ -10,8 +9,10 @@ export default () => {
</p> </p>
</div> </div>
<div className="card bg-base-200 shadow-xl mb-4 col-span-6"> <div className="card bg-base-200 shadow-xl mb-4 col-span-6">
<LogbookTable /> <h2 className="text-2xl text-gray-600 ">W.I.P.</h2>
</div> </div>
</div> </div>
); );
}; };
export default page;

View File

@@ -5,16 +5,6 @@ import Events from "./_components/Events";
import { Stats } from "./_components/Stats"; import { Stats } from "./_components/Stats";
import { Badges } from "./_components/Badges"; import { Badges } from "./_components/Badges";
/*
✔️ Einlog-Zeit
✔️ Stats
✔️ Pilot / Disponent TODO: Selection persistent machen
Map - I dont know man, passt hier vielleicht nicht rein
Logbuch / Einsatzhistorie
Badges
Aktive Events / Mandatory Events
*/
export default async function Home({ export default async function Home({
searchParams, searchParams,
}: { }: {

View File

@@ -1,4 +1,5 @@
import { prisma } from "@repo/db"; import { prisma } from "@repo/db";
import { MessageCircleWarning } from "lucide-react";
const fetchMainMessage = async () => { const fetchMainMessage = async () => {
return await prisma.notam.findFirst({ return await prisma.notam.findFirst({
where: { where: {
@@ -8,45 +9,33 @@ const fetchMainMessage = async () => {
}); });
}; };
const mainMessage = await fetchMainMessage(); export const WarningAlert = async () => {
const mainMessage = await fetchMainMessage();
let msgColor; let msgColor;
switch (mainMessage?.color) { switch (mainMessage?.color) {
case "WARNING": case "WARNING":
msgColor = "alert alert-warning ml-3"; msgColor = "alert alert-warning ml-3";
break; break;
case "INFO": case "INFO":
msgColor = "alert alert-info ml-3"; msgColor = "alert alert-info ml-3";
break; break;
case "SUCCESS": case "SUCCESS":
msgColor = "alert alert-success ml-3"; msgColor = "alert alert-success ml-3";
break; break;
case "ERROR": case "ERROR":
msgColor = "alert alert-error ml-3"; msgColor = "alert alert-error ml-3";
break; break;
default: default:
msgColor = "alert ml-3"; msgColor = "alert ml-3";
} }
export const WarningAlert = () => {
if (mainMessage?.message == "" || !mainMessage) { if (mainMessage?.message == "" || !mainMessage) {
return <></>; return <></>;
} else { } else {
return ( return (
<div role="alert" className={msgColor}> <div role="alert" className={msgColor}>
<svg <MessageCircleWarning />
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 shrink-0 stroke-current"
fill="none"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
<span className="font-bold">{mainMessage?.message}</span> <span className="font-bold">{mainMessage?.message}</span>
</div> </div>
); );

View File

@@ -5,7 +5,7 @@ services:
dockerfile: ./apps/dispatch/Dockerfile dockerfile: ./apps/dispatch/Dockerfile
container_name: dispatch container_name: dispatch
ports: ports:
- "3001:3001" - "3001:3000"
env_file: env_file:
- .env.prod - .env.prod
networks: networks: