From 721e26d8e4e45594e636ace473ae58ee9e60213a Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Sat, 8 Jun 2024 21:53:16 +0200 Subject: [PATCH] Added loading and cancelling to updating popover --- assets/main.css | 14 ++++-- components/calendar/form/CreateEvent.vue | 11 +++-- components/calendar/form/UpdateEvent.vue | 62 +++++++++++++++++++----- 3 files changed, 67 insertions(+), 20 deletions(-) diff --git a/assets/main.css b/assets/main.css index 219337f..ad39aa5 100644 --- a/assets/main.css +++ b/assets/main.css @@ -75,13 +75,19 @@ } } -.fade-cancel-enter-active, -.fade-cancel-leave-active { +.fade-enter-active, +.fade-leave-active { + transition: all .5s ease; +} +.fade-delay-enter-active, +.fade-delay-leave-active { transition: all .5s ease 1s; } -.fade-cancel-enter-from, -.fade-cancel-leave-to { +.fade-enter-from, +.fade-leave-to, +.fade-delay-enter-from, +.fade-delay-leave-to { opacity: 0; visibility: hidden; } diff --git a/components/calendar/form/CreateEvent.vue b/components/calendar/form/CreateEvent.vue index ac6cec8..524121f 100644 --- a/components/calendar/form/CreateEvent.vue +++ b/components/calendar/form/CreateEvent.vue @@ -21,14 +21,12 @@ const props = defineProps<{ * Opens event creation's popover */ function openEventCreatePopover() { - console.log(operationInProgress.value) + // 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 } - console.log('open still what ?') - resetSkeleton() popoverOpen.value = true @@ -59,6 +57,7 @@ async function handleSubmit() { } /** + * Prevents the modal from closing if's still loading * * @param e The closing event (can be keydown or click) */ @@ -70,6 +69,8 @@ function handleClosing(e: Event) { /** * Click on the cancel button + * + * Must cancel the abortController in the store, and stop the loading */ function handleCancel() { cancelLatestRequest() @@ -159,14 +160,14 @@ function handleCancel() {
- + Annuler - + diff --git a/components/calendar/form/UpdateEvent.vue b/components/calendar/form/UpdateEvent.vue index 7350394..040a2c8 100644 --- a/components/calendar/form/UpdateEvent.vue +++ b/components/calendar/form/UpdateEvent.vue @@ -1,12 +1,14 @@