From 3c5c3367f60e129d0cadf9be3264ed928da9c79a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9on=20Dumestre?= Date: Thu, 26 Dec 2024 13:42:16 +0000 Subject: [PATCH] fix(time): add a delay before recalculating the time with the step #2282 Approved-by: VANDERHAGHEN Luc --- .../web/components/atoms/field/date/DateTimeField.vue | 11 ++++++++--- apps/web/components/molecules/logistic/GearFilter.vue | 2 +- .../personal-account/ManageBarrelsDialogCard.vue | 2 +- .../festival-event/festival-activity/SecurityCard.vue | 4 ++-- .../festival-event/festival-activity/SupplyCard.vue | 2 +- .../festival-event/festival-task/FtGeneralCard.vue | 2 +- .../festival-event/festival-task/InstructionsCard.vue | 2 +- apps/web/package.json | 2 +- package.json | 2 +- 9 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/web/components/atoms/field/date/DateTimeField.vue b/apps/web/components/atoms/field/date/DateTimeField.vue index 2e2e164394..a24705a259 100644 --- a/apps/web/components/atoms/field/date/DateTimeField.vue +++ b/apps/web/components/atoms/field/date/DateTimeField.vue @@ -56,10 +56,15 @@ watch( ); const emit = defineEmits(["update:model-value", "enter"]); +const delay = ref | undefined>(); + const updateDate = (date: string) => { - const fixedDate = OverDate.fromLocal(new Date(date)).date; - const roundedMinutes = roundMinutes(fixedDate, step); - emit("update:model-value", roundedMinutes); + if (delay.value) clearInterval(delay.value); + delay.value = setTimeout(() => { + const fixedDate = OverDate.fromLocal(new Date(date)).date; + const roundedMinutes = roundMinutes(fixedDate, step); + emit("update:model-value", roundedMinutes); + }, 500); }; const enterKeyDown = () => emit("enter"); diff --git a/apps/web/components/molecules/logistic/GearFilter.vue b/apps/web/components/molecules/logistic/GearFilter.vue index d3173ffa91..7a09f33e65 100644 --- a/apps/web/components/molecules/logistic/GearFilter.vue +++ b/apps/web/components/molecules/logistic/GearFilter.vue @@ -35,7 +35,7 @@ const team = defineModel("team", { required: true }); const updateSearch = (value: string | null) => emit("update:search", value ?? ""); -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const defectSearchUpdate = (search: string) => { if (delay.value) clearInterval(delay.value); delay.value = setTimeout(() => updateSearch(search), 800); diff --git a/apps/web/components/molecules/personal-account/ManageBarrelsDialogCard.vue b/apps/web/components/molecules/personal-account/ManageBarrelsDialogCard.vue index 6faf0cb178..f054162b8e 100644 --- a/apps/web/components/molecules/personal-account/ManageBarrelsDialogCard.vue +++ b/apps/web/components/molecules/personal-account/ManageBarrelsDialogCard.vue @@ -69,7 +69,7 @@ const addNewBarrel = async () => { price.value = 100; openedOn.value = new Date(); }; -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const adjustBarrelPrice = (slug: string, price: number) => { if (delay.value) clearInterval(delay.value); delay.value = setTimeout( diff --git a/apps/web/components/organisms/festival-event/festival-activity/SecurityCard.vue b/apps/web/components/organisms/festival-event/festival-activity/SecurityCard.vue index 20410d863b..4a691b2677 100644 --- a/apps/web/components/organisms/festival-event/festival-activity/SecurityCard.vue +++ b/apps/web/components/organisms/festival-event/festival-activity/SecurityCard.vue @@ -4,7 +4,7 @@ Si tu as des questions sur les besoins ou le nom d'un dispositif de sécu de ton activité, contacte - {{ SECURITE_EMAIL }}. + {{ SECURITE_EMAIL }} . ( () => selectedActivity.value.security, ); -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const updateSpecialNeed = (canBeEmpty: string) => { if (delay.value) clearInterval(delay.value); const specialNeed = canBeEmpty.trim() || null; diff --git a/apps/web/components/organisms/festival-event/festival-activity/SupplyCard.vue b/apps/web/components/organisms/festival-event/festival-activity/SupplyCard.vue index 3035ff4dd1..562e592d8f 100644 --- a/apps/web/components/organisms/festival-event/festival-activity/SupplyCard.vue +++ b/apps/web/components/organisms/festival-event/festival-activity/SupplyCard.vue @@ -51,7 +51,7 @@ const removeElectricitySupply = (supply: ElectricitySupply) => { faStore.removeElectricitySupply(supply.id); }; -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const updateWaterSupply = (canBeEmpty: string) => { if (delay.value) clearInterval(delay.value); const water = canBeEmpty.trim() ? canBeEmpty : null; diff --git a/apps/web/components/organisms/festival-event/festival-task/FtGeneralCard.vue b/apps/web/components/organisms/festival-event/festival-task/FtGeneralCard.vue index 0d144d0072..e39a72d7bb 100644 --- a/apps/web/components/organisms/festival-event/festival-task/FtGeneralCard.vue +++ b/apps/web/components/organisms/festival-event/festival-task/FtGeneralCard.vue @@ -61,7 +61,7 @@ const inChargeTeam = computed(() => teamStore.getTeamByCode(general.value.team ?? ""), ); -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const updateName = (name: string) => { if (delay.value) clearInterval(delay.value); delay.value = setTimeout(() => ftStore.updateGeneral({ name }), 800); diff --git a/apps/web/components/organisms/festival-event/festival-task/InstructionsCard.vue b/apps/web/components/organisms/festival-event/festival-task/InstructionsCard.vue index 3d1d788eab..457306d5c7 100644 --- a/apps/web/components/organisms/festival-event/festival-task/InstructionsCard.vue +++ b/apps/web/components/organisms/festival-event/festival-task/InstructionsCard.vue @@ -219,7 +219,7 @@ watch(isResetApprovalsDialogOpen, (value: boolean) => { const updateAppointment = (appointmentId?: SignaLocation["id"]) => { ftStore.updateInstructions({ appointmentId }); }; -const delay = ref | undefined>(undefined); +const delay = ref | undefined>(); const updateGlobal = (canBeEmpty: string) => { openResetApprovalsDialogIfNeeded(); if (delay.value) clearInterval(delay.value); diff --git a/apps/web/package.json b/apps/web/package.json index 99afe1541a..613e408c80 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@overbookd/web", - "version": "3.3.58", + "version": "3.3.59", "description": "Application web pour le logiciel de gestion du festival des 24 heures de l'INSA", "author": "Club des 24 heures de l'INSA (https://www.24heures.org/)", "homepage": "https://gitlab.com/24-heures-insa/overbookd-mono", diff --git a/package.json b/package.json index d95618d6be..8156f8064c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "overbookd", - "version": "3.21.2-rc.5", + "version": "3.21.2-rc.6", "main": "index.js", "keywords": [], "license": "Apache-2.0",