Hero Phase 1: layout data path + portal renderer

First phase of the hero canvas editor (see HERO_EDITOR.md).

- settings.model: add hero_layout to PUBLIC_KEYS so the portal receives it
  (corrects the design doc — public settings is a whitelist, not getAll();
  hero_layout_draft stays admin-only)
- new HeroElement.jsx: renders one layout element by type (text_block,
  buttons, moon, badge, image); absolute % positioning with anchor; shared
  by the portal now and the editor canvas later
- MoonDot: optional color override for the hero moon element
- Portal.jsx: parse hero_layout (version-checked, try/catch), render elements
  sorted by z; fall back to a DEFAULT_LAYOUT built from the current hero so the
  page is byte-for-byte unchanged until staff publish their own

No schema change. Verified: default render matches the old hero; publishing a
hero_layout re-renders the portal; the draft key is not exposed publicly; client
builds; no console errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 02:18:09 -05:00
parent 30c2a30c80
commit 578bffc51f
4 changed files with 234 additions and 38 deletions

View File

@@ -1,9 +1,8 @@
// The little glowing moon used in the logo, login, and maintenance screens.
export default function MoonDot({ size = 13, glow = 0.45 }) {
return (
<span
className="moon"
style={{ width: size, height: size, boxShadow: `0 0 ${size * 0.8}px rgba(216,226,239,${glow})` }}
/>
)
// The little glowing moon used in the logo, login, maintenance screens, and the
// hero canvas. `color` overrides the radial-gradient start point (else the CSS
// .moon default is used).
export default function MoonDot({ size = 13, glow = 0.45, color }) {
const style = { width: size, height: size, boxShadow: `0 0 ${size * 0.8}px rgba(216,226,239,${glow})` }
if (color) style.background = `radial-gradient(circle at 35% 30%, ${color}, #9fb0c6 55%, #5d6e88)`
return <span className="moon" style={style} />
}