style: fix prettier formatting in 3 admin files
CI / Go vulnerabilities (push) Successful in 34s
CI / Tests (push) Successful in 1m34s
CI / Frontend lint & types (push) Failing after 1m52s
CI / Race detector (push) Successful in 3m33s

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-07-05 22:30:42 +01:00
co-authored by Sisyphus
parent 5f1f6c4b44
commit 9c0b189b73
3 changed files with 104 additions and 39 deletions
@@ -580,7 +580,11 @@
</select>
</td>
<td class="py-2">
<select bind:value={row.end_time} disabled={!row.is_open} class="flex h-9 w-24 rounded-md border border-input bg-background px-2 py-1 text-sm shadow-xs ring-offset-background transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50">
<select
bind:value={row.end_time}
disabled={!row.is_open}
class="flex h-9 w-24 rounded-md border border-input bg-background px-2 py-1 text-sm shadow-xs ring-offset-background transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50"
>
{#each Array(24) as _, hour (hour)}
{#each TIME15 as min (min)}
<option value="{String(hour).padStart(2, '0')}:{min}"
@@ -56,7 +56,12 @@
defaultHours?: WorkingHourRow[];
}
const { openUserModal, openBookingModal, rescheduleVersion = 0, defaultHours: defaultHoursProp }: Props = $props();
const {
openUserModal,
openBookingModal,
rescheduleVersion = 0,
defaultHours: defaultHoursProp
}: Props = $props();
const PAGE_SIZE = 5;
+78 -22
View File
@@ -72,8 +72,23 @@
// =============== Lifted Data Fetching ===============
// Fetch shared data once at page level to avoid duplicate API calls
let defaultHours = $state<Array<{ weekday: number; startTime: string; endTime: string; isOpen: boolean }>>([]);
let services = $state<Array<{ id: string; name: string; description: string; price: number; duration_minutes: number; is_active: boolean; patch_test_duration_hours: number; minimum_age_required: number; created_at: string; created_by?: string }>>([]);
let defaultHours = $state<
Array<{ weekday: number; startTime: string; endTime: string; isOpen: boolean }>
>([]);
let services = $state<
Array<{
id: string;
name: string;
description: string;
price: number;
duration_minutes: number;
is_active: boolean;
patch_test_duration_hours: number;
minimum_age_required: number;
created_at: string;
created_by?: string;
}>
>([]);
// Responsive: reset section defaults when crossing the 768px breakpoint
$effect(() => {
@@ -268,14 +283,22 @@
<!-- 2. Customers & Bookings -->
<div class="rounded-lg border">
<button
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.customers === 'expanded' ? 'rounded-t-lg' : 'rounded-lg'}"
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.customers ===
'expanded'
? 'rounded-t-lg'
: 'rounded-lg'}"
style="min-height: 44px;"
onclick={() => sectionState.customers = sectionState.customers === 'expanded' ? 'collapsed' : 'expanded'}
onclick={() =>
(sectionState.customers =
sectionState.customers === 'expanded' ? 'collapsed' : 'expanded')}
aria-expanded={sectionState.customers === 'expanded'}
>
<span class="font-medium text-gray-900">Customers & Bookings</span>
<ChevronDownIcon
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.customers === 'expanded' ? '' : '-rotate-90'}"
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.customers ===
'expanded'
? ''
: '-rotate-90'}"
/>
</button>
{#if sectionState.customers === 'expanded'}
@@ -291,21 +314,30 @@
<!-- 3. Services & Products -->
<div class="rounded-lg border">
<button
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.services === 'expanded' ? 'rounded-t-lg' : 'rounded-lg'}"
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.services ===
'expanded'
? 'rounded-t-lg'
: 'rounded-lg'}"
style="min-height: 44px;"
onclick={() => sectionState.services = sectionState.services === 'expanded' ? 'collapsed' : 'expanded'}
onclick={() =>
(sectionState.services = sectionState.services === 'expanded' ? 'collapsed' : 'expanded')}
aria-expanded={sectionState.services === 'expanded'}
>
<span class="font-medium text-gray-900">Services & Products</span>
<ChevronDownIcon
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.services === 'expanded' ? '' : '-rotate-90'}"
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.services ===
'expanded'
? ''
: '-rotate-90'}"
/>
</button>
{#if sectionState.services === 'expanded'}
<div class="space-y-4 p-4">
<CustomServicesManagement />
<PatchTestsManagement services={services} />
<ServicesManagement services={services} onRefresh={async () => {
<PatchTestsManagement {services} />
<ServicesManagement
{services}
onRefresh={async () => {
if (!browser) return;
try {
const r = await fetch('/api/admin/services', {
@@ -320,7 +352,8 @@
} catch (err) {
console.error('Error refreshing services:', err);
}
}} />
}}
/>
</div>
{/if}
</div>
@@ -328,21 +361,29 @@
<!-- 4. Scheduling & Hours -->
<div class="rounded-lg border">
<button
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.scheduling === 'expanded' ? 'rounded-t-lg' : 'rounded-lg'}"
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.scheduling ===
'expanded'
? 'rounded-t-lg'
: 'rounded-lg'}"
style="min-height: 44px;"
onclick={() => sectionState.scheduling = sectionState.scheduling === 'expanded' ? 'collapsed' : 'expanded'}
onclick={() =>
(sectionState.scheduling =
sectionState.scheduling === 'expanded' ? 'collapsed' : 'expanded')}
aria-expanded={sectionState.scheduling === 'expanded'}
>
<span class="font-medium text-gray-900">Scheduling & Hours</span>
<ChevronDownIcon
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.scheduling === 'expanded' ? '' : '-rotate-90'}"
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.scheduling ===
'expanded'
? ''
: '-rotate-90'}"
/>
</button>
{#if sectionState.scheduling === 'expanded'}
<div class="space-y-4 p-4">
<TimeBlockers {openUserModal} {openBookingModal} {rescheduleVersion} defaultHours={defaultHours} />
<TimeBlockers {openUserModal} {openBookingModal} {rescheduleVersion} {defaultHours} />
<HolidayHours />
<WeeklySchedule defaultHours={defaultHours} />
<WeeklySchedule {defaultHours} />
</div>
{/if}
</div>
@@ -350,14 +391,22 @@
<!-- 5. Promotions & Finance -->
<div class="rounded-lg border">
<button
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.promotions === 'expanded' ? 'rounded-t-lg' : 'rounded-lg'}"
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.promotions ===
'expanded'
? 'rounded-t-lg'
: 'rounded-lg'}"
style="min-height: 44px;"
onclick={() => sectionState.promotions = sectionState.promotions === 'expanded' ? 'collapsed' : 'expanded'}
onclick={() =>
(sectionState.promotions =
sectionState.promotions === 'expanded' ? 'collapsed' : 'expanded')}
aria-expanded={sectionState.promotions === 'expanded'}
>
<span class="font-medium text-gray-900">Promotions & Finance</span>
<ChevronDownIcon
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.promotions === 'expanded' ? '' : '-rotate-90'}"
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.promotions ===
'expanded'
? ''
: '-rotate-90'}"
/>
</button>
{#if sectionState.promotions === 'expanded'}
@@ -371,14 +420,21 @@
<!-- 6. Business Settings -->
<div class="rounded-lg border">
<button
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.settings === 'expanded' ? 'rounded-t-lg' : 'rounded-lg'}"
class="flex w-full items-center justify-between bg-gray-50 px-4 py-3 transition-colors hover:bg-gray-100 {sectionState.settings ===
'expanded'
? 'rounded-t-lg'
: 'rounded-lg'}"
style="min-height: 44px;"
onclick={() => sectionState.settings = sectionState.settings === 'expanded' ? 'collapsed' : 'expanded'}
onclick={() =>
(sectionState.settings = sectionState.settings === 'expanded' ? 'collapsed' : 'expanded')}
aria-expanded={sectionState.settings === 'expanded'}
>
<span class="font-medium text-gray-900">Business Settings</span>
<ChevronDownIcon
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.settings === 'expanded' ? '' : '-rotate-90'}"
class="h-4 w-4 text-gray-500 transition-transform duration-200 {sectionState.settings ===
'expanded'
? ''
: '-rotate-90'}"
/>
</button>
{#if sectionState.settings === 'expanded'}