From c33a655e827898dc4a8d01088ede42dd636d0547 Mon Sep 17 00:00:00 2001 From: manuelsanchez2 Date: Mon, 3 Jun 2024 11:38:07 +0200 Subject: [PATCH] Make several improvements to the calendar --- .../add-appointment-modal.tsx | 22 +++++++++++-- .../views/calendar-components/calendar.tsx | 7 ++++ src/config/index.ts | 1 + src/global/index.tsx | 32 ++++++++++++------- src/routes/index.tsx | 3 +- src/utils/functions.ts | 5 +++ 6 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/components/add-appointment-modal/add-appointment-modal.tsx b/src/components/add-appointment-modal/add-appointment-modal.tsx index 3bf7857..27aff8d 100644 --- a/src/components/add-appointment-modal/add-appointment-modal.tsx +++ b/src/components/add-appointment-modal/add-appointment-modal.tsx @@ -10,6 +10,13 @@ export const AddAppointmentModal = component$( isAddAppointmentModalOpen: Signal }) => { const action = useAddAppointment() + // Default date for the date input comes form ?day on the url or today + const url = new URL(window.location.href) + const day = url.searchParams.get('day') + + const defaultOptionForDate = day + ? day + : new Date().toISOString().split('T')[0] useOn( 'click', @@ -24,6 +31,14 @@ export const AddAppointmentModal = component$( }) ) + useOn( + 'submit', + $(() => { + isAddAppointmentModalOpen.value = false + document.body.style.overflow = 'auto' + }) + ) + return (
@@ -69,12 +84,13 @@ export const AddAppointmentModal = component$( id="date" type="date" class="w-full border border-grayBrandMedium rounded-md px-4 py-2" + defaultValue={defaultOptionForDate} />
{/* time_start and time_end */}
-
+
-
+