From dd1cb1f4209639da4026c580f8ee4c24fa662b21 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Tue, 3 Dec 2024 14:53:24 +0100 Subject: [PATCH] Add quick create event button --- components/calendar/CalendarMenu.vue | 5 +- components/calendar/dialog/CreateEvent.vue | 67 ++++ .../calendar/dialog/QuickCreateEvent.vue | 29 ++ components/calendar/form/CreateEvent.vue | 315 ++++++++---------- components/calendar/state/monthly/DayTile.vue | 2 +- i18n.config.ts | 4 + 6 files changed, 238 insertions(+), 184 deletions(-) create mode 100644 components/calendar/dialog/CreateEvent.vue create mode 100644 components/calendar/dialog/QuickCreateEvent.vue diff --git a/components/calendar/CalendarMenu.vue b/components/calendar/CalendarMenu.vue index ce2b3da..12f593e 100644 --- a/components/calendar/CalendarMenu.vue +++ b/components/calendar/CalendarMenu.vue @@ -10,7 +10,10 @@ const { revealAdvancedSearch } = useCalendar()
-
  • +
  • + +
  • +
  • diff --git a/components/calendar/dialog/CreateEvent.vue b/components/calendar/dialog/CreateEvent.vue new file mode 100644 index 0000000..185b8e9 --- /dev/null +++ b/components/calendar/dialog/CreateEvent.vue @@ -0,0 +1,67 @@ + + + diff --git a/components/calendar/dialog/QuickCreateEvent.vue b/components/calendar/dialog/QuickCreateEvent.vue new file mode 100644 index 0000000..ac202bd --- /dev/null +++ b/components/calendar/dialog/QuickCreateEvent.vue @@ -0,0 +1,29 @@ + + + diff --git a/components/calendar/form/CreateEvent.vue b/components/calendar/form/CreateEvent.vue index 65003ee..145a613 100644 --- a/components/calendar/form/CreateEvent.vue +++ b/components/calendar/form/CreateEvent.vue @@ -2,8 +2,8 @@ import type { RPGDate } from "~/models/Date"; import { PhAlarm, PhCircleNotch, PhEye, PhEyeClosed, PhMapPinArea, PhTag } from "@phosphor-icons/vue" -const { eventSkeleton, operationInProgress } = storeToRefs(useCalendar()) -const { resetSkeleton, submitSkeleton, cancelLatestRequest } = useCalendar() +const { eventSkeleton } = storeToRefs(useCalendar()) +const { submitSkeleton, cancelLatestRequest } = useCalendar() const popoverOpen = ref(false) const { t } = useI18n() @@ -19,26 +19,6 @@ const props = defineProps<{ btnClass?: string }>() -/** - * Opens event creation's popover - */ -function openEventCreatePopover() { - // If another operation is in progress, whether it's another create popup or a modal, don't bother opening it - if (operationInProgress.value) { - popoverOpen.value = false - return - } - - resetSkeleton() - - popoverOpen.value = true - - // Set skeleton initial startDate if it's known - if (props.date) { - eventSkeleton.value.startDate = { ...props.date } // We need to clone it otherwise the props ends up mutating (?) - } -} - async function handleSubmit() { // Prevent form submission if already loading if (isLoading.value) return @@ -58,17 +38,6 @@ async function handleSubmit() { } } -/** - * Prevents the modal from closing if's still loading - * - * @param e The closing event (can be keydown or click) - */ -function handleClosing(e: Event) { - if (isLoading.value) { - e.preventDefault() - } -} - /** * Click on the cancel button * @@ -81,160 +50,142 @@ function handleCancel() {