Commit graph

34 commits

Author SHA1 Message Date
f86c2251dc Visual text editor; Cards, FAQ and HTML blocks; block anchors
The text editor (Tiptap) only produces simple HTML: headings, bold,
italic, strikethrough, links, lists, pull quotes, lines. Layouts that
were hand-written HTML in text blocks get their own blocks (Cards with
pictures or numbered steps, FAQ), one-offs and embeds go in an HTML
block, and every block can have an anchor for #links. Text blocks get
alignment and a small (footnote) size.

Existing text blocks the editor can't represent become HTML blocks that
render exactly as before (migration, and backup import for old files);
text that is only centred becomes centred text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-26 12:58:15 +00:00
68c67d7e96 Site design: type the basket page's slug instead of picking it
Like the CTA's address, the basket page is now a text box. Slashes and
spaces around the slug are ignored, and Site design warns when no page
has that slug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-26 11:50:53 +00:00
f20d6777ab Site design: the CTA keeps its address, the basket page is optional
Instead of a separate booking page setting, booking links lead to the
header button's own address again, and the basket page falls back to
that address when it isn't set. Site design warns when the basket's
page isn't published or has no Checkout block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-26 11:44:03 +00:00
ec1156b1fa Button block: primary buttons take the site colour
The variant class was built as `btn-${variant}`. Tailwind only generates
classes written out in the source, and nothing in the public app spells
out `btn-primary`, so primary Button blocks rendered as plain grey
buttons on the live site (the admin preview, which uses btn-primary
elsewhere, looked right).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-26 11:44:03 +00:00
c3c10229b0 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
2026-10-26 11:19:54 +00:00
23c5b70a93 Shop: show the bundle's separate price as a saving; hide unsellable bundles
Bundle cards show what the parts cost one by one, crossed out when it's
more than the bundle price. Bundles with a part that isn't on sale are
left out of the shop data, so their parts always have names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-26 09:04:35 +00:00
e824f16e31 Shop and checkout: bundles, gift details, codes, confirm without paying
Bundle cards list what they contain and how long the code is valid. In
the basket a bundle can be marked as a gift (for / message). Checkout
takes a code: covered bookings show "Paid with your code" and cost 0,
with what the code has left; when nothing is left to pay the button is
Confirm booking and no Stripe step happens. The result page and the
confirmation email show bought codes and code-paid bookings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 21:39:51 +00:00
32984ac01d Stock: items.trackStock, so an empty stock really means unlimited
PocketBase 0.23 can't store an empty number (it reads back as 0), so a
product saved with "Unlimited when empty" stock was sold out — on main
too. trackStock says whether stock counts; existing products get it on,
so nothing that sells today changes. The shop maps untracked stock to
null (unlimited), as the UI always assumed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 21:39:51 +00:00
ce3866550a Windows: choose the start-time step (10–60 min, default 30)
A window on fixed steps now has gridMinutes; the admin picks it when
creating or generating windows, and copies keep it. Added to the
(unmerged, undeployed) time-windows migration and pb_schema.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 21:03:40 +00:00
6ab0b75ec3 Shop: pick the length after pressing Book
The card shows "from" the lowest price and the range of lengths; the
slider moves into the booking panel, above the date picker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 20:56:05 +00:00
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
e29eaaa8e8 Show prices in the shop currency (STRIPE_CURRENCY), not hard-coded EUR
formatPrice always formatted EUR, so the public shop, checkout, basket
and order confirmation showed € even when Stripe charged another
currency. It now takes a currency; both apps pass STRIPE_CURRENCY to the
blocks as layout data `currency` (like `timezone`), so one setting drives
what Stripe charges and every price shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq6FzyGitv5gDZEcCHDGoo
2026-10-25 14:48:12 +00:00
5828d65a00 Privacy policy link in the footer and checkout, notes hint, and a policy draft
Site design → Footer picks the privacy policy page; it is linked from the footer and from a short notice above Pay. The notes field asks customers not to write health details (special-category data). 'Create a privacy policy draft' makes an unpublished page describing what this software does with customer data, with gaps for the studio to fill in. No consent checkbox: booking data is processed to perform the contract. Also adds the PrivacyGlobal type used by the retention settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 10:44:45 +00:00
73e8c5dc5d No third-party requests on page load: bundle the fonts, load Stripe.js at Pay
Google Fonts and Stripe.js (imported from @stripe/stripe-js, which injects the script on import) sent every visitor's IP address to Google and Stripe on every page. Fonts now come from @fontsource packages bundled into each app; Stripe.js loads from the 'pure' entry point, only when the customer presses Pay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 10:44:45 +00:00
62025263c9 Shop picker: month arrows, jump to the first available date, +/- for group places
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 09:32:56 +00:00
021d06d3e4 Checkout: reservation countdown, 'keep it 10 more minutes', and a message when a hold runs out
Basket changes that free or take places reload the page data, so places
removed from the basket show up in the shop again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 09:32:56 +00:00
28773f2599 Admin slots: a slot held in a basket reads 'In a basket', not 'Full'
'Full' is now only for a group session filled by paid bookings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 09:32:56 +00:00
214db95186 Show dates, times and prices in a European format and the studio's timezone
Formatting with the default locale rendered US dates (MM/DD/YYYY, 12-hour)
on the server. Everything shown to people now uses DISPLAY_LOCALE (en-GB)
and booking times use SITE_TIMEZONE. The public layout reloads on every
navigation so places left are never stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 09:32:56 +00:00
a22d9f2348 Admin slots: places, blocked/full states, edits limited once booked
Calendar, day panel and list show available / in a basket / booked /
full / blocked (with what blocks it) and places taken. Services, Generate
and single slots take places (default from the service); Copy keeps
them. Once any place is taken only places (not below taken) and notes
can change. All reads go through the shop hook's slot details.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 08:26:37 +00:00
5c6dff9e18 Shop block: places left for group sessions, refresh after booking
Group times show places left and can be added again for another place;
the listing reloads after adding, since one booking can block other
times. Checkout gets a quantity stepper for group lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 08:26:37 +00:00
d7765fe605 Shop: places per slot, and bookings block overlapping slots
Slots get a capacity (items.capacity is the service default). Booking
state is no longer stored on the slot: slotStates() in the shop hooks
counts places from paid order lines and live basket holds (heldUntil
moves to the basket line), and a slot with any place taken blocks every
overlapping slot of any service, including get-ready time.

