From 55654e45d010ff7d15aa60a6e87efeed66ed5045 Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Thu, 22 Feb 2024 20:30:48 +0000 Subject: [PATCH] Revert "[WEB-61] Crew sheet duplication (#94)" (#95) This reverts commit 2eb22cba6c63457b58d1b33ad973549a0f57f745. --- .../[eventID]/AddEditSignUpSheetForm.tsx | 13 +-- .../calendar/[eventID]/SignupSheet.tsx | 91 ++++++------------- 2 files changed, 29 insertions(+), 75 deletions(-) diff --git a/app/(authenticated)/calendar/[eventID]/AddEditSignUpSheetForm.tsx b/app/(authenticated)/calendar/[eventID]/AddEditSignUpSheetForm.tsx index 9c20015e..47355ae5 100644 --- a/app/(authenticated)/calendar/[eventID]/AddEditSignUpSheetForm.tsx +++ b/app/(authenticated)/calendar/[eventID]/AddEditSignUpSheetForm.tsx @@ -117,12 +117,6 @@ function CrewMemberField(props: { parentName: string }) { } export function AddEditSignUpSheetForm(props: { - // NB: this form is used in three cases: - // - creating a brand new sign-up sheet - // - cloning an existing one - // - editing an existing one - // In the first case there'll be no initialValues. - mode: "create" | "clone" | "edit"; action: (data: z.infer) => Promise; initialValues?: Partial>; onSuccess: () => void; @@ -138,12 +132,7 @@ export function AddEditSignUpSheetForm(props: { submitLabel={props.submitLabel} >

- {props.mode === "create" - ? "New" - : props.mode === "clone" - ? "Duplicate" - : "Edit"}{" "} - List + {props.initialValues ? "Edit" : "New"} List

(null); - - const sheetWithoutCrew = useMemo(() => { - const result = { ...sheet }; - sheet.crews = sheet.crews.map((x) => ({ - ...x, - user_id: null, - custom_crew_member_name: null, - })); - return result; - }, [sheet]); - return ( <> - {canManageSignUpSheet(event, sheet, me) && ( - - - - - - - - setEditOpen(true)}>Edit - setCloneOpen(true)}> - Duplicate - - { - if ( - confirm( - `Are you sure you want to delete the list "${sheet.title}"? This action cannot be undone.`, - ) - ) { - await deleteSignUpSheet(sheet.signup_id); - } - }} - > - Delete - - - - )}

{sheet.title}

Arrive at{" "} @@ -219,6 +173,32 @@ function SignupSheet({ })} + + {canManageSignUpSheet(event, sheet, me) && ( + <> +
+
+ + +
+ + )}
editSignUpSheet(sheet.signup_id, data)} onSuccess={() => setEditOpen(false)} initialValues={sheet} @@ -234,19 +213,6 @@ function SignupSheet({ />
- setCloneOpen(false)} - size={"95%"} - > - createSignUpSheet(event.event_id, data)} - onSuccess={() => setCloneOpen(false)} - initialValues={sheetWithoutCrew} - submitLabel="Create" - /> - setSignUpCrew(null)}> {signUpCrew !== null && ( createSignUpSheet(event.event_id, sheet)} onSuccess={() => setCreateOpen(false)} initialValues={{