From 6ab3e47d38c0d2104fc0558cc7552194a63d62fa Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Jul 2026 23:38:03 -0500 Subject: [PATCH] Make the hero Moon image configurable via props.src MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Moon stays a dedicated, first-class hero element — only its image source becomes configurable. Adds optional src/alt props alongside the existing size/glow. - HeroElement: the moon renders props.src when present, else falls back to the default /assets/img/hero-moon.png. Size, glow, and animation are unchanged. alt is now props.alt (default '', same as before). - HeroEditor MoonPanel: adds an image upload (reusing the existing shared api.admin.upload workflow, same as the image/background panels) that sets props.src, an alt-text field, and a "Use default" reset. Size/glow controls unchanged. Fully backwards compatible: existing layouts with only size/glow and no src render exactly as today via the fallback. No DB, API, or hero-JSON changes; no migration. --- client/src/components/HeroElement.jsx | 11 +++--- client/src/routes/admin/views/HeroEditor.jsx | 38 +++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/client/src/components/HeroElement.jsx b/client/src/components/HeroElement.jsx index 7d12d8d..fd3efb0 100644 --- a/client/src/components/HeroElement.jsx +++ b/client/src/components/HeroElement.jsx @@ -107,12 +107,15 @@ function content(element) { case 'buttons': return case 'moon': { - const size = element.props?.size || 96 - const glow = element.props?.glow ?? 0.45 + const props = element.props || {} + const size = props.size || 96 + const glow = props.glow ?? 0.45 + // Image source is configurable; old layouts with no src fall back to the + // default hero moon so they render exactly as before. Size/glow unchanged. return ( 1024 * 1024 && !confirm('This image is over 1 MB and may slow the page. Upload anyway?')) return + setUp(true) + try { + const { url } = await api.admin.upload(f) + onProps({ src: url }) + } catch { + /* ignore */ + } finally { + setUp(false) + } + } return (
-

Uses the moon from the hero artwork.

+
+ Moon image + {p.src ? ( + + ) : ( +

Using the default moon from the hero artwork.

+ )} + + {p.src && ( + onProps({ src: '' })}>Use default + )} +
+