GET /api/shop/slots lists bookable slots (public) or full detail for a
signed-in admin. add_slot takes seats and adds to an existing line;
group lines can change quantity. Checks and writes share one
transaction. Migration moves existing holds, drops the unique index and
slot status/heldUntil/order, and makes slots signed-in only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 08:26:37 +00:00
2052ad5a59 Slots: bulk generate, copy week and clear, with a preview step
Generate fills a date range (weekdays x opening hours) spaced by the
service's duration + get-ready time (overridable). Copy repeats a week
into the next 1-12 weeks; Clear deletes free slots in a range. Each
previews first, skips past slots and overlaps with the same service, and
never touches booked or in-basket slots. Planning is pure and DST-safe in
$shared/slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 07:41:17 +00:00
1a71c9db73 Services: per-service get-ready time (items.bufferMinutes)
Migration adds the field to existing databases; pb_schema.json mirrors it
in the 0.23 top-level format (min/onlyInt under "options" is ignored).
Edited next to Duration in Services & products.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
2026-10-24 07:41:17 +00:00
773fecc090 Shop: move commerce logic into PocketBase hooks; public app unprivileged
The public (internet-facing) app logged in as the PocketBase superuser and
held the Stripe secret key, so any bug in it could become full control of
the database. Baskets, slot holds, Stripe PaymentIntents, the webhook that
creates orders, and the payment-result lookup now run in PocketBase JS
hooks (pocketbase/pb_hooks/shop, routes under /api/shop/*, plus a cron
that releases expired holds every minute).

The public app's routes keep their URLs but only proxy to those routes and
manage the basket cookie; it has no PocketBase or Stripe secret. Booking
emails are still rendered and sent by the public app (same renderer as the
admin preview) from order data the webhook hook returns; it records the
outcome via a narrow endpoint guarded by INTERNAL_API_SECRET.

Also: slot add and order creation are now transactional; shop listings
load anonymously (already public via API rules); shop API errors always
reach the browser as JSON; the superuser client and stripe package are
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:34:58 +00:00
1f929c68ca Lock order_lines writes (they were public)
order_lines had empty create/update/delete rules, so anyone could forge,
edit or delete the line items of real orders through the REST API. Writes
are now superuser-only (migration + pb_schema.json).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:34:51 +00:00
3308f2f85f Public site: readable text on brand-coloured buttons
Hero, Shop, Checkout, checkout-return and the header logo fallback used
white text on the site Primary; on a light Primary that was unreadable.
They now use primary-content (auto-contrast, see $shared/theme).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:06:05 +00:00
91e3e916d8 Shop block: share item loading with the admin preview, never render blank
The admin preview never received items/slots/events, so Shop and Upcoming
calendar blocks were empty there. loadShopData() (shared) now feeds both
the public layout and a new /preview loader.

A Shop block with nothing to show (no active items, a filter matching
none, or commerce data unavailable because POCKETBASE_ADMIN_* is unset)
now says so instead of rendering an empty section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 12:06:05 +00:00
3399daf951 Theme: admin and site colours follow Site design, rendered server-side
- Admin primary/secondary now follow the site's Primary/Accent colours
  (owner's request), replacing the fixed admin sage. Text on them is picked
  automatically (white or dark, whichever contrasts more), which keeps the
  earlier low-contrast problem from coming back with light brand colours;
  brand colour is no longer used as text (active nav item, placeholders).
- New $shared/theme renders the colours as a <style> in <head> during
  SSR. The public site used to apply them in onMount, so every page load
  flashed the default colours first.
- DaisyUI `secondary` now maps to the site Accent everywhere — the
  button block's "Secondary" variant was DaisyUI's default pink.
- Colours are admin-entered text placed inside <style>, so only plain
  colour values are accepted (hex, named, rgb()/hsl()/oklch()…); anything
  else falls back to the default.
- Saving colours in Site design refreshes the admin theme immediately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 11:32:21 +00:00
fbcc71672b Admin navigation: grouped sidebar, plainer labels, Backup page
Agreed with the site owner:
- Grouped sidebar (Website / Bookings / Settings) instead of a flat top
  bar that overflowed on phones; a drawer with a hamburger below lg.
  Signed-in email and Log out at the bottom.
- Labels: Globals → Site design, Items → Services & products,
  Calendar → Events, Export/Import → Backup (URLs unchanged); page headings
  and cross-references updated to match.
- Export/import moved from a navbar dropdown to a /backup page that says
  what is and isn't included.
- Admin event calendar starts weeks on Monday (createCalendarMonth gains an
  optional weekStartsOn; the public block is unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 11:00:01 +00:00
ff54adb00c Admin server actions: handled errors, timezone-correct times, safer writes
- Slot and timed-event times were parsed in the server's zone (UTC in the
  container) while the form sent the admin's local wall-clock time, so every
  save shifted them by the UTC offset (10:00 → 12:00 in Oslo, again on each
  save). Inputs are now interpreted in SITE_TIMEZONE (shared helpers with
  DST handling), the same setting the booking emails use.
- PocketBase failures in actions (duplicate, validation, relation in use,
  DB down) now return a readable `fail()` instead of a 500 page.
- Pages: 404 for unknown slugs, slug filters built with pb.filter (quotes
  broke them), duplicate-slug check on create/rename (no unique index),
  invalid block JSON rejected instead of throwing; save returns a result so
  the editor can stay on the page.
- Globals: only create a missing record on 404 — any other error (DB
  hiccup) used to create duplicates; save reports success/failure.
- Slots: status is never taken from the form; re-read before update so a
  slot booked or held since the page loaded isn't overwritten; don't delete
  actively held slots.
- Orders: load all order lines in one request instead of one per order.
- Layout exposes site timezone and shop currency for display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-06 10:46:24 +00:00
Jakub Dorfman
96828994e1 added mailing through Brevo and node mailer, also a email editor, with
their custom blocks and renderers
2026-09-28 19:25:19 +02:00
Jakub Dorfman
c3989114b8 moved shared code to the shared package 2026-08-19 19:18:31 +02:00
Jakub Dorfman
478a5fd466 moved shared code to the shared package 2026-08-19 19:18:10 +02:00
Jakub Dorfman
1027da989e moved page rendering to a different service and access is now behind
admin.DOMAIN
www.DOMAIN
db.DOMAIN
2026-08-19 17:58:19 +02:00