Finished Hub ESLINT rule enforcement
This commit is contained in:
@@ -17,7 +17,9 @@ export const EventCard = ({
|
||||
Participants: Participant[];
|
||||
};
|
||||
selectedAppointments: EventAppointment[];
|
||||
appointments: EventAppointment[];
|
||||
appointments: (EventAppointment & {
|
||||
Participants: { userId: string }[];
|
||||
})[];
|
||||
}) => {
|
||||
return (
|
||||
<div className="col-span-full">
|
||||
|
||||
@@ -16,7 +16,11 @@ import {
|
||||
TriangleAlert,
|
||||
} from "lucide-react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { ParticipantOptionalDefaults, ParticipantOptionalDefaultsSchema } from "@repo/db/zod";
|
||||
import {
|
||||
InputJsonValueType,
|
||||
ParticipantOptionalDefaults,
|
||||
ParticipantOptionalDefaultsSchema,
|
||||
} from "@repo/db/zod";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Select } from "../../../_components/ui/Select";
|
||||
import { useRouter } from "next/navigation";
|
||||
@@ -24,11 +28,14 @@ import { handleParticipantEnrolled } from "../../../../helper/events";
|
||||
import { eventCompleted } from "@repo/shared-components";
|
||||
import MDEditor from "@uiw/react-md-editor";
|
||||
import toast from "react-hot-toast";
|
||||
import { formatDate } from "date-fns";
|
||||
|
||||
interface ModalBtnProps {
|
||||
title: string;
|
||||
event: Event;
|
||||
dates: EventAppointment[];
|
||||
dates: (EventAppointment & {
|
||||
Participants: { userId: string }[];
|
||||
})[];
|
||||
selectedAppointments: EventAppointment[];
|
||||
participant?: Participant;
|
||||
user: User;
|
||||
@@ -88,14 +95,16 @@ const ModalBtn = ({
|
||||
(date) =>
|
||||
date.id === selectAppointmentForm.watch("eventAppointmentId") || selectedAppointment?.id,
|
||||
);
|
||||
const ownIndexInParticipantList = (selectedDate as any)?.Participants?.findIndex(
|
||||
(p: Participant) => p.userId === user.id,
|
||||
const ownIndexInParticipantList = selectedDate?.Participants?.findIndex(
|
||||
(p) => p.userId === user.id,
|
||||
);
|
||||
|
||||
const ownPlaceInParticipantList =
|
||||
ownIndexInParticipantList === -1
|
||||
? (selectedDate as any)?.Participants?.length + 1
|
||||
: ownIndexInParticipantList + 1;
|
||||
typeof ownIndexInParticipantList === "number"
|
||||
? ownIndexInParticipantList === -1
|
||||
? (selectedDate?.Participants?.length ?? 0) + 1
|
||||
: ownIndexInParticipantList + 1
|
||||
: undefined;
|
||||
|
||||
const missingRequirements =
|
||||
event.requiredBadges?.length > 0 &&
|
||||
@@ -167,13 +176,7 @@ const ModalBtn = ({
|
||||
<Select
|
||||
form={selectAppointmentForm}
|
||||
options={dates.map((date) => ({
|
||||
label: `${new Date(date.appointmentDate).toLocaleString("de-DE", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
})} - (${(date as any).Participants.length}/${event.maxParticipants})`,
|
||||
label: `${formatDate(date.appointmentDate, "dd.MM.yyyy HH:mm")} - (${date.Participants.length}/${event.maxParticipants})`,
|
||||
value: date.id,
|
||||
}))}
|
||||
name="eventAppointmentId"
|
||||
@@ -296,7 +299,7 @@ const ModalBtn = ({
|
||||
userId: participant!.userId,
|
||||
appointmentCancelled: true,
|
||||
statusLog: [
|
||||
...(participant?.statusLog as any),
|
||||
...(participant?.statusLog as unknown as InputJsonValueType[]),
|
||||
{
|
||||
data: {
|
||||
appointmentId: selectedAppointment.id,
|
||||
|
||||
Reference in New Issue
Block a user