From 7bdfd8907c4be1d3a8e7ed6587cfa2a960e2753c Mon Sep 17 00:00:00 2001 From: fredrir Date: Sun, 24 Nov 2024 15:15:49 +0100 Subject: [PATCH 01/11] add EditApplicationModal --- components/form/EditApplicationModal.tsx | 121 +++++++++++++++++++++++ pages/apply/[period-id].tsx | 19 +++- 2 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 components/form/EditApplicationModal.tsx diff --git a/components/form/EditApplicationModal.tsx b/components/form/EditApplicationModal.tsx new file mode 100644 index 00000000..d46ef88d --- /dev/null +++ b/components/form/EditApplicationModal.tsx @@ -0,0 +1,121 @@ +"use client"; + +import { useState } from "react"; +import { ApplicationForm } from "./ApplicationForm"; +import { applicantType, DeepPartial, periodType } from "../../lib/types/types"; +import { useSession } from "next-auth/react"; +import Button from "../Button"; + +interface Props { + period: periodType | undefined; + availableCommittees: string[]; + optionalCommittees: string[]; +} + +const ApplicationEditModal = ({ + period, + availableCommittees, + optionalCommittees, +}: Props) => { + const [isOpen, setIsOpen] = useState(false); + const { data: session } = useSession(); + + const [applicationData, setApplicationData] = useState< + DeepPartial + >({ + owId: session?.user?.owId, + name: session?.user?.name, + email: session?.user?.email, + phone: session?.user?.phone || "", + grade: "1", + about: "", + optionalCommittees: [], + preferences: { + first: "", + second: "", + third: "", + }, + }); + + const submitEdit = () => { + setIsOpen(false); + }; + + return ( + <> +