-
+
{data.buttonLabel}
diff --git a/packages/shared/src/blocks/ShopBlock.svelte b/packages/shared/src/blocks/ShopBlock.svelte
index fb14c91..e9b21c1 100644
--- a/packages/shared/src/blocks/ShopBlock.svelte
+++ b/packages/shared/src/blocks/ShopBlock.svelte
@@ -130,6 +130,14 @@
{data.title}
{/if}
+ {#if !visibleItems.length}
+
+
+ Nothing is available to book right now — please check back soon.
+
+ {/if}
+
{#each visibleItems as item (item.id)}
{@const ui = cardStates[item.id]}
@@ -204,7 +212,7 @@
class="inline-flex items-center justify-center gap-2 rounded-full px-6 py-2.5 text-sm font-medium transition {ui?.pickerOpen
? 'border border-charcoal/15 text-charcoal hover:bg-charcoal/5'
: itemSlotsByDay?.size
- ? 'bg-sage text-white hover:bg-sage-dark'
+ ? 'bg-sage text-primary-content hover:bg-sage-dark'
: 'cursor-not-allowed bg-charcoal/10 text-charcoal/50'}"
disabled={!itemSlotsByDay?.size && !ui?.pickerOpen}
onclick={() => togglePicker(item.id)}
@@ -214,7 +222,7 @@
{:else}
addItem(item.id)}
>
@@ -252,7 +260,7 @@
aria-pressed={selected}
onclick={() => (ui.selectedDayKey = day.dateKey)}
class="aspect-square rounded-full text-sm transition {selected
- ? 'bg-sage font-semibold text-white'
+ ? 'bg-sage font-semibold text-primary-content'
: selectable
? 'cursor-pointer bg-sage/15 font-medium text-charcoal hover:bg-sage/35'
: 'cursor-default text-charcoal/25'} {!day.inMonth ? 'opacity-40' : ''} {day.isToday &&
diff --git a/packages/shared/src/server/shop.ts b/packages/shared/src/server/shop.ts
new file mode 100644
index 0000000..c715b35
--- /dev/null
+++ b/packages/shared/src/server/shop.ts
@@ -0,0 +1,52 @@
+import type PocketBase from 'pocketbase';
+import { getFileUrl } from '../pb';
+import type { ItemRecord, SlotRecord } from '../types';
+
+/**
+ * Active items and future available slots, shaped for the Shop/Checkout
+ * blocks. Used by the public layout and the admin draft preview so both
+ * render the same shop.
+ *
+ * `pb` must be able to read items, slots and media (admin client on the
+ * public site, the logged-in superuser in the admin). Errors propagate.
+ */
+export async function loadShopData(pb: PocketBase): Promise<{ items: ItemRecord[]; slots: SlotRecord[] }> {
+ const [itemRecords, slotRecords] = await Promise.all([
+ pb.collection('items').getFullList({ filter: 'active = true', sort: 'name', expand: 'image' }),
+ pb.collection('slots').getFullList({
+ filter: pb.filter("status = 'available' && start >= {:now}", { now: new Date() }),
+ sort: 'start'
+ })
+ ]);
+
+ const items = itemRecords.map((record): ItemRecord => {
+ const media = record.expand?.image;
+ return {
+ id: record.id,
+ name: record.name,
+ description: record.description || '',
+ price: record.price,
+ image: record.image || '',
+ imageUrl: media ? getFileUrl('media', media.id, media.file) : '',
+ type: record.type,
+ stock: record.stock ?? null,
+ duration: record.duration ?? null,
+ active: record.active
+ };
+ });
+
+ const slots = slotRecords.map(
+ (record): SlotRecord => ({
+ id: record.id,
+ item: record.item,
+ start: record.start,
+ end: record.end || '',
+ status: record.status,
+ heldUntil: record.heldUntil || null,
+ order: record.order || null,
+ notes: record.notes || ''
+ })
+ );
+
+ return { items, slots };
+}