removed ui, docs package
This commit is contained in:
@@ -1,32 +1,17 @@
|
||||
"use client";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
CheckCircledIcon,
|
||||
CalendarIcon,
|
||||
EnterIcon,
|
||||
} from "@radix-ui/react-icons";
|
||||
import { Event, EventAppointment, Participant, prisma, User } from "@repo/db";
|
||||
import { CheckCircledIcon, CalendarIcon, EnterIcon } from "@radix-ui/react-icons";
|
||||
import { Event, EventAppointment, Participant, User } from "@repo/db";
|
||||
import { cn } from "../../../../helper/cn";
|
||||
import { inscribeToMoodleCourse, upsertParticipant } from "../actions";
|
||||
import {
|
||||
Check,
|
||||
Clock10Icon,
|
||||
Cross,
|
||||
EyeIcon,
|
||||
MessageCircleWarning,
|
||||
TriangleAlert,
|
||||
} from "lucide-react";
|
||||
import { Check, Clock10Icon, EyeIcon, TriangleAlert } from "lucide-react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import {
|
||||
ParticipantOptionalDefaults,
|
||||
ParticipantOptionalDefaultsSchema,
|
||||
} from "@repo/db/zod";
|
||||
import { ParticipantOptionalDefaults, ParticipantOptionalDefaultsSchema } from "@repo/db/zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Select } from "../../../_components/ui/Select";
|
||||
import toast from "react-hot-toast";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { eventCompleted } from "@repo/ui";
|
||||
import { se } from "date-fns/locale";
|
||||
import { eventCompleted } from "../../../../helper/events";
|
||||
|
||||
interface ModalBtnProps {
|
||||
title: string;
|
||||
@@ -91,12 +76,11 @@ const ModalBtn = ({
|
||||
const selectedAppointment = selectedAppointments[0];
|
||||
const selectedDate = dates.find(
|
||||
(date) =>
|
||||
date.id === selectAppointmentForm.watch("eventAppointmentId") ||
|
||||
selectedAppointment?.id,
|
||||
date.id === selectAppointmentForm.watch("eventAppointmentId") || selectedAppointment?.id,
|
||||
);
|
||||
const ownIndexInParticipantList = (selectedDate as any)?.Participants?.findIndex(
|
||||
(p: Participant) => p.userId === user.id,
|
||||
);
|
||||
const ownIndexInParticipantList = (
|
||||
selectedDate as any
|
||||
)?.Participants?.findIndex((p: Participant) => p.userId === user.id);
|
||||
|
||||
const ownPlaceInParticipantList =
|
||||
ownIndexInParticipantList === -1
|
||||
@@ -154,9 +138,7 @@ const ModalBtn = ({
|
||||
)}
|
||||
{}
|
||||
{!dates.length && (
|
||||
<p className="text-center text-info">
|
||||
Keine Termine verfügbar
|
||||
</p>
|
||||
<p className="text-center text-info">Keine Termine verfügbar</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
@@ -174,13 +156,9 @@ const ModalBtn = ({
|
||||
role="alert"
|
||||
className="py-4 my-5 flex items-center gap-2 justify-center border alert alert-error alert-outline"
|
||||
>
|
||||
<TriangleAlert
|
||||
className="h-6 w-6 shrink-0 stroke-current"
|
||||
fill="none"
|
||||
/>
|
||||
Dieser Termin ist ausgebucht, wahrscheinlich wirst du nicht
|
||||
teilnehmen können. (Listenplatz: {ownPlaceInParticipantList}{" "}
|
||||
, max. {event.maxParticipants})
|
||||
<TriangleAlert className="h-6 w-6 shrink-0 stroke-current" fill="none" />
|
||||
Dieser Termin ist ausgebucht, wahrscheinlich wirst du nicht teilnehmen können.
|
||||
(Listenplatz: {ownPlaceInParticipantList} , max. {event.maxParticipants})
|
||||
</p>
|
||||
)}
|
||||
{selectedAppointment && !participant?.appointmentCancelled && (
|
||||
@@ -188,11 +166,7 @@ const ModalBtn = ({
|
||||
<div className="flex items-center gap-2 justify-center">
|
||||
<p>Dein Ausgewähler Termin</p>
|
||||
|
||||
<p>
|
||||
{new Date(
|
||||
selectedAppointment.appointmentDate,
|
||||
).toLocaleString()}
|
||||
</p>
|
||||
<p>{new Date(selectedAppointment.appointmentDate).toLocaleString()}</p>
|
||||
<button
|
||||
onClick={async () => {
|
||||
await upsertParticipant({
|
||||
@@ -204,8 +178,7 @@ const ModalBtn = ({
|
||||
{
|
||||
data: {
|
||||
appointmentId: selectedAppointment.id,
|
||||
appointmentDate:
|
||||
selectedAppointment.appointmentDate,
|
||||
appointmentDate: selectedAppointment.appointmentDate,
|
||||
},
|
||||
user: `${user?.firstname} ${user?.lastname} - ${user?.publicId}`,
|
||||
event: "Termin abgesagt",
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
|
||||
import { PrismaClient } from "@repo/db";
|
||||
import { KursItem } from "./_components/item";
|
||||
import { RocketIcon } from "@radix-ui/react-icons";
|
||||
|
||||
export default async () => {
|
||||
const prisma = new PrismaClient();
|
||||
const page = async () => {
|
||||
const session = await getServerSession();
|
||||
if (!session) return null;
|
||||
const user = await prisma.user.findUnique({
|
||||
@@ -86,3 +85,5 @@ export default async () => {
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default page;
|
||||
|
||||
Reference in New Issue
Block a user