Homepage implementation

The homepage presents one content tree through two layouts. Its scene, dock, preferences, and content remain mounted when the presentation changes.

The homepage presents one content tree through two layouts. Its scene, dock, preferences, and content remain mounted when the presentation changes.

Layout responsibilities

src/components/home/HomePage.tsx owns the section order: introduction, projects, client work, notes, photos, and contact. The CSS module applies the selected layout through data-home-layout on the page root.

LayoutDesktop presentationSmall screens
Two columnsSticky introduction on the left, sections on the right, scene behind bothStacked arrangement
HeroIntroduction inside a centered scene card, sections beneathCentered card with responsive spacing

Two columns is the default when no saved preference exists. A valid saved Hero preference still takes precedence. The top navigation and bottom dock remain centered. Layout variants reuse the content tree so switching does not duplicate sections, restart the artwork, or create independent copies of page state.

Preference storage

src/hooks/use-home-layout.ts exposes the current layout and whether the picker is open through useSyncExternalStore. It restores a validated layout from the home-layout storage key and synchronizes changes from other browser tabs. Only the layout choice is persisted; panel visibility is temporary UI state.

If storage is unavailable, the selection continues to work in memory and the store reports the failure. Invalid or removed values fall back to the default.

Keyboard and panel behavior

LayoutDockButton uses native radio inputs with explicit arrow-key handling. Arrow keys move focus between options; Enter applies the focused option. Mouse and touch selection apply immediately. Selecting the current option also closes the panel. Escape closes without changing the preference.

The scene and layout panels coordinate their open state so opening one dismisses the other. DockPanel retains an exiting panel long enough to fade and move it toward the dock, while making that surface inert and hidden from assistive technology. restoreFocusWithoutTooltip returns keyboard focus without leaving an unrelated tooltip over the page.

The command palette exposes the picker and direct layout actions. The desktop shortcut is Cmd/Ctrl+Shift+L. The visible picker button is specific to the homepage; commands can navigate home before applying a layout.

Scene rendering

SceneBackground positions the scene and applies the background fades needed for readable text. In Two columns, the artwork fills the viewport behind the columns. The eased gradient protects the text areas while leaving the open center visible in both themes.

SceneSurface loads the selected native scene and waits until it has produced a frame before crossfading. Keeping the previous surface during loading avoids flashing an empty background. A layout change keeps the existing canvas and changes its presentation instead of remounting the renderer.

The native shader's backing resolution stays near an 8.3-million-pixel budget, including on 4K, 5K, and ultrawide displays. vendor/asciicn/pixel-ratio.ts caps pixel density by scene area, independently of the CSS glyph size and framing. Whole-cell rounding can add a small amount above the budget. Large displays may have softer glyph edges, while smaller scenes retain their native density up to 3×. The vendor build applies this patch to the pinned upstream shader and fails if its calculation changes. Rebuild the runtime with the command in vendor/asciicn/README.md; do not edit generated bundles directly.

Scene settings live in src/lib/home/scene-settings.ts and are managed by use-scene-store.ts. Defaults include 24 FPS, normal speed, automatic rotation, and a visible glyph trail. The controls expose character density, frame rate, color treatment, positioning, zoom, pause, and visibility.

Glyph trail

GlyphTrail adapts the native pointer-driven effect. It uses accent and shadow colors selected for the active scene, with deeper pigment on light backgrounds. The trail is enabled only for a fine desktop pointer without a reduced-motion preference. It does not add an idle animation or intercept pointer input.

Motion timing

When entering Two columns, both content columns use the same fade-and-rise timing. The scene fades in as it expands, while the navigation and dock enter in their established directions. Motion applies to the content surface rather than the scene's containing layout, preserving the full-viewport artwork.

Reduced-motion preferences disable entrance animation and smooth scrolling. Do not use motion as the only indication of a selected layout: checked state, labels, keyboard focus, and the visible content arrangement remain available.

Source map

