added event helpers to ui libary, added Badge component, reordered Dashboard Components, splitted Event Admin page

This commit is contained in:
PxlLoewe
2025-03-07 14:16:19 -07:00
parent c1f1ad47b7
commit 829e78a47d
25 changed files with 465 additions and 355 deletions

View File

@@ -8,7 +8,7 @@ import {
import { Event, EventAppointment, Participant, prisma, User } from "@repo/db";
import { cn } from "../../../../helper/cn";
import { inscribeToMoodleCourse, upsertParticipant } from "../actions";
import { Clock10Icon, Cross } from "lucide-react";
import { Check, Clock10Icon, Cross, EyeIcon } from "lucide-react";
import { useForm } from "react-hook-form";
import {
EventAppointmentOptionalDefaults,
@@ -22,6 +22,7 @@ import { Select } from "../../../_components/ui/Select";
import toast from "react-hot-toast";
import { useRouter } from "next/navigation";
import { JsonArray } from "../../../../../../packages/database/generated/client/runtime/library";
import { eventCompleted } from "@repo/ui";
interface ModalBtnProps {
title: string;
@@ -90,10 +91,25 @@ const ModalBtn = ({
className={cn(
"btn btn-outline btn-info btn-wide",
event.type === "OBLIGATED_COURSE" && "btn-secondary",
eventCompleted(event, participant) && "btn-success",
)}
onClick={openModal}
>
<EnterIcon /> Anmelden
{participant && !eventCompleted(event, participant) && (
<>
<EyeIcon /> Anzeigen
</>
)}
{!participant && (
<>
<EnterIcon /> Anmelden
</>
)}
{eventCompleted(event, participant) && (
<>
<Check /> Abgeschlossen
</>
)}
</button>
<dialog id={modalId} className="modal">
<div className="modal-box">