removed ui, docs package

This commit is contained in:
PxlLoewe
2025-05-24 13:07:55 -07:00
parent cbeae274a4
commit 5187ed194c
44 changed files with 214 additions and 933 deletions

View File

@@ -1,11 +1,10 @@
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
import { PrismaClient } from "@repo/db";
import { prisma } from "@repo/db";
import { KursItem } from "../events/_components/item";
import { RocketIcon } from "lucide-react";
import { eventCompleted } from "@repo/ui";
import { eventCompleted } from "../../../helper/events";
export default async () => {
const prisma = new PrismaClient();
const page = async () => {
const session = await getServerSession();
if (!session) return null;
const user = await prisma.user.findUnique({
@@ -63,10 +62,7 @@ export default async () => {
const filteredEvents = events.filter((event) => {
if (eventCompleted(event, event.participants[0])) return false;
if (
event.type === "OBLIGATED_COURSE" &&
!eventCompleted(event, event.participants[0])
)
if (event.type === "OBLIGATED_COURSE" && !eventCompleted(event, event.participants[0]))
return true;
return false;
});
@@ -95,3 +91,5 @@ export default async () => {
</div>
);
};
export default page;

View File

@@ -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",

View File

@@ -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;

View File

@@ -1,11 +1,10 @@
"use server";
import { prisma, Prisma, PrismaClient } from "@repo/db";
import { prisma, Prisma } from "@repo/db";
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
import bcrypt from "bcryptjs";
export const unlinkDiscord = async (userId: string) => {
const client = new PrismaClient();
await client.discordAccount.deleteMany({
await prisma.discordAccount.deleteMany({
where: {
userId,
},
@@ -16,9 +15,7 @@ export const updateUser = async (changes: Prisma.UserUpdateInput) => {
const session = await getServerSession();
if (!session) return null;
const client = new PrismaClient();
await client.user.update({
await prisma.user.update({
where: {
id: session.user.id,
},
@@ -26,10 +23,7 @@ export const updateUser = async (changes: Prisma.UserUpdateInput) => {
});
};
export const changePassword = async (
oldPassword: string,
newPassword: string,
) => {
export const changePassword = async (oldPassword: string, newPassword: string) => {
const session = await getServerSession();
if (!session)
return {

View File

@@ -1,15 +1,9 @@
import { prisma } from "@repo/db";
import { getServerSession } from "../../api/auth/[...nextauth]/auth";
import { PrismaClient } from "@repo/db";
import {
ProfileForm,
SocialForm,
PasswordForm,
PilotForm,
} from "./_components/forms";
import { ProfileForm, SocialForm, PasswordForm, PilotForm } from "./_components/forms";
import { GearIcon } from "@radix-ui/react-icons";
export const page = async () => {
const prisma = new PrismaClient();
const session = await getServerSession();
if (!session) return null;
const user = await prisma.user.findFirst({