hero-feature #4
Reference in New Issue
Block a user
No description provided.
Delete Branch "hero-feature"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hero Canvas Editor (v1)
Summary
This PR introduces a complete WYSIWYG hero canvas editor for the portal, allowing administrators to visually build, preview, draft, and publish hero layouts without modifying code.
The implementation was completed in four phases, culminating in a full-featured editor with drag-and-drop editing, resizing, snap grids, image uploads, live preview, and a faithful scaled representation of the production hero.
Highlights
Layout-driven hero rendering
hero_layoutconfigurationHeroElementhero_layout_draftadmin-only while exposing only published layouts publiclyShared rendering architecture
heroLayoututilities used by both the portal and editorNew Hero Editor (
/admin/hero)/?preview=1Visual editing
Supported element types
Each element includes dedicated editing controls.
Resize support
Corner resize handles
Scale-aware resizing
Element-specific resize behavior:
Snap grid
Faithful editing canvas
Addresses feedback that the original editor was too cramped.
Changes include:
Real hero moon
Replaces the generated CSS moon with the actual moon artwork extracted from the hero image.
Adds:
Technical Details
New Components
HeroEditorHeroElementNew Shared Utilities
heroLayout.jsPortal Changes
Admin Changes
/admin/herorouteSettings
hero_layoutto public settingshero_layout_draftremains admin-onlyVerification
Verified end-to-end:
Notes
HERO_EDITOR.md.Second phase of the hero canvas editor (see HERO_EDITOR.md). - new lib/heroLayout.js: shared defaultLayout/buildOverlay/heroBackground/ parseLayout used by both the portal and the editor (Portal refactored onto it) - new admin view HeroEditor.jsx at /admin/hero (+ sidebar nav + route): - live canvas preview (16:9) rendering the draft via HeroElement - background panel: image upload (/admin/uploads, >1MB warning), 3x3 position grid, overlay opacity slider — all update the canvas in real time - debounced (800ms) auto-save to hero_layout_draft - Publish (writes hero_layout + draft), Preview (opens /?preview=1), Revert - Portal: ?preview=1 renders the draft via the admin settings endpoint, with a "showing unpublished draft" banner; normal load renders the published layout No schema/dep changes. Verified end to end: overlay/position update the canvas, auto-save writes the draft, publish updates the live portal, preview shows the draft while the public page shows live. Element drag/properties land in Phase 3. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>Third phase of the hero canvas editor (see HERO_EDITOR.md). - HeroElement: editor mode — inner content made non-interactive so the wrapper handles select/drag; selection outline; box width now canvas-relative (calc(100% - 36px)) so text blocks fit the smaller editor canvas - HeroEditor: element tray (+ Text / + Buttons), click-to-select, native Pointer Events drag (position as % of the canvas, clamped), Delete key + panel delete, z-order (send back / bring forward), and per-type property panels: - text_block: per-line text / tag / font size (px) / color / bold, add+remove lines, alignment - buttons: per-item label / path / variant, add+remove, alignment empty-canvas click deselects (back to the background panel) - theme.css: .hero-el-editable outline/hover/selected + grid helper Verified in-browser: selecting shows the line editor, editing updates the canvas live, drag repositions, add/delete and z-order work, deselect returns to the background panel; no console errors. Moon/badge/image + resize + snap are Phase 4. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>The moon needs to be replaced but othewise itis good.