diff --git a/apps/hub/app/(app)/_components/Header.tsx b/apps/hub/app/(app)/_components/Header.tsx new file mode 100644 index 00000000..7a9a3549 --- /dev/null +++ b/apps/hub/app/(app)/_components/Header.tsx @@ -0,0 +1,44 @@ +import { PlaneIcon, Workflow } from "lucide-react"; +import { useSession } from "next-auth/react"; + +interface HeaderProps { + isChecked: boolean; + handleCheckboxChange: (event: React.ChangeEvent) => void; +} + +export const Header = ({ isChecked, handleCheckboxChange }: HeaderProps) => { + const session = useSession(); + console.log(session); + return ( +
+

+ Hallo,{" "} + {session.status === "authenticated" + ? session.data?.user.firstname + : ""} + {"!"} +

+
+
+ +
+
+
+ ); +}; diff --git a/apps/hub/app/(app)/_components/stats.tsx b/apps/hub/app/(app)/_components/stats.tsx new file mode 100644 index 00000000..b5c6ad2e --- /dev/null +++ b/apps/hub/app/(app)/_components/stats.tsx @@ -0,0 +1,129 @@ +import { PlaneIcon } from "lucide-react"; + +interface StatsProps { + isChecked: boolean; +} + +export const Stats = ({ isChecked }: StatsProps) => { + return isChecked ? PilotStats() : DispoStats(); +}; + +export const PilotStats = (): JSX.Element => { + return ( +
+
+
+ + + +
+
Einsätze geflogen
+
127
+
Du bist damit unter den top 5%!
+
+ +
+
+ + + +
+
Pilot Login Zeit
+
35h 12m
+
Mehr als 58% aller anderen User!
+
+ +
+
+ +
+
Christoph 31
+
+ War bisher dein Rettungsmittel der Wahl +
+
+ 87 Stationen warten noch auf dich! +
+
+
+ ); +}; + +export const DispoStats = (): JSX.Element => { + return ( +
+
+
+ + + +
+
Einsätze disponiert
+
578
+
Du bist damit unter den top 9%!
+
+ +
+
+ + + +
+
Disponent Login Zeit
+
53h 12m
+
Mehr als 69% aller anderen User!
+
+ +
+
+ +
+
Christoph Berlin
+
Wurde von dir am meisten Disponiert
+
+ 43 Stationen warten auf deine Einsätze! +
+
+
+ ); +}; diff --git a/apps/hub/app/(app)/page.tsx b/apps/hub/app/(app)/page.tsx index 8c33e8b4..3162405c 100644 --- a/apps/hub/app/(app)/page.tsx +++ b/apps/hub/app/(app)/page.tsx @@ -1,81 +1,35 @@ -import Link from "next/link"; -import { PaginatedTable } from "../_components/PaginatedTable"; -import { Header } from "../_components/ui/Header"; +"use client"; + +import { useState } from "react"; +import { Header } from "./_components/Header"; +import { Stats } from "./_components/stats"; + +/* +✔️ 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 function Home() { + const [isChecked, setIsChecked] = useState(true); + + const handleCheckboxChange = (event: React.ChangeEvent) => { + setIsChecked(event.target.checked); + }; -export default async function Home() { return (
-
- - Map -
- Logbuch -
- Einlog-Zeit (7 Tage, total) -
- Stats -
- Badges -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
- gd -
+
+ +
); } diff --git a/apps/hub/app/(app)/settings/_components/forms.tsx b/apps/hub/app/(app)/settings/_components/forms.tsx index b11b1ad1..b87afd69 100644 --- a/apps/hub/app/(app)/settings/_components/forms.tsx +++ b/apps/hub/app/(app)/settings/_components/forms.tsx @@ -171,17 +171,11 @@ export const SocialForm = ({ }); })} > -

+

Verbindungen & Benachrichtigungen

-
- - Discord - -
- {discordAccount ? ( - - )} -
- - ); -}; diff --git a/packages/database/prisma/migrations/20250221165414_/migration.sql b/packages/database/prisma/migrations/20250221165414_/migration.sql deleted file mode 100644 index f2fdd707..00000000 --- a/packages/database/prisma/migrations/20250221165414_/migration.sql +++ /dev/null @@ -1,17 +0,0 @@ -/* - Warnings: - - - Made the column `eventId` on table `Participant` required. This step will fail if there are existing NULL values in that column. - -*/ --- DropForeignKey -ALTER TABLE "Participant" DROP CONSTRAINT "Participant_eventId_fkey"; - --- AlterTable -ALTER TABLE "Event" ALTER COLUMN "maxParticipants" SET DEFAULT 0; - --- AlterTable -ALTER TABLE "Participant" ALTER COLUMN "eventId" SET NOT NULL; - --- AddForeignKey -ALTER TABLE "Participant" ADD CONSTRAINT "Participant_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/packages/database/prisma/migrations/20250221171836_/migration.sql b/packages/database/prisma/migrations/20250221171836_/migration.sql deleted file mode 100644 index 7892f041..00000000 --- a/packages/database/prisma/migrations/20250221171836_/migration.sql +++ /dev/null @@ -1,4 +0,0 @@ --- AlterTable -ALTER TABLE "Event" ALTER COLUMN "discordRoleId" SET DEFAULT '', -ALTER COLUMN "starterMoodleCourseId" SET DATA TYPE TEXT, -ALTER COLUMN "finisherMoodleCourseId" SET DATA TYPE TEXT; diff --git a/packages/database/prisma/migrations/20250221171925_/migration.sql b/packages/database/prisma/migrations/20250221171925_/migration.sql deleted file mode 100644 index 5c9656c1..00000000 --- a/packages/database/prisma/migrations/20250221171925_/migration.sql +++ /dev/null @@ -1,3 +0,0 @@ --- AlterTable -ALTER TABLE "Event" ALTER COLUMN "starterMoodleCourseId" SET DEFAULT '', -ALTER COLUMN "finisherMoodleCourseId" SET DEFAULT ''; diff --git a/packages/database/prisma/migrations/20250221201452_badges_permissions/migration.sql b/packages/database/prisma/migrations/20250221201452_badges_permissions/migration.sql deleted file mode 100644 index 4cbc11c2..00000000 --- a/packages/database/prisma/migrations/20250221201452_badges_permissions/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ --- CreateEnum -CREATE TYPE "BADGES" AS ENUM ('P1', 'P2', 'P3', 'D1', 'D2', 'D3', 'DAY1'); - --- CreateEnum -CREATE TYPE "PERMISSION" AS ENUM ('ADMIN_EVENT', 'ADMIN_USER', 'SUSPENDED'); - --- AlterTable -ALTER TABLE "users" ADD COLUMN "badges" "BADGES"[] DEFAULT ARRAY[]::"BADGES"[], -ADD COLUMN "permissions" "PERMISSION"[] DEFAULT ARRAY[]::"PERMISSION"[]; diff --git a/packages/database/prisma/migrations/20250222144238_event_appointment/migration.sql b/packages/database/prisma/migrations/20250222144238_event_appointment/migration.sql deleted file mode 100644 index fdd6f1c9..00000000 --- a/packages/database/prisma/migrations/20250222144238_event_appointment/migration.sql +++ /dev/null @@ -1,57 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `selectedForParticipatioon` on the `Participant` table. All the data in the column will be lost. - - You are about to drop the column `status` on the `Participant` table. All the data in the column will be lost. - - Added the required column `eventAppointmentId` to the `Participant` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterEnum --- This migration adds more than one value to an enum. --- With PostgreSQL versions 11 and earlier, this is not possible --- in a single migration. This can be worked around by creating --- multiple migrations, each migration adding only one value to --- the enum. - - -ALTER TYPE "PERMISSION" ADD VALUE 'PILOT'; -ALTER TYPE "PERMISSION" ADD VALUE 'DISPO'; - --- AlterTable -ALTER TABLE "Participant" DROP COLUMN "selectedForParticipatioon", -DROP COLUMN "status", -ADD COLUMN "eventAppointmentId" INTEGER NOT NULL, -ADD COLUMN "finisherMoodleCurseCompleted" BOOLEAN NOT NULL DEFAULT false, -ADD COLUMN "starterMoodleCurseCompleted" BOOLEAN NOT NULL DEFAULT false; - --- CreateTable -CREATE TABLE "EventAppointment" ( - "id" SERIAL NOT NULL, - "eventId" INTEGER NOT NULL, - "appointmentDate" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "EventAppointment_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "_EventAppointmentToUser" ( - "A" INTEGER NOT NULL, - "B" TEXT NOT NULL, - - CONSTRAINT "_EventAppointmentToUser_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateIndex -CREATE INDEX "_EventAppointmentToUser_B_index" ON "_EventAppointmentToUser"("B"); - --- AddForeignKey -ALTER TABLE "EventAppointment" ADD CONSTRAINT "EventAppointment_eventId_fkey" FOREIGN KEY ("eventId") REFERENCES "Event"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Participant" ADD CONSTRAINT "Participant_eventAppointmentId_fkey" FOREIGN KEY ("eventAppointmentId") REFERENCES "EventAppointment"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EventAppointmentToUser" ADD CONSTRAINT "_EventAppointmentToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "EventAppointment"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EventAppointmentToUser" ADD CONSTRAINT "_EventAppointmentToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/packages/database/prisma/migrations/20250222144329_/migration.sql b/packages/database/prisma/migrations/20250222144329_/migration.sql deleted file mode 100644 index 26fd0805..00000000 --- a/packages/database/prisma/migrations/20250222144329_/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- DropForeignKey -ALTER TABLE "Participant" DROP CONSTRAINT "Participant_eventAppointmentId_fkey"; - --- AlterTable -ALTER TABLE "Participant" ALTER COLUMN "eventAppointmentId" DROP NOT NULL; - --- AddForeignKey -ALTER TABLE "Participant" ADD CONSTRAINT "Participant_eventAppointmentId_fkey" FOREIGN KEY ("eventAppointmentId") REFERENCES "EventAppointment"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/packages/database/prisma/migrations/20250222153846_/migration.sql b/packages/database/prisma/migrations/20250222153846_/migration.sql deleted file mode 100644 index ce546031..00000000 --- a/packages/database/prisma/migrations/20250222153846_/migration.sql +++ /dev/null @@ -1,38 +0,0 @@ -/* - Warnings: - - - You are about to drop the `_EventAppointmentToUser` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `presenterId` to the `EventAppointment` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "_EventAppointmentToUser" DROP CONSTRAINT "_EventAppointmentToUser_A_fkey"; - --- DropForeignKey -ALTER TABLE "_EventAppointmentToUser" DROP CONSTRAINT "_EventAppointmentToUser_B_fkey"; - --- AlterTable -ALTER TABLE "EventAppointment" ADD COLUMN "presenterId" TEXT NOT NULL; - --- DropTable -DROP TABLE "_EventAppointmentToUser"; - --- CreateTable -CREATE TABLE "_EventAppointmentUser" ( - "A" INTEGER NOT NULL, - "B" TEXT NOT NULL, - - CONSTRAINT "_EventAppointmentUser_AB_pkey" PRIMARY KEY ("A","B") -); - --- CreateIndex -CREATE INDEX "_EventAppointmentUser_B_index" ON "_EventAppointmentUser"("B"); - --- AddForeignKey -ALTER TABLE "EventAppointment" ADD CONSTRAINT "EventAppointment_presenterId_fkey" FOREIGN KEY ("presenterId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EventAppointmentUser" ADD CONSTRAINT "_EventAppointmentUser_A_fkey" FOREIGN KEY ("A") REFERENCES "EventAppointment"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EventAppointmentUser" ADD CONSTRAINT "_EventAppointmentUser_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;