Info Panel Design
Goal
Replace WeatherTextComponent with a combined InfoPanelComponent that displays location, coordinates/timezone, and weather info inside the live-window shadow DOM. Use static white text instead of the current dynamic WCAG-contrast color.
Current State
WeatherTextComponentrenders weather text below the window with dynamic neon color- Location info (city name, lat/lng, timezone) is rendered externally by the host page
- The component has no knowledge of city name — only uses lat/lng/timezone internally
Design
New InfoPanelComponent
Replaces WeatherTextComponent. Renders three sections below the window:
- City name — from
labelattribute (if provided), else from weather APIdata.name, else hidden - Coordinates + timezone —
40.71°, -74.01° · America/New_York - Weather text —
29°F · few clouds(static white, no glow)
Data Flow
labelattribute: optional, observed. Overrides API-derived city name- Weather API (
/data/2.5/weather): already returnsdata.name(city name) — store it inStoreState.location.name - Lat/lng: read from
state.store.location - Timezone: read from
state.attrs.timezone
Styling
- Static white color (
--info-text-color: #ffffffdefault) - No dynamic WCAG contrast calculation
- No neon glow text-shadow
- Remove
getReadableColorimport from this component - CSS classes:
.info-panel,.info-panel-location,.info-panel-coords,.info-panel-weather
Type Changes
- Add
name: string | nulltoStoreState.location - Add
label: string | nulltoLiveWindowState.attrs
API Changes
fetchWeather: extractdata.nameintostate.location.namefetchLocation(IP registry): extract city name if available fromdata.location.city- New observed attribute:
label
Files Changed
| File | Change |
|---|---|
components/WeatherTextComponent.ts | Delete |
components/InfoPanelComponent.ts | Create (replacement) |
LiveWindow.ts | Swap component, add label to observed attrs |
types.ts | Add name to location, label to attrs |
api.ts | Extract data.name from weather response, city from IP response |
state.ts | Add name: null to DEFAULT_STATE location |
live-window.css | Replace .current-weather-text with .info-panel styles |
__tests__/components/WeatherTextComponent.test.ts | Delete |
__tests__/components/InfoPanelComponent.test.ts | Create (replacement) |
live-window-test.astro | Remove external location display (now inside component) |