FileResponsibility
src/lib/home/home-layouts.tsTyped layout options and descriptions
src/hooks/use-home-layout.tsPreference validation, persistence and panel state
src/components/home/HomePage.module.cssLayout widths, stacking and column entrances
src/components/home/SceneBackground.module.cssScene placement and theme-aware edge blending
src/components/home/SceneSurface.tsxReady-frame scene loading and crossfades
src/components/ui/DockPanel.tsxShared panel entrance and exit motion
src/lib/home/scene-trail-colors.tsScene-specific glyph-trail palettes

Verify a change

Test a fresh browser and one with a saved preference. Check Hero and Two columns, a narrow mobile viewport, a wide desktop viewport, and reduced motion. Use the keyboard to move focus without selecting, apply with Enter, dismiss with Escape, and reopen from the dock and command palette. Confirm the scene stays visible and the canvas is not recreated merely because the layout changed. At high resolutions, inspect the canvas backing dimensions as well as its CSS size: at a 3840×2160 viewport and 2× device density, the backing canvas should be about 3840×2160 rather than 7680×4320. Check scene switching and resizing back to a smaller viewport, including Braille and quadrant character sets.

Live ASCII weather

SceneSettings.weather defaults to false and is persisted by the existing home-scene-settings store. SceneBackground calls useWeather only when weather mode and scene visibility are enabled, and replaces SceneSurface with WeatherScene after validated current conditions arrive. The manual selection is preserved. Scene rotation is suspended during weather mode, and the glyph trail is hidden while weather is rendered.

GET /api/weather fetches Open-Meteo current conditions at 41.01814, -75.99493 (Drums, PA), with Fahrenheit, mph and America/New_York. It needs no API key. Provider requests and successful public responses are cached for 900 seconds; errors return 503 with no-store. WMO codes map to clear, cloudy, fog, rain, snow and storm conditions. Missing fields, unknown codes and observations older than two hours or more than fifteen minutes in the future are rejected.

useWeather refreshes every fifteen minutes, skips hidden tabs, refreshes overdue conditions when the tab becomes visible, and aborts pending requests on opt-out. Requests have timeouts. Accepted observations expire at the two-hour limit, including when a sleeping tab resumes. Invalid responses and errors remove the weather surface, restore normal artwork and expose retry status in Scene Studio.

weather-art.ts defines a procedural sky shader inspired by leo.here's weather effect: domain-warped cloud noise, broad sunlight, wind-driven rain, snow and twinkling night stars. WeatherScene feeds this field into the existing MIT-licensed asciicn AsciiShader engine with Bayer dithering and 17 tone levels. The original weather glyphs therefore use the same measured atlas, Braille and quadrant sub-sampling, tone grading, animation lifecycle and backing-resolution budget as the regular scenes. The engine handles pause, reduced motion, hidden tabs and resize cleanup. The weather surface shares the surrounding framing filters and theme fades; storms avoid flashing effects.

vendor/asciicn/build.mjs generates a stable runtime/shader.js entry point by locating the shared engine export. It fails if that export disappears. No generated engine implementation is edited. See vendor/asciicn/README.md for provenance.

WeatherReadout displays Drums, temperature, conditions, and a clock formatted with America/New_York. It updates every thirty seconds and on tab visibility changes. SceneBackground renders it outside the decorative aria-hidden backdrop so assistive technology can read it. It sits at the top-left of the hero card and above the portrait in the desktop two-column layout, wrapping on narrow screens. It is shown only while weather mode and scene visibility are enabled.

The weather renderer watches the engine’s readiness state. If it stays in fallback for two seconds or loses graphics context, it displays the selected regular scene and reports failure in Scene Studio. Ready or restored contexts clear the failure. The observer and timeout are cleaned up on unmount.

Light mode uses dedicated muted blue, slate and violet ink palettes on warm light paper, rather than reversing the dark palette. Sky tones progress from soft but visible ink to darker precipitation and star details. Dark-mode palettes and weather behavior remain unchanged. The weather-art tests check contrast against light paper and the progression between ink stops for every condition.