domaino/app-admin/src/routes/preview/+page.svelte
agent eac99b2abe Shop: duration slider on services, times fetched per service and length
Service cards step through their lengths with a slider and the price
follows. The time picker loads bookable times for the chosen length and
the months on screen from GET /api/slots (a proxy to the shop hook in each
app), and reloads when the basket's bookings change. Checkout, emails and
the basket show each booking's own length.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 20:12:46 +00:00

36 lines
1.1 KiB
Svelte

<script lang="ts">
import { onMount } from 'svelte';
import BlockRenderer from '$shared/blocks/BlockRenderer.svelte';
import type { ContentBlock } from '$lib/types';
import { rootStyleTag, siteThemeVars } from '$shared/theme';
let { data } = $props();
let blocks = $state<ContentBlock[]>([]);
let error = $state('');
onMount(() => {
const raw = sessionStorage.getItem('cms-preview-blocks');
if (!raw) return;
try {
const parsed = JSON.parse(raw);
if (Array.isArray(parsed)) blocks = parsed;
} catch {
error = 'The preview data could not be read. Close the preview and open it again.';
}
});
</script>
<svelte:head>
<title>Preview</title>
<!-- Full site colours so the draft looks like the public site. -->
{@html rootStyleTag(siteThemeVars(data.colors))}
</svelte:head>
{#if blocks.length}
<BlockRenderer {blocks} items={data.items} calendarEvents={data.calendarEvents} />
{:else}
<section class="mx-auto max-w-3xl px-6 py-20 text-center">
<h1 class="text-4xl">No preview content</h1>
<p class="mt-4 text-charcoal/65">{error || 'Open preview from the page editor to view the current draft.'}</p>
</section>
{/if}