Site design: separate booking page and basket page

The header button, the basket indicator, the shop's "view basket" links,
hero buttons and the payment return page all pointed at a hard-coded
/book. Site design now has a Booking page (where the CTA leads) and a
Basket page (where the basket leads; empty = the booking page), and
warns when the page picked is unpublished or lacks its Shop / Checkout
block. On a basket page of its own, an empty basket links to the
booking page instead of saying "pick a service above".

Sites saved before this keep their links: the booking page falls back
to the CTA's old address, then /book.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
agent 2026-10-26 11:19:54 +00:00
parent 76b297153e
commit c3c10229b0
12 changed files with 105 additions and 28 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import { page } from '$app/state';
import type { HeaderGlobal } from '$lib/types';
import { shopLinks, type HeaderGlobal } from '$lib/types';
import { getBasketContext } from '$lib/basket.svelte';
import { DEFAULT_CURRENCY, formatPrice } from '$shared/calendar';
@ -9,6 +9,7 @@
const basket = getBasketContext();
let hasItems = $derived(basket.count > 0);
let links = $derived(shopLinks(header));
// Phone menu: a native modal <dialog> sliding in from the right, so focus
// trapping, Escape and the inert page behind come from the browser.
@ -64,7 +65,7 @@
{#if hasItems}
<a
class="relative flex items-center gap-2 rounded-full border border-charcoal/10 px-3 py-2 text-sm font-semibold text-charcoal/80 transition hover:border-sage hover:text-sage-dark md:px-4"
href="/book"
href={links.basket}
aria-label="View your basket ({basket.count})"
>
{@render basketIcon()}
@ -73,7 +74,7 @@
</a>
{/if}
{#if header.ctaButton?.label}
<a class="cta btn hidden rounded-full border-0 px-6 hover:opacity-90 md:inline-flex" href={header.ctaButton.href}>{header.ctaButton.label}</a>
<a class="cta btn hidden rounded-full border-0 px-6 hover:opacity-90 md:inline-flex" href={links.booking}>{header.ctaButton.label}</a>
{/if}
<button
class="grid h-10 w-10 place-items-center rounded-full text-charcoal/80 transition hover:bg-charcoal/5 md:hidden"
@ -118,7 +119,7 @@
</ul>
{#if hasItems}
<a class="mx-1 mt-6 flex items-center gap-3 rounded-xl border border-charcoal/10 px-4 py-3 font-semibold text-charcoal/80 transition hover:border-sage" href="/book">
<a class="mx-1 mt-6 flex items-center gap-3 rounded-xl border border-charcoal/10 px-4 py-3 font-semibold text-charcoal/80 transition hover:border-sage" href={links.basket}>
{@render basketIcon()}
<span class="flex-1">Basket ({basket.count})</span>
<span class="text-charcoal/60">{formatTotal(basket.total)}</span>
@ -128,7 +129,7 @@
{#if header.ctaButton?.label}
<div class="border-t border-charcoal/10 p-6">
<a class="cta btn btn-block rounded-full border-0 hover:opacity-90" href={header.ctaButton.href}>{header.ctaButton.label}</a>
<a class="cta btn btn-block rounded-full border-0 hover:opacity-90" href={links.booking}>{header.ctaButton.label}</a>
</div>
{/if}
</div>

View file

@ -2,8 +2,10 @@
import { onMount } from 'svelte';
import { formatInstant, formatPrice } from '$shared/calendar';
import { formatDuration } from '$shared/items';
import { shopLinks } from '$lib/types';
let { data } = $props();
let links = $derived(shopLinks(data.header));
// "Friday 15 January, 10:00" in the studio's timezone.
function formatSlotDate(iso?: string | null) {
@ -68,7 +70,7 @@
</div>
{/if}
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href="/">Book another</a>
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Book another</a>
{:else if data.state === 'processing'}
<h1 class="font-serif text-4xl">Processing your payment…</h1>
<p class="mt-3 text-charcoal/70">
@ -80,10 +82,10 @@
{:else if data.state === 'canceled' || data.state === 'failed'}
<h1 class="font-serif text-4xl">Payment not completed</h1>
<p class="mt-3 text-charcoal/70">Your payment didn't go through — no money was captured. Please try again.</p>
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href="/">Back to the shop</a>
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.basket}>Back to your basket</a>
{:else}
<h1 class="font-serif text-4xl">Nothing to see here</h1>
<p class="mt-3 text-charcoal/70">This link is missing a payment reference.</p>
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href="/">Back to the shop</a>
<a class="btn mt-8 rounded-full border-0 px-8 text-primary-content" style="background-color: var(--color-primary, #8a9a7b);" href={links.booking}>Back to the shop</a>
{/if}
</section>