From b7fa22b018ad0415a4a6205b9a3f26fd30a0f0d8 Mon Sep 17 00:00:00 2001
From: Stephen Adamson
Date: Sun, 5 Jul 2026 22:26:18 +0100
Subject: [PATCH] refactor: accept defaultHours prop in WeeklySchedule and
TimeBlockers
Add optional defaultHours prop to accept pre-fetched data from parent page. Standardise select element styling with shadow-xs, focus-visible ring, and consistent padding.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus
---
.../lib/components/admin/TimeBlockers.svelte | 23 +++++++++++-----
.../components/admin/WeeklySchedule.svelte | 27 ++++++++++++++++---
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/frontend/src/lib/components/admin/TimeBlockers.svelte b/frontend/src/lib/components/admin/TimeBlockers.svelte
index 7026869..31e1f23 100644
--- a/frontend/src/lib/components/admin/TimeBlockers.svelte
+++ b/frontend/src/lib/components/admin/TimeBlockers.svelte
@@ -53,9 +53,10 @@
openUserModal?: (userId: string) => void;
openBookingModal?: (bookingId: string) => void;
rescheduleVersion?: number;
+ defaultHours?: WorkingHourRow[];
}
- const { openUserModal, openBookingModal, rescheduleVersion = 0 }: Props = $props();
+ const { openUserModal, openBookingModal, rescheduleVersion = 0, defaultHours: defaultHoursProp }: Props = $props();
const PAGE_SIZE = 5;
@@ -501,7 +502,17 @@
$effect(() => {
fetchBlockers();
- fetchDefaultHours();
+ });
+
+ $effect(() => {
+ if (defaultHoursProp !== undefined) {
+ if (defaultHoursProp.length > 0) {
+ defaultHours = defaultHoursProp;
+ }
+ hoursLoading = false;
+ } else {
+ fetchDefaultHours();
+ }
});
$effect(() => {
@@ -763,7 +774,7 @@
{:else}