diff --git a/AGENTS.md b/AGENTS.md index f60585b..c47b28a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -154,7 +154,7 @@ To add an email block type: add to `EmailBlockType` in `packages/shared/src/type ### Routing - **Admin app** (`app-admin`): All routes except `/login` are auth-guarded in `hooks.server.ts` (which also refreshes the token per request and sets the cookie's `Secure` flag from the real scheme). The root layout renders the admin shell (grouped sidebar) except on `/login` and `/preview`. The `/preview` route reads `sessionStorage` set by the page editor (same-origin, so it works). - **Public app** (`app-public`): No auth guard. The root layout always renders Header/Footer. `+layout.server.ts` fetches header/footer/colors globals + basket/items/slots for every page. -- **Booking and basket links**: booking = the header CTA's address, basket = the optional basket page (`header.basketPage`; '' = the CTA's address), both from `shopLinks(header)` in `packages/shared/src/types.ts` (blocks read `page.data.header`) — never hard-code `/book`. +- **Booking and basket links**: booking = the header CTA's address, basket = the optional basket page slug typed in Site design (`header.basketPage`; '' = the CTA's address), both from `shopLinks(header)` in `packages/shared/src/types.ts` (blocks read `page.data.header`) — never hard-code `/book`. - **Class names in components are written out whole** (`'btn-primary'`, not `` `btn-${variant}` ``): Tailwind only generates classes it finds in the source, so a built-up name silently gets no style. - `+page.server.ts` for home fetches `slug = "home" && published = true` - `[slug]/+page.server.ts` fetches by dynamic slug diff --git a/README.md b/README.md index 9131082..4d5e826 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ Setup: ``` Copy the printed `whsec_…` signing secret into `STRIPE_WEBHOOK_SECRET`. 4. Import the updated `pb_schema.json` (adds `items`, `slots`, `baskets`, `basket_lines`, `orders`, `order_lines`). Two visitors can't take the same place: holds are checked and written in one PocketBase transaction (see *Slot availability*). -5. Create a published page (e.g. slug `book`) with a `shop` block and point the header CTA at it (*Site design → Header*); hero buttons without an address and *Book another* after paying lead there too. Put a `checkout` block on the same page, or on a page of its own picked as the optional *Basket page*: the basket in the header and *view basket* in the shop lead there (empty = the CTA's address). Site design warns when the basket's page isn't published or has no `checkout` block. +5. Create a published page (e.g. slug `book`) with a `shop` block and point the header CTA at it (*Site design → Header*); hero buttons without an address and *Book another* after paying lead there too. Put a `checkout` block on the same page, or on a page of its own whose slug you type as the optional *Basket page*: the basket in the header and *view basket* in the shop lead there (empty = the CTA's address). Site design warns when the basket's page isn't published or has no `checkout` block. ## Bundles and codes diff --git a/app-admin/src/routes/globals/+page.svelte b/app-admin/src/routes/globals/+page.svelte index 1d5938a..23e222f 100644 --- a/app-admin/src/routes/globals/+page.svelte +++ b/app-admin/src/routes/globals/+page.svelte @@ -40,8 +40,10 @@ // The page the basket links lead to: the basket page, else the CTA's address when that is a page here. function basketProblem() { - const page = pageBySlug(shopLinks(header).basket.replace(/^\/|\/$/g, '')); - if (!page) return ''; + const slug = shopLinks(header).basket.replace(/^\/|\/$/g, ''); + const page = pageBySlug(slug); + // The CTA may point anywhere (even another site); a typed basket slug must be a page here. + if (!page) return header.basketPage?.trim() ? `There is no page with the slug “${slug}”.` : ''; if (!page.published) return `“${page.title}” isn’t published yet.`; if (!page.hasCheckout) return `“${page.title}” has no Checkout block, so people can’t pay from it.`; return ''; @@ -105,13 +107,8 @@
Hero buttons without an address and “Book another” after paying lead here too.
Where people pay: the basket in the header and “view basket” in the shop lead here. Leave it empty if the CTA button’s page has the Checkout block.
+ +The slug of the page where people pay, e.g. basket: the basket in the header and “view basket” in the shop lead there. Leave it empty if the CTA button’s page has the Checkout block.
⚠ {basketProblem()}
{/if}