From 220dc770da2983f47e06b3ee99cf448d519e9ba9 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sat, 22 Feb 2025 17:23:03 +0100 Subject: [PATCH] Events & Kurse User Page --- .../hub/app/(app)/events/_components/item.tsx | 93 +++++++++++++++++++ .../app/(app)/events/_components/modalBtn.tsx | 87 +++++++++++++++++ apps/hub/app/(app)/events/page.tsx | 45 +++++++++ apps/hub/app/(app)/layout.tsx | 2 +- apps/hub/app/_components/ui/Nav.tsx | 15 ++- apps/hub/app/globals.css | 4 + 6 files changed, 241 insertions(+), 5 deletions(-) create mode 100644 apps/hub/app/(app)/events/_components/item.tsx create mode 100644 apps/hub/app/(app)/events/_components/modalBtn.tsx create mode 100644 apps/hub/app/(app)/events/page.tsx diff --git a/apps/hub/app/(app)/events/_components/item.tsx b/apps/hub/app/(app)/events/_components/item.tsx new file mode 100644 index 00000000..09168b7b --- /dev/null +++ b/apps/hub/app/(app)/events/_components/item.tsx @@ -0,0 +1,93 @@ +"use client"; +import { DrawingPinFilledIcon, EnterIcon } from "@radix-ui/react-icons"; +import { User } from "@repo/db"; +import ModalBtn from "./modalBtn"; + +export const KursItem = ({ + user, + title, + type, + beschreibung, + badge, + moodleReq, +}: { + user: User; + title: string; + type: string; + beschreibung: string; + badge: string; + moodleReq: boolean; +}) => { + return ( +
+
+
+

{title}

+
+ + Zusatzqualifikation + +
+
+
+

{beschreibung}

+
+
{badge}
+
+
+

+ Teilnahmevoraussetzungen: + + Moodle Kurs /MOODLEKURSTITLE\ + +

+ +
+
+
+
+ ); +}; + +export const PilotKurs = ({ user }: { user: User }) => { + { + /* STATISCH, DA FÜR ALLE NEUEN MITGLIEDER MANDATORY, WIRD AUSGEBLENDET WENN ABSOLVIERT */ + } + return ( +
+
+
+

Einsteigerkurs für Piloten

+
+ + Verpflichtend + +
+
+
+

+ In diesem Kurs lernen Piloten die Grundlagen der Luftrettung, + Einsatzverfahren, den Umgang mit dem BOS-Funk und einige + medizinische Basics. Der Kurs bietet eine ideale Vorbereitung + für alle Standard Operations bei Virtual Air Rescue. +

+
+
Badge
+
+
+

+ Teilnahmevoraussetzungen: Keine +

+ +
+
+
+
+ ); +}; diff --git a/apps/hub/app/(app)/events/_components/modalBtn.tsx b/apps/hub/app/(app)/events/_components/modalBtn.tsx new file mode 100644 index 00000000..54a05b43 --- /dev/null +++ b/apps/hub/app/(app)/events/_components/modalBtn.tsx @@ -0,0 +1,87 @@ +"use client"; +import { useEffect } from "react"; +import { + CheckCircledIcon, + CalendarIcon, + EnterIcon, +} from "@radix-ui/react-icons"; + +interface ModalBtnProps { + title: string; + dates: string[]; + modalId: string; +} + +const ModalBtn = ({ title, dates, modalId }: ModalBtnProps) => { + useEffect(() => { + const modal = document.getElementById(modalId) as HTMLDialogElement; + const handleOpen = () => { + document.body.classList.add("modal-open"); + }; + const handleClose = () => { + document.body.classList.remove("modal-open"); + }; + modal?.addEventListener("show", handleOpen); + modal?.addEventListener("close", handleClose); + return () => { + modal?.removeEventListener("show", handleOpen); + modal?.removeEventListener("close", handleClose); + }; + }, [modalId]); + + const openModal = () => { + const modal = document.getElementById(modalId) as HTMLDialogElement; + document.body.classList.add("modal-open"); + modal?.showModal(); + }; + + const closeModal = () => { + const modal = document.getElementById(modalId) as HTMLDialogElement; + document.body.classList.remove("modal-open"); + modal?.close(); + }; + + return ( + <> + + +
+

{title}

+

+ + Moodle Kurs abgeschlossen +

+
+
+ + +
+

+ Bitte finde dich an diesem Termin in unserem Discord ein. +

+
+
+ + +
+
+ +
+ + ); +}; + +export default ModalBtn; diff --git a/apps/hub/app/(app)/events/page.tsx b/apps/hub/app/(app)/events/page.tsx new file mode 100644 index 00000000..81d51f59 --- /dev/null +++ b/apps/hub/app/(app)/events/page.tsx @@ -0,0 +1,45 @@ +import { getServerSession } from "../../api/auth/[...nextauth]/auth"; +import { PrismaClient } from "@repo/db"; +import { PilotKurs, KursItem } from "./_components/item"; +import { + RocketIcon, + DrawingPinFilledIcon, + EnterIcon, +} from "@radix-ui/react-icons"; + +export default async () => { + const prisma = new PrismaClient(); + const session = await getServerSession(); + if (!session) return null; + const user = await prisma.user.findFirst({ + where: { + id: session.user.id, + }, + }); + if (!user) return null; + return ( +
+
+

+ Events & Kurse +

+
+ + +
+ ); +}; diff --git a/apps/hub/app/(app)/layout.tsx b/apps/hub/app/(app)/layout.tsx index d169595b..8233e946 100644 --- a/apps/hub/app/(app)/layout.tsx +++ b/apps/hub/app/(app)/layout.tsx @@ -40,7 +40,7 @@ export default async function RootLayout({ {/* Scrollbarer Content-Bereich */} -
+
{children}
diff --git a/apps/hub/app/_components/ui/Nav.tsx b/apps/hub/app/_components/ui/Nav.tsx index ec65321c..9557357f 100644 --- a/apps/hub/app/_components/ui/Nav.tsx +++ b/apps/hub/app/_components/ui/Nav.tsx @@ -4,8 +4,9 @@ import { GearIcon, ExitIcon, LockClosedIcon, -} from '@radix-ui/react-icons'; -import Link from 'next/link'; + RocketIcon, +} from "@radix-ui/react-icons"; +import Link from "next/link"; export const VerticalNav = () => { return ( @@ -18,7 +19,13 @@ export const VerticalNav = () => {
  • - Profile + Profil + +
  • +
  • + + + Events & Kurse
  • @@ -62,7 +69,7 @@ export const HorizontalNav = () => (
    • - diff --git a/apps/hub/app/globals.css b/apps/hub/app/globals.css index f2f484fe..c9b33cc1 100644 --- a/apps/hub/app/globals.css +++ b/apps/hub/app/globals.css @@ -7,3 +7,7 @@ --foreground: #171717; /* --p: 47.67% 0.2484 267.02; */ } + +body.modal-open { + overflow: hidden; +}