domaino/packages/shared/src/blocks/BlockRenderer.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

54 lines
2.2 KiB
Svelte

<script lang="ts">
import type { CalendarEventRecord, ContentBlock, BlockBackground, BlockForeground, ItemRecord } from '$shared/types';
import BackgroundWrapper from './BackgroundWrapper.svelte';
import TextBlock from './TextBlock.svelte';
import ImageTextBlock from './ImageTextBlock.svelte';
import TimelineBlock from './TimelineBlock.svelte';
import HeroBlock from './HeroBlock.svelte';
import ButtonBlock from './ButtonBlock.svelte';
import SpacerBlock from './SpacerBlock.svelte';
import TestimonialsBlock from './TestimonialsBlock.svelte';
import UpcomingCalendarBlock from './UpcomingCalendarBlock.svelte';
import ShopBlock from './ShopBlock.svelte';
import CheckoutBlock from './CheckoutBlock.svelte';
let { blocks = [], calendarEvents = [], items = [] } = $props<{
blocks: ContentBlock[];
calendarEvents?: CalendarEventRecord[];
items?: ItemRecord[];
}>();
function getBg(block: ContentBlock): BlockBackground {
return (block.data._background as BlockBackground) || { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 };
}
function getFg(block: ContentBlock): BlockForeground {
return (block.data._foreground as BlockForeground) || {};
}
</script>
{#each blocks as block (block.id)}
<BackgroundWrapper background={getBg(block)} foreground={getFg(block)}>
{#if block.type === 'text'}
<TextBlock data={block.data} />
{:else if block.type === 'image_text'}
<ImageTextBlock data={block.data} />
{:else if block.type === 'timeline'}
<TimelineBlock data={block.data} />
{:else if block.type === 'hero'}
<HeroBlock data={block.data} />
{:else if block.type === 'button'}
<ButtonBlock data={block.data} />
{:else if block.type === 'spacer'}
<SpacerBlock data={block.data} />
{:else if block.type === 'testimonials'}
<TestimonialsBlock data={block.data} />
{:else if block.type === 'upcoming_calendar'}
<UpcomingCalendarBlock data={block.data} events={calendarEvents} />
{:else if block.type === 'shop'}
<ShopBlock data={block.data} {items} />
{:else if block.type === 'checkout'}
<CheckoutBlock data={block.data} />
{/if}
</BackgroundWrapper>
{/each}