diff --git a/app-admin/src/app.css b/app-admin/src/app.css index 74c593c..95c7284 100644 --- a/app-admin/src/app.css +++ b/app-admin/src/app.css @@ -1,151 +1,157 @@ -@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap'); -@import 'tailwindcss'; -@plugin 'daisyui' { - themes: light --default; -} - -/* Admin UI theme: DaisyUI light with a fixed sage primary. Deliberately NOT - tied to the site's Globals → Colors (those only apply inside /preview), so - a light brand colour can't make admin buttons unreadable. #647556 on white - text is ~5:1 contrast (WCAG AA). */ -@plugin 'daisyui/theme' { - name: 'light'; - default: true; - --color-primary: #647556; - --color-primary-content: #ffffff; -} - -@theme { - --font-sans: 'DM Sans', ui-sans-serif, system-ui, sans-serif; - --font-serif: 'Playfair Display', Georgia, serif; - --color-warm: var(--color-bg, #faf8f5); - --color-charcoal: var(--color-heading, #2c2c2c); - --color-sage: var(--color-primary, #8a9a7b); - --color-sage-dark: color-mix(in srgb, var(--color-primary, #8a9a7b) 80%, #000); - --color-terracotta: var(--color-accent, #c9825f); -} - -@keyframes shrink { - from { scale: 0 1; } - to { scale: 1 1; } -} - -.delete-fill { - position: absolute; - inset: 0; - background: transparent; - transform-origin: left; -} - -.delete-fill.animating { - animation: shrink 1s ease-in-out forwards; - background: var(--error, #f43f5e); -} - -.btn.delete-holding { - color: white !important; -} - -.btn.delete-holding .text-error { - color: white !important; -} - -:root { - --fg-heading: var(--color-heading, #2c2c2c); - --fg-subheading: var(--color-subheading, #4a4a4a); - --fg-body: var(--color-text, #2c2c2c); - background: var(--color-bg, #faf8f5); - color: var(--fg-body); - font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif; -} - -/* ── Foreground colour utilities (set per-block via BackgroundWrapper) ── */ -.text-fg-body { color: var(--fg-body, #2c2c2c); } -.text-fg-body\/85 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 85%, transparent); } -.text-fg-body\/80 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 80%, transparent); } -.text-fg-body\/75 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 75%, transparent); } -.text-fg-body\/70 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 70%, transparent); } -.text-fg-body\/60 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 60%, transparent); } -.text-fg-heading { color: var(--fg-heading, #2c2c2c); } -.text-fg-subheading { color: var(--fg-subheading, #4a4a4a); } -.text-fg-subheading\/85 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 85%, transparent); } -.text-fg-subheading\/80 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 80%, transparent); } -.text-fg-subheading\/75 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 75%, transparent); } -.text-fg-subheading\/70 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 70%, transparent); } -.text-fg-subheading\/60 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 60%, transparent); } - -body { - min-height: 100vh; - margin: 0; - background: - radial-gradient(circle at top left, rgba(var(--color-accent-rgb, 201, 130, 95), 0.1), transparent 36rem), - var(--color-bg, #faf8f5); -} - -h1, -h2, -h3, -h4 { - font-family: 'Playfair Display', Georgia, serif; - color: var(--fg-heading, #2c2c2c); -} - -.prose-wellness p { - margin: 0.75rem 0; - line-height: 1.8; -} - -.prose-wellness h2 { - margin: 1.25rem 0 0.5rem; - font-size: clamp(2rem, 4vw, 3.25rem); - line-height: 1.05; -} - -.prose-wellness h3 { - margin: 1rem 0 0.5rem; - font-size: 1.6rem; -} - -.prose-wellness ul { - list-style: disc; - padding-left: 1.5rem; -} - -.prose-wellness a { - color: color-mix(in srgb, var(--color-primary, #8a9a7b) 90%, #000); - text-decoration: underline; - text-underline-offset: 3px; -} - -/* ── Scroll-reveal animations ── */ -.reveal { - opacity: 0; - transform: translateY(30px); - transition: - opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), - transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1); -} - -.reveal-visible { - opacity: 1; - transform: translateY(0); -} - -/* ── Hero fade-in stagger ── */ -.animate-fade-in { - opacity: 0; - transform: translateY(20px); - animation: fadeInUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; -} - -@keyframes fadeInUp { - to { - opacity: 1; - transform: translateY(0); - } -} - -/* ── Smooth scroll ── */ -html { - scroll-behavior: smooth; -} +@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap'); +@import 'tailwindcss'; +@plugin 'daisyui' { + themes: light --default; +} + +/* Admin UI theme: DaisyUI light with a fixed sage primary. Deliberately NOT + tied to the site's Globals → Colors (those only apply inside /preview), so + a light brand colour can't make admin buttons unreadable. #647556 on white + text is ~5:1 contrast (WCAG AA). */ +@plugin 'daisyui/theme' { + name: 'light'; + default: true; + --color-primary: #647556; + --color-primary-content: #ffffff; +} + +/* Hint text under form fields: DaisyUI's .label is nowrap, which stretched + fields to fit long hints. */ +.fieldset .label { + white-space: normal; +} + +@theme { + --font-sans: 'DM Sans', ui-sans-serif, system-ui, sans-serif; + --font-serif: 'Playfair Display', Georgia, serif; + --color-warm: var(--color-bg, #faf8f5); + --color-charcoal: var(--color-heading, #2c2c2c); + --color-sage: var(--color-primary, #8a9a7b); + --color-sage-dark: color-mix(in srgb, var(--color-primary, #8a9a7b) 80%, #000); + --color-terracotta: var(--color-accent, #c9825f); +} + +@keyframes shrink { + from { scale: 0 1; } + to { scale: 1 1; } +} + +.delete-fill { + position: absolute; + inset: 0; + background: transparent; + transform-origin: left; +} + +.delete-fill.animating { + animation: shrink 1s ease-in-out forwards; + background: var(--error, #f43f5e); +} + +.btn.delete-holding { + color: white !important; +} + +.btn.delete-holding .text-error { + color: white !important; +} + +:root { + --fg-heading: var(--color-heading, #2c2c2c); + --fg-subheading: var(--color-subheading, #4a4a4a); + --fg-body: var(--color-text, #2c2c2c); + background: var(--color-bg, #faf8f5); + color: var(--fg-body); + font-family: 'DM Sans', ui-sans-serif, system-ui, sans-serif; +} + +/* ── Foreground colour utilities (set per-block via BackgroundWrapper) ── */ +.text-fg-body { color: var(--fg-body, #2c2c2c); } +.text-fg-body\/85 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 85%, transparent); } +.text-fg-body\/80 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 80%, transparent); } +.text-fg-body\/75 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 75%, transparent); } +.text-fg-body\/70 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 70%, transparent); } +.text-fg-body\/60 { color: color-mix(in srgb, var(--fg-body, #2c2c2c) 60%, transparent); } +.text-fg-heading { color: var(--fg-heading, #2c2c2c); } +.text-fg-subheading { color: var(--fg-subheading, #4a4a4a); } +.text-fg-subheading\/85 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 85%, transparent); } +.text-fg-subheading\/80 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 80%, transparent); } +.text-fg-subheading\/75 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 75%, transparent); } +.text-fg-subheading\/70 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 70%, transparent); } +.text-fg-subheading\/60 { color: color-mix(in srgb, var(--fg-subheading, #4a4a4a) 60%, transparent); } + +body { + min-height: 100vh; + margin: 0; + background: + radial-gradient(circle at top left, rgba(var(--color-accent-rgb, 201, 130, 95), 0.1), transparent 36rem), + var(--color-bg, #faf8f5); +} + +h1, +h2, +h3, +h4 { + font-family: 'Playfair Display', Georgia, serif; + color: var(--fg-heading, #2c2c2c); +} + +.prose-wellness p { + margin: 0.75rem 0; + line-height: 1.8; +} + +.prose-wellness h2 { + margin: 1.25rem 0 0.5rem; + font-size: clamp(2rem, 4vw, 3.25rem); + line-height: 1.05; +} + +.prose-wellness h3 { + margin: 1rem 0 0.5rem; + font-size: 1.6rem; +} + +.prose-wellness ul { + list-style: disc; + padding-left: 1.5rem; +} + +.prose-wellness a { + color: color-mix(in srgb, var(--color-primary, #8a9a7b) 90%, #000); + text-decoration: underline; + text-underline-offset: 3px; +} + +/* ── Scroll-reveal animations ── */ +.reveal { + opacity: 0; + transform: translateY(30px); + transition: + opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), + transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1); +} + +.reveal-visible { + opacity: 1; + transform: translateY(0); +} + +/* ── Hero fade-in stagger ── */ +.animate-fade-in { + opacity: 0; + transform: translateY(20px); + animation: fadeInUp 0.8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards; +} + +@keyframes fadeInUp { + to { + opacity: 1; + transform: translateY(0); + } +} + +/* ── Smooth scroll ── */ +html { + scroll-behavior: smooth; +} diff --git a/app-admin/src/lib/admin/Modal.svelte b/app-admin/src/lib/admin/Modal.svelte new file mode 100644 index 0000000..ab0bbac --- /dev/null +++ b/app-admin/src/lib/admin/Modal.svelte @@ -0,0 +1,33 @@ + + + (open = false)}> +
+
+

{title}

+ +
+ {#if open} + {@render children()} + {/if} +
+
diff --git a/app-admin/src/lib/admin/confirm.ts b/app-admin/src/lib/admin/confirm.ts new file mode 100644 index 0000000..1a10435 --- /dev/null +++ b/app-admin/src/lib/admin/confirm.ts @@ -0,0 +1,13 @@ +/** + * `onsubmit` / `onclick` handler that asks for confirmation and cancels the + * submit if declined. (Returning `false` from a handler does NOT cancel the + * event — it has to call preventDefault.) + * + *
+ * - - {/each} - - {:else if block.type === 'hero'} - - - - - {:else if block.type === 'button'} -
- - -
- updateData({ variant: v })} - /> -
-
- updateData({ alignment: v })} - formatLabel={titleCase} - /> -
-
- updateData({ size: v })} - formatLabel={(v) => String({ xs: 'Extra Small', sm: 'Small', md: 'Medium', lg: 'Large' }[String(v)] || v)} - /> -
-
-
- Color -
- updateData({ color: e.currentTarget.value })} /> - updateData({ color: e.currentTarget.value })} /> -
-
-
-
- {:else if block.type === 'spacer'} -
- -
- {:else if block.type === 'testimonials'} -
- - - {#each block.data.items || [] as item, i} -
- - updateArray('items', i, { title: e.currentTarget.value })} - /> - -
- {/each} - -
- {:else if block.type === 'upcoming_calendar'} -
- - -
-
-

Category filters

-

Choose categories to show in this block. Leave all unchecked to show every published event.

-
- {#if eventCategories?.length} -
- {#each eventCategories as category} - - {/each} -
- {:else} -

No event categories exist yet. Create events in the Calendar admin page first.

- {/if} -
-
- {:else if block.type === 'shop'} - - {:else if block.type === 'checkout'} - - {/if} - -
- - -
- updateData({ _background: { ...(block.data._background || {}), type: v } })} - /> -
- - {#if block.data._background?.type === 'color'} -
- -
- {/if} - - {#if block.data._background?.type === 'image'} -
- updateData({ _background: { ...(block.data._background || {}), imageUrl: image.url, imageAlt: image.alt } })} /> - - updateData({ _background: { ...(block.data._background || {}), attachment: v } })} - /> - - updateData({ _background: { ...(block.data._background || {}), overlay: true, overlayOpacity: v } })} - formatLabel={(v) => `${v}%`} - /> -
- {/if} - -
- - updateData({ _foreground: { ...(block.data._foreground || {}), mode: v } })} - /> - - {#if block.data._foreground?.mode === 'custom'} -
-
-
- Heading -
- updateData({ _foreground: { ...(block.data._foreground || {}), headingColor: e.currentTarget.value } })} /> - updateData({ _foreground: { ...(block.data._foreground || {}), headingColor: e.currentTarget.value } })} /> -
-
-
-
-
- Sub heading -
- updateData({ _foreground: { ...(block.data._foreground || {}), subheadingColor: e.currentTarget.value } })} /> - updateData({ _foreground: { ...(block.data._foreground || {}), subheadingColor: e.currentTarget.value } })} /> -
-
-
-
-
- Text -
- updateData({ _foreground: { ...(block.data._foreground || {}), textColor: e.currentTarget.value } })} /> - updateData({ _foreground: { ...(block.data._foreground || {}), textColor: e.currentTarget.value } })} /> -
-
-
-
- {/if} -
- -{/if} + + +{#snippet field(label: string, value: string, onInput: (value: string) => void, placeholder = '')} + +{/snippet} + +{#if !block} +
Select a block to edit.
+{:else} +
+

{blockLabels[block.type as BlockType]}

+ + {#if block.type === 'text'} + updateData({ content })} /> + {:else if block.type === 'image_text'} +
+ updateData(image)} /> + updateData({ imagePosition: v })} /> + updateData({ content })} /> +
+ {:else if block.type === 'timeline'} +
+ {#each block.data.items || [] as item, i} +
+
+ Item {i + 1} + +
+ updateArray('items', i, { title: e.currentTarget.value })} /> + +
+ {/each} + +
+ {:else if block.type === 'hero'} + {@render field('Heading', block.data.heading || '', (heading) => updateData({ heading }))} + {@render field('Subheading', block.data.subheading || '', (subheading) => updateData({ subheading }))} +
+ {@render field('Button label', block.data.buttonLabel || '', (buttonLabel) => updateData({ buttonLabel }))} + {@render field('Button URL', block.data.buttonUrl || '', (buttonUrl) => updateData({ buttonUrl }), '/page or https://…')} +
+ {:else if block.type === 'button'} +
+ {@render field('Button label', block.data.label || '', (label) => updateData({ label }))} + {@render field('URL', block.data.href || '', (href) => updateData({ href }), '/page or https://…')} +
+
+ updateData({ variant: v })} /> + updateData({ alignment: v })} /> + updateData({ size: v })} formatLabel={(v) => sizeLabels[String(v)] || String(v)} /> + updateData({ color })} /> +
+ {:else if block.type === 'spacer'} + + {:else if block.type === 'testimonials'} + {@render field('Section title', block.data.title || '', (title) => updateData({ title }))} +
+ {#each block.data.items || [] as item, i} +
+
+ Testimonial {i + 1} + +
+ + updateArray('items', i, { title: e.currentTarget.value })} /> +
+ {/each} + +
+ {:else if block.type === 'upcoming_calendar'} + {@render field('Section title', block.data.title || '', (title) => updateData({ title }))} +
+

Category filters

+

Choose categories to show in this block. Leave all unselected to show every published event.

+ {#if eventCategories?.length} +
+ {#each eventCategories as category} + + {/each} +
+ {:else} +

No event categories exist yet. Add categories to events in Calendar first.

+ {/if} +
+ {:else if block.type === 'shop'} + + {:else if block.type === 'checkout'} + + {/if} + +
+ updateBackground({ type })} /> + + {#if block.data._background?.type === 'color'} + updateBackground({ color })} /> + {:else if block.data._background?.type === 'image'} + updateBackground({ imageUrl: image.url, imageAlt: image.alt })} /> + updateBackground({ attachment })} /> + updateBackground({ overlay: Number(v) > 0, overlayOpacity: Number(v) })} + formatLabel={(v) => (Number(v) === 0 ? 'None' : `${v}%`)} + /> + {/if} + +
+ + updateForeground({ mode })} /> + + {#if block.data._foreground?.mode === 'custom'} + updateForeground({ headingColor })} /> + updateForeground({ subheadingColor })} /> + updateForeground({ textColor })} /> + {/if} +
+
+{/if} diff --git a/app-admin/src/lib/admin/editors/CheckoutBlockEditor.svelte b/app-admin/src/lib/admin/editors/CheckoutBlockEditor.svelte index 5ecd756..a5874d1 100644 --- a/app-admin/src/lib/admin/editors/CheckoutBlockEditor.svelte +++ b/app-admin/src/lib/admin/editors/CheckoutBlockEditor.svelte @@ -15,17 +15,17 @@
-
diff --git a/app-admin/src/lib/admin/editors/ColorField.svelte b/app-admin/src/lib/admin/editors/ColorField.svelte new file mode 100644 index 0000000..c25f331 --- /dev/null +++ b/app-admin/src/lib/admin/editors/ColorField.svelte @@ -0,0 +1,37 @@ + + +
+ {label} +
+ onChange(e.currentTarget.value)} + /> + onChange(e.currentTarget.value.trim())} /> + {#if value} + + {/if} +
+
diff --git a/app-admin/src/lib/admin/editors/EmailBlockEditor.svelte b/app-admin/src/lib/admin/editors/EmailBlockEditor.svelte index 1b5a424..f01520e 100644 --- a/app-admin/src/lib/admin/editors/EmailBlockEditor.svelte +++ b/app-admin/src/lib/admin/editors/EmailBlockEditor.svelte @@ -4,6 +4,7 @@ import RichTextEditor from './RichTextEditor.svelte'; import ImageUploader from './ImageUploader.svelte'; import SegmentedControl from './SegmentedControl.svelte'; + import ColorField from './ColorField.svelte'; let { block, primaryColor = '#8a9a7b', onChange = (block: EmailBlock) => {} } = $props<{ block: EmailBlock | null; @@ -17,11 +18,6 @@ onChange(block); } - function titleCase(value: string | number) { - const text = String(value); - return text.charAt(0).toUpperCase() + text.slice(1); - } - const autoFilled: Record = { booking_details: 'Filled in automatically with the booked services, date and time, prices and the total paid.', customer_details: "Filled in automatically with the customer's name, email, phone and checkout notes.", @@ -42,46 +38,38 @@
updateData(image)} /> updateData({ width: v })} formatLabel={(v) => `${v}%`} /> - updateData({ alignment: v })} formatLabel={titleCase} /> -
{:else if block.type === 'button'}
-
{:else if block.type === 'spacer'} -