diff --git a/frontend/src/routes/quote/+page.svelte b/frontend/src/routes/quote/+page.svelte index 119f75f..19be600 100644 --- a/frontend/src/routes/quote/+page.svelte +++ b/frontend/src/routes/quote/+page.svelte @@ -6,6 +6,32 @@ let q = $state(null); let state = $state('loading'); + const MONTHS = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']; + let seal = $derived.by(() => { + if (!q?.date) return null; + const [, m, d] = q.date.split('-').map(Number); + return MONTHS[m - 1] ? { mon: MONTHS[m - 1], day: d } : null; + }); + + let copied = $state(false); + async function copyQuote() { + const attr = q?.author ? ` — ${q.author}${q.work ? ', ' + q.work : ''}` : ''; + try { + await navigator.clipboard.writeText(`“${q.text}”${attr}`); + copied = true; setTimeout(() => (copied = false), 1800); + } catch { /* no clipboard — silent */ } + } + + let shared = $state(false); + async function share() { + const url = location.href; + try { + if (navigator.share) { await navigator.share({ title: 'Quote of the Day · upbeatBytes', text: `“${q.text}”`, url }); return; } + await navigator.clipboard.writeText(url); + shared = true; setTimeout(() => (shared = false), 1800); + } catch { /* cancelled / unsupported */ } + } + onMount(async () => { try { q = await getJSON('/api/quote/today'); @@ -24,22 +50,52 @@
{#if state === 'ready'} -

Quote of the day

-
- -

{q.text}

-
- - {q.author}{#if q.work}, {q.work}{/if} -
-
+ +
+ {#if seal} + + {/if} +
+ - {#if q.meaning} -
-

What it means

-

{q.meaning}

-
- {/if} +
+ + Quote of the Day +
+ +

{q.text}

+ + {#if q.author} +
+ + {q.author}{#if q.work}, {q.work}{/if} +
+ {/if} + + {#if q.meaning} +
+
+ + What it means +
+

{q.meaning}

+ {/if} + +
+ + +
+
+
{:else if state === 'empty'}

Today's quote is on its way. Check back soon.

{:else} @@ -49,35 +105,73 @@ diff --git a/frontend/static/fonts/CREDITS.txt b/frontend/static/fonts/CREDITS.txt index e8ba7ac..3bf1e5b 100644 --- a/frontend/static/fonts/CREDITS.txt +++ b/frontend/static/fonts/CREDITS.txt @@ -9,3 +9,5 @@ License: SIL Open Font License 1.1. All self-hosted (no Google hotlink) for the Work Sans — Wei Huang, OFL 1.1 (Google Fonts). Latin subset, variable 400–700. Space Mono — Colophon Foundry, OFL 1.1 (Google Fonts). Latin subset, 400. + +Playfair Display — Claus Eggers Sørensen, OFL 1.1 (Google Fonts). Latin subset, var 500–700 + italic. (QOTD) diff --git a/frontend/static/fonts/playfair-italic-var.woff2 b/frontend/static/fonts/playfair-italic-var.woff2 new file mode 100644 index 0000000..78abff9 Binary files /dev/null and b/frontend/static/fonts/playfair-italic-var.woff2 differ diff --git a/frontend/static/fonts/playfair-var.woff2 b/frontend/static/fonts/playfair-var.woff2 new file mode 100644 index 0000000..a85e8f8 Binary files /dev/null and b/frontend/static/fonts/playfair-var.woff2 differ