feat: ui ux #2
No files matched your search
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
version: 1
|
||||||
|
slug: "cool"
|
||||||
|
primary_target: "cool"
|
||||||
|
related_targets: ["/cool/stage", "/cool/city", "/plan"]
|
||||||
|
---
|
||||||
|
|
||||||
|
# Surface brief — Cool City decision demo
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Primary: `/cool` (public, person-first route decision). Related: `/cool/stage` (projector keynote), `/cool/city` (cooling-gap module), `/plan` (retail module, linked only).
|
||||||
|
|
||||||
|
## Audience and job
|
||||||
|
|
||||||
|
Ruth, 78, lives alone — a composite, not a real person. She needs bread from Marktplatz on a hot day. The phone answers which way now; the stage tells the room the same story. The audience votes; the model recommends **Accessible for Ruth**.
|
||||||
|
|
||||||
|
## Success
|
||||||
|
|
||||||
|
- `/cool` is minimal: Ruth card, time slider, three route cards with shade and direct-sun minutes, vote buttons. No map dashboard, sensor table, weather card or methodology paragraphs.
|
||||||
|
- `/cool?vote=1` is only the question and three buttons. No map, no PII.
|
||||||
|
- `/cool/stage` is a keynote: Ruth card → Cool places → Data honesty → Find routes → 10:00→16:00 → Start vote → Lock vote → City view → Retail module → close. Quiet presenter controls, exact labels.
|
||||||
|
- The key insight is visible: the shaded route is 732 m / 9.8 min, 50.0% shade but 4.9 direct-sun min versus the shortest 359 m / 4.8 min, 43.8% shade, 2.7 min, with a 15% ramp. The accessible route is 438 m / 5.8 min, 43.8% shade, 3.3 min, no ramp, water and benches.
|
||||||
|
- Real route/city JSON only; missing values are hidden or TBD.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
Real data: `public/cool-city/route.json` (normalised from `shade.json`, `routes.geojson`, `places.json`) and `public/cool-city/city-gap.json`. No retail numbers on Cool City. Onyx stays, themed with the system UI stack. Shared time/phase state is in-memory Nitro; vote per round. No PII. Keep SSR, accessibility, reduced motion, build/tests.
|
||||||
|
|
||||||
|
## Direction contract
|
||||||
|
|
||||||
|
THESIS: A live demo, not a dashboard. One decision: which way should Ruth go now? Apple-like clarity — less information, more confidence — with the map as stage content and a minimal phone flow.
|
||||||
|
|
||||||
|
OWN-WORLD: Warm off-white `#F6F3EE`, near-black `#121212`, heat `#E4572E`, shade/water `#2F6FED`, system UI stack, tabular numerals, 28 px translucent surfaces, soft shadows, generous 8-point space, subtle state motion. Stage inverts to `#0B1114` with bright heat and shade.
|
||||||
|
|
||||||
|
STORY: Ruth card. The city has cool places but no route. Three routes; at 10:00 the shortest is fine; at 16:00 shade % and direct-sun minutes disagree. The shaded route takes twice as long for 4.9 sun minutes; the shortest has a 15% ramp; the accessible route is one minute longer with no ramp, water and benches. The room votes; the model recommends **Accessible for Ruth**. Close: "The pulse is not the people. But the city still has to protect them."
|
||||||
|
|
||||||
|
FIRST VIEWPORT: `/cool` — Ruth card, time slider, route cards with accessible first. `/cool/stage` — Ruth card first; then the dark route board at `Find routes`, with the exact labels and presenter strip.
|
||||||
|
|
||||||
|
FORM: Pinned by `COOL_CITY_DESIGN.md` and `presentation/cool-city-demo-script.md`; no roll. `seed: none (pinned)` — "The frontend is a live demo, not a dashboard. Less information, more confidence. ... Apple-like clarity, not an Apple skin. ... full-bleed map ... floating bottom sheet ... one typeface, one accent, subtle motion, immaculate finish."
|
||||||
|
|
||||||
|
FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance.
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
version: 1
|
||||||
|
slug: "plan"
|
||||||
|
primary_target: "plan"
|
||||||
|
related_targets: ["/", "/live", "/stage"]
|
||||||
|
---
|
||||||
|
|
||||||
|
# Surface brief — decision, stage, phone
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Primary: `/plan` (Operate). Related: `/` (Persuade), `/live` and `/stage` (Experience), with supporting `/forecast`, `/simulate`, `/about`, `/control` to follow in the finish pass.
|
||||||
|
|
||||||
|
## Audience and job
|
||||||
|
|
||||||
|
A Heilbronn duty manager needs the coming week's staffing decision: who works, when, what it costs, and what the trade-off is. A hackathon audience needs the same decision at ten metres on a projector, then in their hand on a phone. The presenter needs to change one scenario and have every surface follow honestly.
|
||||||
|
|
||||||
|
## Success
|
||||||
|
|
||||||
|
- `/plan` answers what to do above the fold: peak shift, staff count, staff-hours, cost vs flat, coverage.
|
||||||
|
- `/live` answers on a 390×844 phone above the fold: shift, staff count, one-line reason, freshness.
|
||||||
|
- `/stage` is readable at 10 m without app chrome.
|
||||||
|
- `/` sets up the story in one screen with the live plan as proof.
|
||||||
|
- Measured, modelled and assumed stay visibly distinct; the real 14–20 Nov window is labelled.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
Live API data only; no fabricated numbers. Preserve routes, API contracts, Onyx components, SSR, accessibility, reduced motion and the existing build/tests. The paper brief's 210 h / €3,360 is stale; the demo baseline is the live sunny-saturday-market plan (5 peak, 172 staff-hours, €2,752 vs €5,600 flat, 100% coverage).
|
||||||
|
|
||||||
|
## Direction contract
|
||||||
|
|
||||||
|
THESIS: A shift board, not a dashboard. The week's footfall becomes a physical timetable with an orange peak block; the category's metric-card hero and admin shell are refused.
|
||||||
|
|
||||||
|
OWN-WORLD: Cool paper `#F4EFE6`, ink `#16130F`, signal orange `#E84100` for the peak (text `#B63A00` on paper), board green `#2E6B4F` for coverage. Archivo variable: condensed 78% display, tabular numerals, heavy rules, zero radius, no shadows. `/stage` and `/live` invert to ink `#0E100E` with paper type and bright orange.
|
||||||
|
|
||||||
|
STORY: The manager reads "Five on Saturday, 10:00–14:00", sees the week board, and understands 172 staff-hours cost €2,752 against €5,600 flat with 100% coverage. They approve or export. The judge sees the same plan on stage and phone; a scenario change redraws the pulse and the blocks.
|
||||||
|
|
||||||
|
FIRST VIEWPORT: `/plan` — h1 "Five on Saturday." with shift time and a receipt of staff-hours/cost/coverage on the left, a full-width seven-day shift board with the orange peak on the right/below, and Approve/Export actions. `/` — headline "Saturday needs five." beside the live board. `/live` — giant 5, Saturday 14 Nov, 10:00–14:00, one-line peak-forecast reason, freshness. `/stage` — full-bleed dark board: 5 staff, day/time, week board, cost line, QR.
|
||||||
|
|
||||||
|
FORM: Shift board / timetable. The user pinned the world and its first-surface experience; no roll was needed. `seed: none (pinned)` — "A — Shift board. Full replacement. Paper/ink ground, signal orange for the peak, heavy timetable rules, tabular numerals, physical time blocks. /stage inverts to a dark board."
|
||||||
|
|
||||||
|
FINISH: unreviewed and undocumented is unfinished; this build ends with the finish review, the verdict, DESIGN.md, and every shipping raster carrying its provenance.
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
# Product
|
||||||
|
|
||||||
|
<!-- impeccable:product-schema 1 -->
|
||||||
|
|
||||||
|
## Platform
|
||||||
|
|
||||||
|
web
|
||||||
|
|
||||||
|
## Users
|
||||||
|
|
||||||
|
**Primary public user:** Ruth, 78, lives alone in Heilbronn. She is a clearly labelled composite persona, not a real person: the stand-in for an older resident who needs bread, a bench, water and shade on a hot day. The product must work on her phone, one-handed, in bright light.
|
||||||
|
|
||||||
|
**Secondary audiences:** the hackathon room watching a projector; a city climate-adaptation team looking for where shade, water and benches are missing; the retailer who pays for the staffing module.
|
||||||
|
|
||||||
|
## Product Purpose
|
||||||
|
|
||||||
|
Cool City is Heilbronn's public heat-safe route. It tells a person how to reach the places they need — cooler, quieter, step-free — at a given hour, and shows the city where shade, water and benches are missing. The retail staffing plan remains a separate commercial module, not the hero.
|
||||||
|
|
||||||
|
## Positioning
|
||||||
|
|
||||||
|
The city publishes almost 60 cool places on a map and an address list. It does not turn them into a time-aware, person-level route. Cool City connects the public cool-place map, modelled shade, OSM access features and the existing footfall/weather stack into three route choices a person can act on: shortest, shaded, accessible. It shows the room's vote next to the model's recommendation. A private dashboard cannot truthfully copy the public framing or the person-level route.
|
||||||
|
|
||||||
|
## Operating Context
|
||||||
|
|
||||||
|
- Heilbronn inner city. Origin Stadtgalerie, destination Marktplatz. Verify route geometry and place names against OSM and the final route bundle before the demo.
|
||||||
|
- Three options: shortest; shaded via the Deutschhof passage / Kiliansplatz; accessible with water, benches and step-free access.
|
||||||
|
- Time stops: 10:00, 12:00, 14:00, 16:00. The recommendation may change with the sun.
|
||||||
|
- Shade is modelled from solar position and building/tree geometry, not measured. Never claim a temperature difference.
|
||||||
|
- Sensors are eight inner-city PAX counters: a relative device index, not people. No city-wide heatmap claim.
|
||||||
|
- Public vote: one vote per random session ID in localStorage; aggregate tally only; no PII, no accounts, no location upload.
|
||||||
|
- The route/shade bundle lives in `cool-city-data/route/`; the cooling-gap bundle in `cool-city-data/city/`. Final JSON is copied to `public/cool-city/`. If a bundle is missing, label TBD and do not invent values.
|
||||||
|
- Do not generalise the commissioned FITNAH PET range to every inner-city street.
|
||||||
|
|
||||||
|
## Capabilities and Constraints
|
||||||
|
|
||||||
|
- Nuxt 4 SSR + Onyx + MapLibre available. Routes: `/cool`, `/cool/stage`, `/cool/city`, plus the existing retail routes.
|
||||||
|
- `/cool` is mobile-first and must also read clearly on a projector. `/cool/stage` is a dark, full-bleed projection surface.
|
||||||
|
- `/cool/city` ranks eight sensor catchments with a relative cooling-gap index and shows the weights and assumptions. No measured temperature map.
|
||||||
|
- Vote backend: in-memory Nitro route, aggregate counts, one vote per random session ID, stage polls every 2 s. No database, no Go change.
|
||||||
|
- Keep `/plan`, `/forecast`, `/simulate`, `/about` working. The retail module is linked, not merged into the Cool City hero.
|
||||||
|
- Preserve SSR, keyboard access, contrast, reduced motion, responsive behaviour, build and tests.
|
||||||
|
|
||||||
|
## Brand Commitments
|
||||||
|
|
||||||
|
- Name: **Cool City** (public product). Built on the PulseCast stack; the retail plan remains PulseCast's staffing module.
|
||||||
|
- Visual world pinned by `COOL_CITY_DESIGN.md`: **a live demo, not a dashboard**. Apple-like clarity: warm off-white ground, near-black ink, heat orange, shade/water blue, one system typeface, generous space, 28 px translucent surfaces and soft shadows, subtle motion. `/cool` is a minimal phone/desktop card flow; `/cool/stage` is a full-bleed dark route board with huge type and quiet presenter controls. The retail module keeps the shift-board identity.
|
||||||
|
- Voice: public, direct, protective, not promotional. Never present Ruth as a real person without consent.
|
||||||
|
|
||||||
|
## Evidence on Hand
|
||||||
|
|
||||||
|
- `COOL_CITY.md` product brief and `Paper/research/cool-city-sources.md` source-checked claims.
|
||||||
|
- RKI estimate: ~16,000 heat-related deaths in Germany in 2026 through KW37 (95% PI 14,400–17,600). Say estimated, not a count; not Heilbronn.
|
||||||
|
- FITNAH-3D commissioned model: citywide PET 16.1–44.5 °C; unshaded sealed street space can exceed 41 °C PET. Do not generalise.
|
||||||
|
- City: almost 60 cool places; map + address list, not a routing or time-aware service. 2021 climate-adaptation concept adopted 2023 with 31 measures; 2025 spatial concept; 2023 heat-health action package. Do not say no heat action plan.
|
||||||
|
- City tree cadastre Jan 2026 (dl-de/by-2.0); OSM (ODbL); Open-Meteo (CC BY 4.0); population by planning district aggregate.
|
||||||
|
- The route/shade and city bundles are pending. Use a clearly labelled TBD placeholder; no fake numbers.
|
||||||
|
|
||||||
|
## Product Principles
|
||||||
|
|
||||||
|
1. Public first. The hero is a person trying to reach a place safely, not a retailer's dashboard.
|
||||||
|
2. The hour matters. A route is not cool in the abstract; it is cool at 14:00 or 16:00.
|
||||||
|
3. Modelled is not measured. Shade coverage and direct-sun minutes are model outputs; say so.
|
||||||
|
4. The room is part of the product. The vote is aggregate, anonymous and shown next to the model.
|
||||||
|
5. The city only sees what the person reveals. The cooling-gap module is a relative planning aid, not a temperature map.
|
||||||
|
6. Keep the retail proof separate. The staffing module is the commercial layer, not the public story.
|
||||||
|
|
||||||
|
## Accessibility & Inclusion
|
||||||
|
|
||||||
|
WCAG 2.2 AA. Keyboard and visible focus for the time control, route cards and vote; 4.5:1 body text and 3:1 large text; no colour-only meaning; reduced-motion alternatives; 44 px touch targets; stage text legible at 10 m; phone-first reading order with no horizontal page scroll.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# PulseCast web
|
# PulseCast web
|
||||||
|
|
||||||
Nuxt 4 SSR frontend for **PulseCast**, a staffing copilot that turns inner-city
|
Nuxt 4 SSR frontend for **PulseCast**, a staffing copilot that turns inner-city
|
||||||
footfall into a next-week shift plan for a Heilbronn retailer. `/plan` is the
|
footfall into a weekly shift plan for a Heilbronn retailer. `/plan` is the
|
||||||
decision surface; `/stage` and `/live` present that plan. The map, weather and
|
decision surface; `/stage` and `/live` present that plan. The map, weather and
|
||||||
forecast are supporting evidence.
|
forecast are supporting evidence.
|
||||||
|
|
||||||
@@ -167,18 +167,35 @@ deployed path are the real API.
|
|||||||
|
|
||||||
| Route | Purpose |
|
| Route | Purpose |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `/` | Now: replay reading, 8-sensor schematic, weather, holiday, data versions |
|
| `/cool` | **Cool City public hero.** Ruth card, time, three real route options, vote buttons; `/cool?vote=1` is the minimal audience vote page |
|
||||||
|
| `/cool/stage` | **Cool City projector.** Ruth card, cool places, data honesty, route board with exact labels, live vote, city view, retail link |
|
||||||
|
| `/cool/city` | Cooling-gap module: eight ranked catchments, one-line reasons, top block and “What would help” |
|
||||||
|
| `/` | Landing: the live shift board, peak shift, cost vs flat, coverage and the measured/modelled/assumed chain |
|
||||||
| `/forecast` | 7-day daily forecast, uncertainty band, weather strip |
|
| `/forecast` | 7-day daily forecast, uncertainty band, weather strip |
|
||||||
| `/plan` | **Hero.** Peak decision, shift blocks, coverage, cost, why, assumptions |
|
| `/plan` | **Hero.** Peak decision, weekly shift board, coverage, cost vs flat, settings, hourly detail |
|
||||||
| `/simulate` | Base vs scenario plan, both read from Go `/api/staffing` |
|
| `/simulate` | Base vs scenario plan, both read from Go `/api/staffing` |
|
||||||
| `/stage` | Big-screen decision: headline, peak staff, cost, coverage, QR to `/live` |
|
| `/stage` | Dark projector board: peak shift, weekly board, cost, coverage, QR to `/live` |
|
||||||
| `/live` | Phone view: current recommendation, peak shift, scenario, last update |
|
| `/live` | Phone answer: peak shift, staff count, reason, freshness, scenario and transport |
|
||||||
| `/control` | Presenter preset buttons; authenticated POST through Nitro |
|
| `/control` | Presenter preset buttons; authenticated POST through Nitro |
|
||||||
| `/about` | Method, metrics, limits, privacy, train form |
|
| `/about` | Method, metrics, limits, privacy, train form |
|
||||||
|
|
||||||
The layout targets **390 px** (single column, mobile Onyx nav, day cards) and
|
The layout targets **390 px** (single column, mobile Onyx nav, day cards) and
|
||||||
**1440 px** (Onyx horizontal nav, two-column plan with tables).
|
**1440 px** (Onyx horizontal nav, two-column plan with tables).
|
||||||
|
|
||||||
|
### Cool City demo data and state
|
||||||
|
|
||||||
|
- `/cool` reads `public/cool-city/route.json`, normalised from
|
||||||
|
`cool-city-data/route/shade.json`, `routes.geojson` and `places.json`.
|
||||||
|
`/cool/city` reads `public/cool-city/city-gap.json`.
|
||||||
|
- Vote and demo state are in-memory Nitro routes: `GET/POST /api/cool/state`,
|
||||||
|
`GET/POST /api/cool/vote`, `POST /api/cool/reset`. `round` is
|
||||||
|
`preselection` or `final`; votes never mix. The stage and phones poll every
|
||||||
|
2 seconds. No database and no PII.
|
||||||
|
- Stage labels: `Cool places`, `Data honesty`, `Find routes`, `Shortest`,
|
||||||
|
`Shaded`, `Accessible`, `Start vote`, `Lock vote`, `City view`,
|
||||||
|
`Retail module`, `Reset round`. The model recommendation is
|
||||||
|
**“Accessible for Ruth”**.
|
||||||
|
|
||||||
## Plan logic
|
## Plan logic
|
||||||
|
|
||||||
`shared/staffing.ts` is the single implementation of the contract heuristic:
|
`shared/staffing.ts` is the single implementation of the contract heuristic:
|
||||||
|
|||||||
+42
-28
@@ -5,17 +5,22 @@ import {
|
|||||||
iconCircleInformation,
|
iconCircleInformation,
|
||||||
iconFlash,
|
iconFlash,
|
||||||
iconHome,
|
iconHome,
|
||||||
iconMobileSignal,
|
|
||||||
iconPresentionBoard,
|
|
||||||
} from '@sit-onyx/icons'
|
} from '@sit-onyx/icons'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const usingMock = computed(
|
const usingMock = computed(() => {
|
||||||
() =>
|
const value = config.public.useMock
|
||||||
config.public.useMock === true ||
|
return value === true || value === '1' || value === 'true'
|
||||||
config.public.useMock === '1' ||
|
})
|
||||||
config.public.useMock === 'true',
|
|
||||||
|
const isCool = computed(() => route.path.startsWith('/cool'))
|
||||||
|
const isDarkPresentation = computed(
|
||||||
|
() => route.path === '/stage' || route.path === '/live' || route.path === '/cool/stage',
|
||||||
|
)
|
||||||
|
const isStandalone = computed(() => isCool.value || isDarkPresentation.value)
|
||||||
|
const bodyClass = computed(() =>
|
||||||
|
isDarkPresentation.value ? 'pc-presentation' : isCool.value ? 'pc-cool-presentation' : '',
|
||||||
)
|
)
|
||||||
|
|
||||||
const navigation = [
|
const navigation = [
|
||||||
@@ -23,8 +28,6 @@ const navigation = [
|
|||||||
{ to: '/forecast', label: 'Forecast', icon: iconChart },
|
{ to: '/forecast', label: 'Forecast', icon: iconChart },
|
||||||
{ to: '/plan', label: 'Plan', icon: iconCalendar },
|
{ to: '/plan', label: 'Plan', icon: iconCalendar },
|
||||||
{ to: '/simulate', label: 'Simulate', icon: iconFlash },
|
{ to: '/simulate', label: 'Simulate', icon: iconFlash },
|
||||||
{ to: '/stage', label: 'Stage', icon: iconPresentionBoard },
|
|
||||||
{ to: '/live', label: 'Live', icon: iconMobileSignal },
|
|
||||||
{ to: '/about', label: 'About', icon: iconCircleInformation },
|
{ to: '/about', label: 'About', icon: iconCircleInformation },
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -32,10 +35,32 @@ const hiddenPageLabels: Record<string, string> = { '/control': 'Control' }
|
|||||||
const activeLabel = computed(
|
const activeLabel = computed(
|
||||||
() => navigation.find((item) => item.to === route.path)?.label ?? hiddenPageLabels[route.path] ?? 'PulseCast',
|
() => navigation.find((item) => item.to === route.path)?.label ?? hiddenPageLabels[route.path] ?? 'PulseCast',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useHead(() => ({
|
||||||
|
bodyAttrs: { class: bodyClass.value },
|
||||||
|
}))
|
||||||
|
|
||||||
|
// Onyx renders its overflow navigation as a `menubar` whose direct child is a
|
||||||
|
// div, which fails the required-children rule. The list is site navigation,
|
||||||
|
// not an application menu, so remove the menu role rather than fake menuitems.
|
||||||
|
let navRoleObserver: MutationObserver | undefined
|
||||||
|
function fixNavAria() {
|
||||||
|
for (const list of document.querySelectorAll('.onyx-more-list[role="menubar"]')) {
|
||||||
|
list.setAttribute('role', 'none')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
fixNavAria()
|
||||||
|
navRoleObserver = new MutationObserver(fixNavAria)
|
||||||
|
navRoleObserver.observe(document.body, { childList: true, subtree: true })
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => navRoleObserver?.disconnect())
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<OnyxAppLayout>
|
<NuxtPage v-if="isStandalone" />
|
||||||
|
|
||||||
|
<OnyxAppLayout v-else>
|
||||||
<template #navBar>
|
<template #navBar>
|
||||||
<OnyxNavBar app-name="PulseCast" logo-url="/logo.svg" mobile="sm">
|
<OnyxNavBar app-name="PulseCast" logo-url="/logo.svg" mobile="sm">
|
||||||
<OnyxUnstableNavButton
|
<OnyxUnstableNavButton
|
||||||
@@ -46,7 +71,8 @@ const activeLabel = computed(
|
|||||||
:icon="item.icon"
|
:icon="item.icon"
|
||||||
/>
|
/>
|
||||||
<template #contextArea>
|
<template #contextArea>
|
||||||
<OnyxBadge :color="usingMock ? 'warning' : 'success'">{{ usingMock ? 'Mock data' : 'Go API' }}</OnyxBadge>
|
<NuxtLink class="pc-present" to="/stage">Stage</NuxtLink>
|
||||||
|
<NuxtLink class="pc-present" to="/live">Live</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
<template #mobileActivePage>{{ activeLabel }}</template>
|
<template #mobileActivePage>{{ activeLabel }}</template>
|
||||||
</OnyxNavBar>
|
</OnyxNavBar>
|
||||||
@@ -57,26 +83,14 @@ const activeLabel = computed(
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
<span><strong>PulseCast</strong> — staff the pulse, not the noise.</span>
|
<span><strong>PulseCast</strong> — staff the pulse, not the noise.</span>
|
||||||
<span class="muted small">
|
<span class="pc-small">
|
||||||
Prototype · forecast from the Go API · estimated devices, not people · 8 sensors in a 580 m cluster
|
Decision support, not an optimizer.
|
||||||
|
<NuxtLink to="/about">Method & limits</NuxtLink> ·
|
||||||
|
<NuxtLink to="/cool">Cool City public module</NuxtLink>
|
||||||
|
<template v-if="usingMock"> · demo data</template>
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
</OnyxPageLayout>
|
</OnyxPageLayout>
|
||||||
</OnyxAppLayout>
|
</OnyxAppLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.app-footer {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: var(--onyx-density-sm);
|
|
||||||
width: 100%;
|
|
||||||
max-width: 1440px;
|
|
||||||
margin-inline: auto;
|
|
||||||
padding-block: var(--onyx-density-sm);
|
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
|
||||||
font-size: 0.8125rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -0,0 +1,526 @@
|
|||||||
|
:root {
|
||||||
|
--cc-ground: #f6f3ee;
|
||||||
|
--cc-surface: rgba(255, 255, 255, 0.86);
|
||||||
|
--cc-surface-solid: #fffdf9;
|
||||||
|
--cc-ink: #121212;
|
||||||
|
--cc-ink-2: #343434;
|
||||||
|
--cc-muted: #6b6b6b;
|
||||||
|
--cc-line: rgba(18, 18, 18, 0.12);
|
||||||
|
--cc-line-strong: rgba(18, 18, 18, 0.24);
|
||||||
|
--cc-heat: #e4572e;
|
||||||
|
--cc-heat-text: #a83a19;
|
||||||
|
--cc-heat-soft: #fbe8e2;
|
||||||
|
--cc-shade: #2f6fed;
|
||||||
|
--cc-shade-deep: #1f4fae;
|
||||||
|
--cc-shade-soft: #e5edff;
|
||||||
|
--cc-water: #3aa6b9;
|
||||||
|
--cc-focus: #a83a19;
|
||||||
|
--cc-radius: 28px;
|
||||||
|
--cc-shadow: 0 18px 60px rgba(18, 18, 18, 0.12);
|
||||||
|
--cc-shadow-soft: 0 8px 26px rgba(18, 18, 18, 0.07);
|
||||||
|
--cc-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
|
||||||
|
|
||||||
|
--cc-dark: #0b1114;
|
||||||
|
--cc-dark-2: #14191c;
|
||||||
|
--cc-dark-3: #1d2428;
|
||||||
|
--cc-dark-line: rgba(255, 255, 255, 0.14);
|
||||||
|
--cc-dark-muted: #a3a3a3;
|
||||||
|
--cc-heat-bright: #ff6b3d;
|
||||||
|
--cc-shade-bright: #6fa8ff;
|
||||||
|
--cc-water-bright: #7ad1df;
|
||||||
|
--cc-focus-dark: #ff9b76;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.pc-cool-presentation {
|
||||||
|
background: var(--cc-ground);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.pc-cool-presentation,
|
||||||
|
.cc-cool,
|
||||||
|
.cc-stage {
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool,
|
||||||
|
.cc-cool *,
|
||||||
|
.cc-cool *::before,
|
||||||
|
.cc-cool *::after,
|
||||||
|
.cc-stage,
|
||||||
|
.cc-stage *,
|
||||||
|
.cc-stage *::before,
|
||||||
|
.cc-stage *::after,
|
||||||
|
.cc-city,
|
||||||
|
.cc-city *,
|
||||||
|
.cc-city *::before,
|
||||||
|
.cc-city *::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool {
|
||||||
|
min-height: 100dvh;
|
||||||
|
padding-bottom: 3rem;
|
||||||
|
background: var(--cc-ground);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Top bar --------------------------------------------------------------- */
|
||||||
|
|
||||||
|
.cc-topbar {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 10;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem 0.9rem;
|
||||||
|
min-height: 60px;
|
||||||
|
padding: 0.65rem 1rem;
|
||||||
|
border-bottom: 1px solid var(--cc-line);
|
||||||
|
background: color-mix(in srgb, var(--cc-ground) 88%, transparent);
|
||||||
|
backdrop-filter: blur(18px) saturate(140%);
|
||||||
|
-webkit-backdrop-filter: blur(18px) saturate(140%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-wordmark {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-size: 0.96rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-mark {
|
||||||
|
display: block;
|
||||||
|
width: 0.55rem;
|
||||||
|
height: 1.25rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: linear-gradient(180deg, var(--cc-heat) 0 50%, var(--cc-shade) 50% 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-topbar__place {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-topbar__status {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.3rem;
|
||||||
|
margin-inline-start: auto;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-topbar__status i {
|
||||||
|
display: block;
|
||||||
|
width: 0.4rem;
|
||||||
|
height: 0.4rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--cc-shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Phone ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
.cc-phone {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 35rem;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
margin-inline: auto;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.45rem;
|
||||||
|
padding: 0.4rem 0 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth h1 {
|
||||||
|
max-width: 13ch;
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(2.6rem, 10.8vw, 4.2rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.06em;
|
||||||
|
line-height: 0.9;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth__copy {
|
||||||
|
max-width: 46ch;
|
||||||
|
margin: 0.15rem 0 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.98rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth__tag {
|
||||||
|
display: inline-flex;
|
||||||
|
width: fit-content;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
padding: 0.18rem 0.5rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 999px;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.6rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-panel {
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: var(--cc-radius);
|
||||||
|
background: var(--cc-surface);
|
||||||
|
box-shadow: var(--cc-shadow-soft);
|
||||||
|
backdrop-filter: blur(18px) saturate(140%);
|
||||||
|
-webkit-backdrop-filter: blur(18px) saturate(140%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.7rem;
|
||||||
|
margin-bottom: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time__head h2 {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time__head strong {
|
||||||
|
font-size: clamp(2.6rem, 10vw, 3.6rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.06em;
|
||||||
|
line-height: 0.9;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time :deep(.onyx-slider__marks),
|
||||||
|
.cc-time :deep(.onyx-slider__mark-label) {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time :deep(.onyx-slider__track) {
|
||||||
|
accent-color: var(--cc-shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only {
|
||||||
|
display: flex;
|
||||||
|
min-height: calc(100dvh - 62px);
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 2rem 1rem 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__inner {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 34rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only h1 {
|
||||||
|
max-width: 10ch;
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(3rem, 12vw, 5rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.06em;
|
||||||
|
line-height: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__lede {
|
||||||
|
max-width: 34ch;
|
||||||
|
margin: 0.8rem 0 1.4rem;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__buttons {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__confirmation {
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: var(--cc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__confirmation p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details {
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: var(--cc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details summary:focus-visible,
|
||||||
|
.cc-city__method summary:focus-visible {
|
||||||
|
outline: 2px solid var(--cc-focus);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details summary {
|
||||||
|
padding: 0.9rem 1rem;
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 650;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details__body {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.6rem;
|
||||||
|
padding: 0 1rem 1rem;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details__body p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details__body strong {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details__links {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.8rem;
|
||||||
|
padding-top: 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details__links a {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-phone__footer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.4rem 1rem;
|
||||||
|
padding-top: 1.1rem;
|
||||||
|
border-top: 1px solid var(--cc-line);
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Onyx theming on the phone --------------------------------------------- */
|
||||||
|
|
||||||
|
.cc-cool {
|
||||||
|
--onyx-font-family-paragraph: var(--cc-font);
|
||||||
|
--onyx-font-family-h1: var(--cc-font);
|
||||||
|
--onyx-font-family-h2: var(--cc-font);
|
||||||
|
--onyx-font-family-h3: var(--cc-font);
|
||||||
|
--onyx-font-family-h4: var(--cc-font);
|
||||||
|
--onyx-font-family-data: var(--cc-font);
|
||||||
|
--onyx-radius-component-button: 999px;
|
||||||
|
--onyx-radius-component-container-soft: var(--cc-radius);
|
||||||
|
--onyx-radius-component-input: 999px;
|
||||||
|
--onyx-color-base-primary-500: var(--cc-ink);
|
||||||
|
--onyx-color-base-primary-600: var(--cc-ink);
|
||||||
|
--onyx-color-base-primary-900: var(--cc-ink);
|
||||||
|
--onyx-color-component-cta-default: var(--cc-ink);
|
||||||
|
--onyx-color-component-cta-default-hover: #000;
|
||||||
|
--onyx-color-text-icons-neutral-button: #fff;
|
||||||
|
--onyx-color-component-focus-primary: var(--cc-heat);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool :deep(.onyx-button) {
|
||||||
|
min-height: 52px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool :deep(.onyx-button--outline) {
|
||||||
|
border-color: var(--cc-line-strong);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool :deep(.onyx-button--outline:hover) {
|
||||||
|
background: var(--cc-ink);
|
||||||
|
border-color: var(--cc-ink);
|
||||||
|
color: var(--cc-ground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-cool :deep(.onyx-button__label) {
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stage ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
.cc-stage {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
height: 100dvh;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--cc-dark);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-stage__top {
|
||||||
|
position: relative;
|
||||||
|
z-index: 4;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.7rem;
|
||||||
|
padding: 0.65rem clamp(1rem, 2.4vw, 2.4rem);
|
||||||
|
border-bottom: 1px solid var(--cc-line);
|
||||||
|
background: color-mix(in srgb, var(--cc-dark) 86%, transparent);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
-webkit-backdrop-filter: blur(16px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-stage__wordmark {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-stage__place {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-stage__round {
|
||||||
|
margin-inline-start: auto;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-dark {
|
||||||
|
--cc-ground: #0b1114;
|
||||||
|
--cc-surface: rgba(23, 28, 31, 0.88);
|
||||||
|
--cc-surface-solid: #131a1e;
|
||||||
|
--cc-ink: #f5f3ef;
|
||||||
|
--cc-ink-2: #dedbd4;
|
||||||
|
--cc-muted: #a3a3a3;
|
||||||
|
--cc-line: rgba(255, 255, 255, 0.14);
|
||||||
|
--cc-line-strong: rgba(255, 255, 255, 0.26);
|
||||||
|
--cc-heat: #ff6b3d;
|
||||||
|
--cc-heat-text: #ff9b76;
|
||||||
|
--cc-heat-soft: #2b1711;
|
||||||
|
--cc-shade: #6fa8ff;
|
||||||
|
--cc-shade-deep: #a9c8ff;
|
||||||
|
--cc-shade-soft: #142238;
|
||||||
|
--cc-water: #7ad1df;
|
||||||
|
--cc-focus: #ff9b76;
|
||||||
|
--cc-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
|
||||||
|
--cc-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-dark .cc-wordmark {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-dark .cc-topbar {
|
||||||
|
background: color-mix(in srgb, var(--cc-dark) 86%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 900px) {
|
||||||
|
.cc-phone {
|
||||||
|
display: grid;
|
||||||
|
max-width: 72rem;
|
||||||
|
grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
|
||||||
|
grid-template-areas:
|
||||||
|
"ruth routes"
|
||||||
|
"time routes"
|
||||||
|
"details details"
|
||||||
|
"footer footer";
|
||||||
|
gap: 1rem 1.5rem;
|
||||||
|
align-items: start;
|
||||||
|
padding: 1.5rem 1.5rem 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth {
|
||||||
|
grid-area: ruth;
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-ruth h1 {
|
||||||
|
font-size: clamp(3rem, 4.6vw, 4.8rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-time {
|
||||||
|
grid-area: time;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route {
|
||||||
|
grid-area: routes;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-details {
|
||||||
|
grid-area: details;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-phone__footer {
|
||||||
|
grid-area: footer;
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 460px) {
|
||||||
|
.cc-topbar {
|
||||||
|
min-height: 56px;
|
||||||
|
padding: 0.55rem 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-topbar__place {
|
||||||
|
font-size: 0.66rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-topbar__status {
|
||||||
|
font-size: 0.58rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-phone {
|
||||||
|
padding-inline: 0.8rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.cc-topbar,
|
||||||
|
.cc-panel {
|
||||||
|
backdrop-filter: none;
|
||||||
|
-webkit-backdrop-filter: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1249
-81
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,155 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { CoolCityCatchment, CoolCityPlace } from '#shared/cool'
|
||||||
|
import { createProjection, pathFromCoordinates } from '~/utils/cool-map'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
places: CoolCityPlace[]
|
||||||
|
catchments?: CoolCityCatchment[]
|
||||||
|
selectedRank?: number | null
|
||||||
|
showCatchments?: boolean
|
||||||
|
stage?: boolean
|
||||||
|
}>(),
|
||||||
|
{ catchments: () => [], selectedRank: null, showCatchments: false, stage: false },
|
||||||
|
)
|
||||||
|
|
||||||
|
const allPoints = computed(() => {
|
||||||
|
const placePoints = props.places.map((place) => ({ lat: place.lat, lon: place.lon }))
|
||||||
|
const centers = props.catchments.map((catchment) => catchment.center)
|
||||||
|
return [...placePoints, ...centers]
|
||||||
|
})
|
||||||
|
|
||||||
|
const project = computed(() => createProjection(allPoints.value, 1200, 800, 90))
|
||||||
|
const dots = computed(() =>
|
||||||
|
props.places.map((place) => ({
|
||||||
|
...place,
|
||||||
|
position: project.value({ lat: place.lat, lon: place.lon }),
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
const rings = computed(() =>
|
||||||
|
props.catchments.map((catchment) => {
|
||||||
|
const ring = catchment.geometry.coordinates?.[0] ?? []
|
||||||
|
const path = ring.length
|
||||||
|
? pathFromCoordinates(
|
||||||
|
ring.map(([lon, lat]) => [lon, lat] as [number, number]),
|
||||||
|
project.value,
|
||||||
|
)
|
||||||
|
: ''
|
||||||
|
return {
|
||||||
|
...catchment,
|
||||||
|
path,
|
||||||
|
centerPoint: project.value(catchment.center),
|
||||||
|
selected: props.selectedRank === catchment.rank,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<figure class="cc-placesmap" :class="{ 'cc-placesmap--stage': props.stage }">
|
||||||
|
<svg
|
||||||
|
class="cc-placesmap__canvas"
|
||||||
|
viewBox="0 0 1200 800"
|
||||||
|
preserveAspectRatio="xMidYMid meet"
|
||||||
|
role="img"
|
||||||
|
:aria-label="`Map of ${places.length} cool places near the eight Heilbronn sensor catchments.`"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<pattern id="cc-places-grid" width="44" height="44" patternUnits="userSpaceOnUse">
|
||||||
|
<circle cx="1" cy="1" r="1" fill="currentColor" />
|
||||||
|
</pattern>
|
||||||
|
</defs>
|
||||||
|
<rect class="cc-placesmap__ground" x="0" y="0" width="1200" height="800" />
|
||||||
|
<rect class="cc-placesmap__grid" x="0" y="0" width="1200" height="800" fill="url(#cc-places-grid)" />
|
||||||
|
|
||||||
|
<g v-if="props.showCatchments">
|
||||||
|
<path
|
||||||
|
v-for="ring in rings"
|
||||||
|
:key="ring.sensor_id"
|
||||||
|
class="cc-placesmap__ring"
|
||||||
|
:class="{ 'is-selected': ring.selected }"
|
||||||
|
:d="ring.path"
|
||||||
|
/>
|
||||||
|
<g v-for="ring in rings" :key="`${ring.sensor_id}-label`" class="cc-placesmap__rank">
|
||||||
|
<text :x="ring.centerPoint.x" :y="ring.centerPoint.y + 6" text-anchor="middle">{{ ring.rank }}</text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g class="cc-placesmap__dots">
|
||||||
|
<circle
|
||||||
|
v-for="dot in dots"
|
||||||
|
:key="`${dot.name}-${dot.lat}-${dot.lon}`"
|
||||||
|
:cx="dot.position.x"
|
||||||
|
:cy="dot.position.y"
|
||||||
|
:r="props.stage ? 9 : 6"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<p class="cc-placesmap__stamp">Relative map · OSM cool places · no heatmap</p>
|
||||||
|
</figure>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cc-placesmap {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 24rem;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--cc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__ground {
|
||||||
|
fill: var(--cc-ground, #f6f3ee);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__grid {
|
||||||
|
color: var(--cc-line, rgba(18, 18, 18, 0.12));
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__ring {
|
||||||
|
fill: color-mix(in srgb, var(--cc-shade) 8%, transparent);
|
||||||
|
stroke: var(--cc-line);
|
||||||
|
stroke-width: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__ring.is-selected {
|
||||||
|
fill: color-mix(in srgb, var(--cc-heat) 14%, transparent);
|
||||||
|
stroke: var(--cc-heat);
|
||||||
|
stroke-width: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__rank text {
|
||||||
|
fill: var(--cc-muted);
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__dots circle {
|
||||||
|
fill: var(--cc-shade);
|
||||||
|
stroke: var(--cc-ground, #f6f3ee);
|
||||||
|
stroke-width: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-placesmap__stamp {
|
||||||
|
position: absolute;
|
||||||
|
right: 1rem;
|
||||||
|
bottom: 0.8rem;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { CoolRouteOption, CoolRouteValues } from '#shared/cool'
|
||||||
|
import { coolDistance, coolMinutes, coolShade, coolStops, coolValues } from '~/utils/cool'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
route: CoolRouteOption
|
||||||
|
values: CoolRouteValues | null
|
||||||
|
reason: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const data = computed(() => coolValues(props.values))
|
||||||
|
const ramp = computed(() =>
|
||||||
|
props.route.ramp ? props.route.ramp.incline.replace('.0%', '%') : 'no ramp',
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<article class="cc-route-card" :class="`cc-route-card--${route.id}`">
|
||||||
|
<div class="cc-route-card__head">
|
||||||
|
<span class="cc-route-card__dot" aria-hidden="true" />
|
||||||
|
<h3 class="cc-route-card__label">{{ route.label }}</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="cc-route-card__reason">{{ reason }}</p>
|
||||||
|
|
||||||
|
<p class="cc-route-card__metrics">
|
||||||
|
<span><strong>{{ coolShade(data.shadePct) }}</strong> shade</span>
|
||||||
|
<span><strong>{{ coolMinutes(data.directSunMin) }}</strong> direct sun</span>
|
||||||
|
<span>{{ coolDistance(data.distanceM) }}</span>
|
||||||
|
<span>{{ coolMinutes(data.durationMin) }}</span>
|
||||||
|
<span class="cc-route-card__metric-break" aria-hidden="true" />
|
||||||
|
<span>{{ ramp }}</span>
|
||||||
|
<span>water {{ coolStops(data.waterStops) }}</span>
|
||||||
|
<span>benches {{ coolStops(data.benchStops) }}</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="cc-route-card__action">
|
||||||
|
<slot name="action" />
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cc-route-card {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 1.1rem 1.15rem 1.05rem;
|
||||||
|
border-radius: 28px;
|
||||||
|
background: var(--cc-surface, rgba(255, 255, 255, 0.86));
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 1px color-mix(in srgb, var(--cc-shade) 24%, transparent),
|
||||||
|
0 18px 48px rgba(18, 18, 18, 0.08);
|
||||||
|
backdrop-filter: blur(20px) saturate(140%);
|
||||||
|
-webkit-backdrop-filter: blur(20px) saturate(140%);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__dot {
|
||||||
|
display: block;
|
||||||
|
width: 0.5rem;
|
||||||
|
height: 0.5rem;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card--shortest .cc-route-card__dot {
|
||||||
|
background: var(--cc-heat);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card--shaded .cc-route-card__dot {
|
||||||
|
background: var(--cc-shade);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__label {
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(1.7rem, 5.6vw, 2.5rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.045em;
|
||||||
|
line-height: 0.95;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__reason {
|
||||||
|
max-width: 52ch;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.88rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metrics {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.15rem 0;
|
||||||
|
margin: 0.1rem 0 0;
|
||||||
|
color: var(--cc-ink-2);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metrics > span {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metrics > span:not(.cc-route-card__metric-break):not(:last-child)::after {
|
||||||
|
content: "·";
|
||||||
|
margin-inline: 0.55rem;
|
||||||
|
color: var(--cc-line-strong);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metric-break {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metrics strong {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__action {
|
||||||
|
margin-top: 0.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__action :deep(.onyx-button) {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 52px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__action :deep(.onyx-button__label) {
|
||||||
|
font-size: 0.92rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 640px) {
|
||||||
|
.cc-route-card {
|
||||||
|
padding: 1.35rem 1.45rem 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metric-break {
|
||||||
|
display: block;
|
||||||
|
flex-basis: 100%;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__metrics > span:not(.cc-route-card__metric-break):has(+ .cc-route-card__metric-break)::after {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route-card__action :deep(.onyx-button) {
|
||||||
|
width: auto;
|
||||||
|
min-width: 15rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.cc-route-card {
|
||||||
|
backdrop-filter: none;
|
||||||
|
-webkit-backdrop-filter: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,216 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { CoolRouteBundle, CoolRouteId } from '#shared/cool'
|
||||||
|
import { createProjection, pathFromCoordinates } from '~/utils/cool-map'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
bundle: CoolRouteBundle
|
||||||
|
selectedRoute?: CoolRouteId | null
|
||||||
|
stage?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const allPoints = computed(() => {
|
||||||
|
const routePoints = props.bundle.routes.flatMap((route) =>
|
||||||
|
route.geometry.map(([lon, lat]) => ({ lat, lon })),
|
||||||
|
)
|
||||||
|
const water = props.bundle.water.map((point) => ({ lat: point.lat, lon: point.lon }))
|
||||||
|
return [...routePoints, ...water]
|
||||||
|
})
|
||||||
|
|
||||||
|
const project = computed(() => createProjection(allPoints.value))
|
||||||
|
const routes = computed(() =>
|
||||||
|
props.bundle.routes.map((route) => ({
|
||||||
|
...route,
|
||||||
|
path: pathFromCoordinates(route.geometry, project.value),
|
||||||
|
isSelected: props.selectedRoute === route.id,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
const origin = computed(() => {
|
||||||
|
const lat = props.bundle.origin.lat
|
||||||
|
const lon = props.bundle.origin.lon
|
||||||
|
return lat !== undefined && lon !== undefined ? project.value({ lat, lon }) : null
|
||||||
|
})
|
||||||
|
const destination = computed(() => {
|
||||||
|
const lat = props.bundle.destination.lat
|
||||||
|
const lon = props.bundle.destination.lon
|
||||||
|
return lat !== undefined && lon !== undefined ? project.value({ lat, lon }) : null
|
||||||
|
})
|
||||||
|
const water = computed(() =>
|
||||||
|
props.bundle.water.map((point) => ({ ...point, position: project.value({ lat: point.lat, lon: point.lon }) })),
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<figure class="cc-routemap" :class="{ 'cc-routemap--stage': props.stage }">
|
||||||
|
<svg
|
||||||
|
class="cc-routemap__canvas"
|
||||||
|
viewBox="0 0 1200 800"
|
||||||
|
preserveAspectRatio="xMidYMid meet"
|
||||||
|
role="img"
|
||||||
|
:aria-label="`Route map from ${props.bundle.origin.name} to ${props.bundle.destination.name}. Shortest, shaded and accessible routes with modelled shade.`"
|
||||||
|
>
|
||||||
|
<defs>
|
||||||
|
<pattern id="cc-route-grid" width="48" height="48" patternUnits="userSpaceOnUse">
|
||||||
|
<circle cx="1" cy="1" r="1" fill="currentColor" />
|
||||||
|
</pattern>
|
||||||
|
</defs>
|
||||||
|
<rect class="cc-routemap__ground" x="0" y="0" width="1200" height="800" />
|
||||||
|
<rect class="cc-routemap__grid" x="0" y="0" width="1200" height="800" fill="url(#cc-route-grid)" />
|
||||||
|
|
||||||
|
<path
|
||||||
|
v-for="route in routes"
|
||||||
|
:key="route.id"
|
||||||
|
class="cc-routemap__route"
|
||||||
|
:class="[
|
||||||
|
`cc-routemap__route--${route.id}`,
|
||||||
|
{ 'is-selected': route.isSelected, 'is-dim': props.selectedRoute && !route.isSelected },
|
||||||
|
]"
|
||||||
|
:d="route.path"
|
||||||
|
pathLength="1"
|
||||||
|
fill="none"
|
||||||
|
vector-effect="non-scaling-stroke"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<g v-for="point in water" :key="point.name" class="cc-routemap__water">
|
||||||
|
<circle :cx="point.position.x" :cy="point.position.y" r="7" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g v-if="origin" class="cc-routemap__endpoint">
|
||||||
|
<circle :cx="origin.x" :cy="origin.y" r="16" />
|
||||||
|
<text :x="origin.x" :y="origin.y + 5" text-anchor="middle" class="cc-routemap__letter">S</text>
|
||||||
|
<text :x="origin.x" :y="origin.y + 44" text-anchor="middle" class="cc-routemap__place">{{ props.bundle.origin.name }}</text>
|
||||||
|
</g>
|
||||||
|
<g v-if="destination" class="cc-routemap__endpoint">
|
||||||
|
<circle :cx="destination.x" :cy="destination.y" r="16" />
|
||||||
|
<text :x="destination.x" :y="destination.y + 5" text-anchor="middle" class="cc-routemap__letter">M</text>
|
||||||
|
<text :x="destination.x" :y="destination.y - 30" text-anchor="middle" class="cc-routemap__place">{{ props.bundle.destination.name }}</text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<p class="cc-routemap__stamp">OSM route geometry · modelled shade · no basemap</p>
|
||||||
|
</figure>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cc-routemap {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 24rem;
|
||||||
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--cc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__ground {
|
||||||
|
fill: var(--cc-ground, #f6f3ee);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__grid {
|
||||||
|
color: var(--cc-line, rgba(18, 18, 18, 0.12));
|
||||||
|
opacity: 0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route {
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
opacity: 0.9;
|
||||||
|
transition: opacity 240ms ease;
|
||||||
|
animation: cc-route-draw 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route--shortest {
|
||||||
|
stroke: var(--cc-heat);
|
||||||
|
stroke-width: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route--shaded {
|
||||||
|
stroke: var(--cc-shade);
|
||||||
|
stroke-width: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route--accessible {
|
||||||
|
stroke: var(--cc-ink);
|
||||||
|
stroke-width: 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route.is-selected {
|
||||||
|
opacity: 1;
|
||||||
|
stroke-width: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__route.is-dim {
|
||||||
|
opacity: 0.38;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__water circle {
|
||||||
|
fill: var(--cc-shade);
|
||||||
|
stroke: var(--cc-ground, #f6f3ee);
|
||||||
|
stroke-width: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__endpoint circle {
|
||||||
|
fill: var(--cc-ink);
|
||||||
|
stroke: var(--cc-ground, #f6f3ee);
|
||||||
|
stroke-width: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__letter {
|
||||||
|
fill: var(--cc-ground, #f6f3ee);
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__place {
|
||||||
|
fill: var(--cc-ink);
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap__stamp {
|
||||||
|
position: absolute;
|
||||||
|
right: 1rem;
|
||||||
|
bottom: 0.8rem;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap--stage {
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap--stage .cc-routemap__place,
|
||||||
|
.cc-routemap--stage .cc-routemap__endpoint {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-routemap--stage .cc-routemap__letter {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes cc-route-draw {
|
||||||
|
from {
|
||||||
|
stroke-dasharray: 1;
|
||||||
|
stroke-dashoffset: 1;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
stroke-dasharray: 1;
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.cc-routemap__route {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { LIVE_COLORS, LIVE_LABELS, liveAge } from '#shared/live'
|
import { LIVE_LABELS, liveAge } from '#shared/live'
|
||||||
import type { LiveConnection } from '#shared/live'
|
import type { LiveConnection } from '#shared/live'
|
||||||
|
|
||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
@@ -7,31 +7,122 @@ const props = withDefaults(
|
|||||||
status: LiveConnection
|
status: LiveConnection
|
||||||
lastEventAt?: string
|
lastEventAt?: string
|
||||||
compact?: boolean
|
compact?: boolean
|
||||||
|
dark?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{ lastEventAt: '', compact: false },
|
{ lastEventAt: '', compact: false, dark: false },
|
||||||
)
|
)
|
||||||
|
|
||||||
const color = computed(() => LIVE_COLORS[props.status])
|
|
||||||
const label = computed(() => LIVE_LABELS[props.status])
|
const label = computed(() => LIVE_LABELS[props.status])
|
||||||
const age = computed(() => (props.lastEventAt ? liveAge(props.lastEventAt) : ''))
|
const age = computed(() => (props.lastEventAt ? liveAge(props.lastEventAt) : ''))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span class="live-status" role="status" aria-live="polite" :title="lastEventAt ? `Last event ${age}` : undefined">
|
<span
|
||||||
<OnyxBadge :color="color" :density="compact ? 'compact' : 'default'">{{ label }}</OnyxBadge>
|
class="pc-status"
|
||||||
<span v-if="lastEventAt && !compact" class="live-status__age">{{ age }}</span>
|
:class="[`pc-status--${status}`, { 'pc-status--compact': compact, 'pc-status--dark': dark }]"
|
||||||
|
role="status"
|
||||||
|
aria-live="polite"
|
||||||
|
:title="lastEventAt ? `Last event ${age}` : undefined"
|
||||||
|
>
|
||||||
|
<span class="pc-status__dot" aria-hidden="true" />
|
||||||
|
<span class="pc-status__label">{{ label }}</span>
|
||||||
|
<span v-if="lastEventAt && !compact" class="pc-status__age">{{ age }}</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.live-status {
|
.pc-status {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.35rem;
|
gap: 0.4rem;
|
||||||
|
color: var(--pc-muted, #6e665a);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
line-height: 1;
|
||||||
|
text-transform: uppercase;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-status__age {
|
.pc-status__dot {
|
||||||
color: var(--onyx-color-text-icons-neutral-soft);
|
width: 0.45rem;
|
||||||
font-size: 0.7rem;
|
height: 0.45rem;
|
||||||
|
flex: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status__label {
|
||||||
|
color: var(--pc-ink, #16130f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--live .pc-status__dot {
|
||||||
|
background: var(--pc-green, #2e6b4f);
|
||||||
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc-green, #2e6b4f) 16%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--polling .pc-status__dot {
|
||||||
|
background: var(--pc-signal-text, #b63a00);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--offline .pc-status__dot {
|
||||||
|
background: var(--pc-danger, #b3261e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--connecting .pc-status__dot {
|
||||||
|
background: var(--pc-muted, #6e665a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status__age {
|
||||||
|
color: var(--pc-muted, #6e665a);
|
||||||
|
font-size: 0.66rem;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--compact .pc-status__label {
|
||||||
|
font-size: 0.66rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark {
|
||||||
|
color: var(--pc-dark-muted, #b4ae9f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark .pc-status__label {
|
||||||
|
color: var(--pc-paper, #f4efe6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark .pc-status__age {
|
||||||
|
color: var(--pc-dark-muted, #b4ae9f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark.pc-status--live .pc-status__dot {
|
||||||
|
background: var(--pc-green-bright, #5fc99a);
|
||||||
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc-green-bright, #5fc99a) 18%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark.pc-status--polling .pc-status__dot {
|
||||||
|
background: var(--pc-signal-bright, #ff6a2a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-status--dark.pc-status--offline .pc-status__dot {
|
||||||
|
background: var(--pc-danger-bright, #ff7a6e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
.pc-status--live .pc-status__dot {
|
||||||
|
animation: pc-status-pulse 2.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pc-status-pulse {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.55;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Point } from '#shared/types'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
points: Point[]
|
||||||
|
label: string
|
||||||
|
height?: number
|
||||||
|
showPeak?: boolean
|
||||||
|
}>(),
|
||||||
|
{ height: 56, showPeak: true },
|
||||||
|
)
|
||||||
|
|
||||||
|
const chart = computed(() => {
|
||||||
|
const values = props.points.map((point) => point.v)
|
||||||
|
if (!values.length) return { path: 'M 0 30 L 100 30', peak: null as null | { x: number; y: number } }
|
||||||
|
const max = Math.max(...values, 1)
|
||||||
|
const step = values.length > 1 ? 100 / (values.length - 1) : 100
|
||||||
|
const coords = values.map((value, index) => ({
|
||||||
|
x: index * step,
|
||||||
|
y: 30 - (Math.max(0, value) / max) * 27,
|
||||||
|
}))
|
||||||
|
const path = coords.map((coord, index) => `${index === 0 ? 'M' : 'L'} ${coord.x.toFixed(2)} ${coord.y.toFixed(2)}`).join(' ')
|
||||||
|
const peakIndex = values.indexOf(Math.max(...values))
|
||||||
|
return { path, peak: coords[peakIndex] ?? null }
|
||||||
|
})
|
||||||
|
|
||||||
|
const pathKey = computed(() => `${props.points.length}-${props.points[0]?.t ?? ''}-${props.points.at(-1)?.v ?? ''}`)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<svg
|
||||||
|
class="pc-pulse"
|
||||||
|
:style="{ height: `${height}px` }"
|
||||||
|
viewBox="0 0 100 32"
|
||||||
|
preserveAspectRatio="none"
|
||||||
|
role="img"
|
||||||
|
:aria-label="label"
|
||||||
|
>
|
||||||
|
<title>{{ label }}</title>
|
||||||
|
<line class="pc-pulse__baseline" x1="0" y1="30" x2="100" y2="30" />
|
||||||
|
<path
|
||||||
|
:key="pathKey"
|
||||||
|
class="pc-pulse__line"
|
||||||
|
:d="chart.path"
|
||||||
|
pathLength="1"
|
||||||
|
fill="none"
|
||||||
|
vector-effect="non-scaling-stroke"
|
||||||
|
/>
|
||||||
|
<circle
|
||||||
|
v-if="showPeak && chart.peak"
|
||||||
|
class="pc-pulse__peak"
|
||||||
|
:cx="chart.peak.x"
|
||||||
|
:cy="chart.peak.y"
|
||||||
|
r="1.8"
|
||||||
|
vector-effect="non-scaling-stroke"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pc-pulse {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: visible;
|
||||||
|
color: var(--pc-pulse-color, var(--pc-line-strong, #8e8475));
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-pulse__baseline {
|
||||||
|
stroke: currentColor;
|
||||||
|
stroke-width: 0.6;
|
||||||
|
opacity: 0.35;
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-pulse__line {
|
||||||
|
stroke: currentColor;
|
||||||
|
stroke-width: 1.5;
|
||||||
|
stroke-linejoin: round;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-dasharray: 1;
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
animation: pc-pulse-draw 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-pulse__peak {
|
||||||
|
fill: var(--pc-signal, #e84100);
|
||||||
|
stroke: var(--pc-paper, #f4efe6);
|
||||||
|
stroke-width: 0.8;
|
||||||
|
vector-effect: non-scaling-stroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pc-pulse-draw {
|
||||||
|
from {
|
||||||
|
stroke-dashoffset: 1;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.pc-pulse__line {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,419 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { Point } from '#shared/types'
|
||||||
|
import type { PlanDay } from '~/utils/plan'
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
days: PlanDay[]
|
||||||
|
peakDate?: string
|
||||||
|
selectedDate?: string
|
||||||
|
interactive?: boolean
|
||||||
|
dense?: boolean
|
||||||
|
large?: boolean
|
||||||
|
dark?: boolean
|
||||||
|
showPulse?: boolean
|
||||||
|
label?: string
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
peakDate: '',
|
||||||
|
selectedDate: '',
|
||||||
|
interactive: false,
|
||||||
|
dense: false,
|
||||||
|
large: false,
|
||||||
|
dark: false,
|
||||||
|
showPulse: false,
|
||||||
|
label: 'Weekly shift board',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const emit = defineEmits<{ select: [date: string] }>()
|
||||||
|
|
||||||
|
function duration(shift: { start: string; end: string }): number {
|
||||||
|
return Math.max(0.5, Number(shift.end.slice(0, 2)) - Number(shift.start.slice(0, 2)))
|
||||||
|
}
|
||||||
|
|
||||||
|
function pulseOf(day: PlanDay): Point[] {
|
||||||
|
return day.hours.map((hour) => ({ t: hour.t, v: hour.footfall }))
|
||||||
|
}
|
||||||
|
|
||||||
|
function dayLabel(day: PlanDay): string {
|
||||||
|
const blocks = day.shifts.map((shift) => `${shift.start}–${shift.end}: ${shift.staff} staff`).join(', ')
|
||||||
|
return `${day.weekdayLong} ${day.dayNumber} ${day.month}: ${blocks || 'no shifts'}. ${day.staffHours} staff-hours.`
|
||||||
|
}
|
||||||
|
|
||||||
|
function activate(day: PlanDay) {
|
||||||
|
if (props.interactive) emit('select', day.date)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="pc-board"
|
||||||
|
:class="{
|
||||||
|
'pc-board--dense': dense,
|
||||||
|
'pc-board--large': large,
|
||||||
|
'pc-board--dark': dark,
|
||||||
|
'pc-board--interactive': interactive,
|
||||||
|
}"
|
||||||
|
role="group"
|
||||||
|
:aria-label="label"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="interactive ? 'button' : 'div'"
|
||||||
|
v-for="day in days"
|
||||||
|
:key="day.date"
|
||||||
|
class="pc-board__day"
|
||||||
|
:class="{
|
||||||
|
'pc-board__day--peak': day.date === peakDate,
|
||||||
|
'pc-board__day--selected': day.date === selectedDate,
|
||||||
|
}"
|
||||||
|
:type="interactive ? 'button' : undefined"
|
||||||
|
:aria-pressed="interactive ? day.date === selectedDate : undefined"
|
||||||
|
:aria-label="interactive ? dayLabel(day) : undefined"
|
||||||
|
@click="activate(day)"
|
||||||
|
>
|
||||||
|
<span class="pc-board__head">
|
||||||
|
<span class="pc-board__weekday">{{ day.weekday }}</span>
|
||||||
|
<span class="pc-board__date">{{ day.dayNumber }}</span>
|
||||||
|
<span v-if="day.date === peakDate" class="pc-board__peak" aria-hidden="true">Peak</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<PulseLine
|
||||||
|
v-if="showPulse && day.hours.length"
|
||||||
|
class="pc-board__pulse"
|
||||||
|
:points="pulseOf(day)"
|
||||||
|
:height="dense ? 16 : large ? 38 : 22"
|
||||||
|
:show-peak="false"
|
||||||
|
:label="`Forecast footfall for ${day.weekdayLong} ${day.dayNumber}`"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span class="pc-board__track" aria-hidden="true">
|
||||||
|
<span
|
||||||
|
v-for="shift in day.shifts"
|
||||||
|
:key="`${shift.date}-${shift.start}`"
|
||||||
|
class="pc-board__block"
|
||||||
|
:class="{ 'pc-board__block--short': duration(shift) < 3 }"
|
||||||
|
:style="{ flex: `${duration(shift)} 1 0` }"
|
||||||
|
>
|
||||||
|
<span class="pc-board__staff">{{ shift.staff }}</span>
|
||||||
|
<span v-if="!dense" class="pc-board__time">{{ shift.start }}–{{ shift.end }}</span>
|
||||||
|
</span>
|
||||||
|
<span v-if="!day.shifts.length" class="pc-board__empty">No shifts</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class="pc-board__foot" aria-hidden="true">
|
||||||
|
<span class="pc-board__hours">{{ day.staffHours }}h</span>
|
||||||
|
<span v-if="!dense" class="pc-board__peakstaff">{{ day.peakStaff }} peak</span>
|
||||||
|
</span>
|
||||||
|
</component>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pc-board {
|
||||||
|
--pc-board-block: var(--pc-paper-2, #e9e3d7);
|
||||||
|
--pc-board-border: var(--pc-line-strong, #a99f8e);
|
||||||
|
--pc-board-text: var(--pc-ink, #16130f);
|
||||||
|
display: grid;
|
||||||
|
grid-auto-flow: column;
|
||||||
|
grid-auto-columns: minmax(0, 1fr);
|
||||||
|
gap: 1px;
|
||||||
|
width: 100%;
|
||||||
|
background: var(--pc-line, #d3caba);
|
||||||
|
border-block: 1px solid var(--pc-board-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense {
|
||||||
|
gap: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day {
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.35rem;
|
||||||
|
padding: 0.55rem 0.5rem 0.5rem;
|
||||||
|
border: 0;
|
||||||
|
background: var(--pc-paper, #f4efe6);
|
||||||
|
color: var(--pc-board-text);
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--interactive .pc-board__day {
|
||||||
|
min-height: 44px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 160ms ease, outline-color 160ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--interactive .pc-board__day:hover {
|
||||||
|
background: var(--pc-paper-2, #e9e3d7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day:focus-visible {
|
||||||
|
outline: 2px solid var(--pc-focus, #b63a00);
|
||||||
|
outline-offset: -3px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day--peak {
|
||||||
|
background: var(--pc-signal-wash, #ffe4d6);
|
||||||
|
box-shadow: inset 0 3px 0 var(--pc-signal, #e84100);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day--selected {
|
||||||
|
outline: 2px solid var(--pc-ink, #16130f);
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.3rem;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__weekday {
|
||||||
|
color: var(--pc-muted, #6e665a);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__date {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__peak {
|
||||||
|
margin-inline-start: auto;
|
||||||
|
color: var(--pc-signal-text, #b63a00);
|
||||||
|
font-size: 0.55rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: 0.08em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__pulse {
|
||||||
|
--pc-pulse-color: var(--pc-board-border);
|
||||||
|
margin-block: 0.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__track {
|
||||||
|
display: flex;
|
||||||
|
min-height: 9rem;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__block {
|
||||||
|
display: flex;
|
||||||
|
min-height: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.05rem;
|
||||||
|
padding: 0.2rem 0.35rem;
|
||||||
|
border: 1px solid var(--pc-board-border);
|
||||||
|
background: var(--pc-board-block);
|
||||||
|
color: var(--pc-board-text);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day--peak .pc-board__block {
|
||||||
|
border-color: var(--pc-signal-text, #b63a00);
|
||||||
|
background: var(--pc-signal, #e84100);
|
||||||
|
color: var(--pc-ink, #16130f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__staff {
|
||||||
|
font-size: 1.35rem;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 0.9;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__time {
|
||||||
|
color: var(--pc-ink-2, #2a261f);
|
||||||
|
font-size: 0.55rem;
|
||||||
|
font-weight: 650;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__day--peak .pc-board__time {
|
||||||
|
color: var(--pc-ink, #16130f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__block--short .pc-board__time {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__block--short .pc-board__staff {
|
||||||
|
font-size: 1.05rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__empty {
|
||||||
|
display: grid;
|
||||||
|
flex: 1;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px dashed var(--pc-board-border);
|
||||||
|
color: var(--pc-muted, #6e665a);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__foot {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.2rem;
|
||||||
|
margin-top: auto;
|
||||||
|
color: var(--pc-muted, #6e665a);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__hours {
|
||||||
|
color: var(--pc-board-text);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board__peakstaff {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dense phone/stage variants */
|
||||||
|
.pc-board--dense .pc-board__day {
|
||||||
|
padding: 0.35rem 0.25rem 0.3rem;
|
||||||
|
gap: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__track {
|
||||||
|
min-height: 6.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__staff {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__weekday {
|
||||||
|
font-size: 0.52rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__date {
|
||||||
|
font-size: 0.78rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__foot {
|
||||||
|
font-size: 0.52rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dense .pc-board__peak {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Projector variant */
|
||||||
|
.pc-board--large {
|
||||||
|
gap: 2px;
|
||||||
|
border-block-width: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__day {
|
||||||
|
gap: 0.7rem;
|
||||||
|
padding: 1rem 0.9rem 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__weekday {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__date {
|
||||||
|
font-size: 1.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__peak {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__track {
|
||||||
|
min-height: 21rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__staff {
|
||||||
|
font-size: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__time {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__block {
|
||||||
|
padding: 0.55rem 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--large .pc-board__foot {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark board variant */
|
||||||
|
.pc-board--dark {
|
||||||
|
--pc-board-block: var(--pc-dark-2, #191c18);
|
||||||
|
--pc-board-border: var(--pc-dark-line, #343a31);
|
||||||
|
--pc-board-text: var(--pc-paper, #f4efe6);
|
||||||
|
background: var(--pc-dark-line, #343a31);
|
||||||
|
border-color: var(--pc-dark-line, #343a31);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__day {
|
||||||
|
background: var(--pc-dark, #0e100e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark.pc-board--interactive .pc-board__day:hover {
|
||||||
|
background: var(--pc-dark-2, #191c18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__day--peak {
|
||||||
|
background: color-mix(in srgb, var(--pc-signal-bright, #ff6a2a) 12%, var(--pc-dark, #0e100e));
|
||||||
|
box-shadow: inset 0 3px 0 var(--pc-signal-bright, #ff6a2a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__day--selected {
|
||||||
|
outline-color: var(--pc-paper, #f4efe6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__weekday,
|
||||||
|
.pc-board--dark .pc-board__foot,
|
||||||
|
.pc-board--dark .pc-board__peakstaff,
|
||||||
|
.pc-board--dark .pc-board__time {
|
||||||
|
color: var(--pc-dark-muted, #b4ae9f);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__peak {
|
||||||
|
color: var(--pc-signal-bright, #ff6a2a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__day--peak .pc-board__block {
|
||||||
|
border-color: var(--pc-signal-bright, #ff6a2a);
|
||||||
|
background: var(--pc-signal-bright, #ff6a2a);
|
||||||
|
color: var(--pc-dark, #0e100e);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__day--peak .pc-board__time {
|
||||||
|
color: color-mix(in srgb, var(--pc-dark, #0e100e) 80%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__hours {
|
||||||
|
color: var(--pc-paper, #f4efe6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc-board--dark .pc-board__pulse {
|
||||||
|
--pc-pulse-color: var(--pc-dark-line, #343a31);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type { CoolCityBundle } from '#shared/cool'
|
||||||
|
|
||||||
|
export async function useCoolCityData() {
|
||||||
|
const { data } = await useFetch<CoolCityBundle>('/cool-city/city-gap.json', {
|
||||||
|
key: 'cool-city-gap',
|
||||||
|
})
|
||||||
|
return { city: data }
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { defaultCoolState, emptyCoolTally } from '#shared/cool'
|
||||||
|
import type { CoolDemoState, CoolRound, CoolVoteTally } from '#shared/cool'
|
||||||
|
|
||||||
|
/** State + tally polling for the stage and phone. 2 s is the demo fallback. */
|
||||||
|
export function useCoolDemo(
|
||||||
|
round: Ref<CoolRound>,
|
||||||
|
initialState?: CoolDemoState | null,
|
||||||
|
initialTally?: CoolVoteTally | null,
|
||||||
|
) {
|
||||||
|
const state = ref<CoolDemoState>(initialState ?? defaultCoolState(round.value))
|
||||||
|
const tally = ref<CoolVoteTally>(initialTally ?? emptyCoolTally(round.value))
|
||||||
|
const feedError = ref(false)
|
||||||
|
let timer: ReturnType<typeof setInterval> | undefined
|
||||||
|
|
||||||
|
watch(round, () => {
|
||||||
|
state.value = defaultCoolState(round.value)
|
||||||
|
tally.value = emptyCoolTally(round.value)
|
||||||
|
void poll()
|
||||||
|
})
|
||||||
|
|
||||||
|
async function poll() {
|
||||||
|
const [stateResult, tallyResult] = await Promise.allSettled([
|
||||||
|
$fetch<CoolDemoState>('/api/cool/state', {
|
||||||
|
query: { round: round.value },
|
||||||
|
headers: { accept: 'application/json', 'cache-control': 'no-cache' },
|
||||||
|
}),
|
||||||
|
$fetch<CoolVoteTally>('/api/cool/vote', {
|
||||||
|
query: { round: round.value },
|
||||||
|
headers: { accept: 'application/json', 'cache-control': 'no-cache' },
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
if (stateResult.status === 'fulfilled') state.value = stateResult.value
|
||||||
|
if (tallyResult.status === 'fulfilled') tally.value = tallyResult.value
|
||||||
|
feedError.value = stateResult.status === 'rejected' || tallyResult.status === 'rejected'
|
||||||
|
}
|
||||||
|
|
||||||
|
async function update(patch: Partial<Pick<CoolDemoState, 'time' | 'selectedRoute' | 'scene' | 'voteOpen'>>) {
|
||||||
|
state.value = { ...state.value, ...patch, updatedAt: new Date().toISOString() }
|
||||||
|
try {
|
||||||
|
const next = await $fetch<CoolDemoState>('/api/cool/state', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { round: round.value, ...patch },
|
||||||
|
})
|
||||||
|
state.value = next
|
||||||
|
} catch {
|
||||||
|
feedError.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reset() {
|
||||||
|
try {
|
||||||
|
const result = await $fetch<{ state: CoolDemoState; tally: CoolVoteTally }>('/api/cool/reset', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { round: round.value },
|
||||||
|
})
|
||||||
|
state.value = result.state
|
||||||
|
tally.value = result.tally
|
||||||
|
feedError.value = false
|
||||||
|
} catch {
|
||||||
|
feedError.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
timer = setInterval(() => void poll(), 2000)
|
||||||
|
})
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (timer) clearInterval(timer)
|
||||||
|
})
|
||||||
|
|
||||||
|
return { state, tally, feedError, update, reset, poll }
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { pendingCoolRouteBundle } from '#shared/cool'
|
||||||
|
import type { CoolRouteBundle, CoolRouteId, CoolRouteValues, CoolTime } from '#shared/cool'
|
||||||
|
|
||||||
|
export async function useCoolRouteData() {
|
||||||
|
const { data } = await useFetch<CoolRouteBundle>('/cool-city/route.json', {
|
||||||
|
key: 'cool-route-bundle',
|
||||||
|
})
|
||||||
|
const bundle = computed(() => data.value ?? pendingCoolRouteBundle())
|
||||||
|
const pending = computed(() => bundle.value.status !== 'ready')
|
||||||
|
|
||||||
|
function routeForTime(time: CoolTime | string): CoolRouteId {
|
||||||
|
return bundle.value.recommendationByTime[time] ?? 'shortest'
|
||||||
|
}
|
||||||
|
|
||||||
|
function valuesFor(routeId: CoolRouteId, time: CoolTime | string): CoolRouteValues | null {
|
||||||
|
return bundle.value.routes.find((route) => route.id === routeId)?.values[time] ?? null
|
||||||
|
}
|
||||||
|
|
||||||
|
return { bundle, pending, routeForTime, valuesFor }
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import { isCoolRouteId } from '#shared/cool'
|
||||||
|
import type { CoolRouteId, CoolRound, CoolVoteResponse, CoolVoteTally } from '#shared/cool'
|
||||||
|
|
||||||
|
const SESSION_KEY = 'cool-city-session-v1'
|
||||||
|
|
||||||
|
/** One anonymous vote per browser and round. No PII. */
|
||||||
|
export function useCoolVote(round: Ref<CoolRound>) {
|
||||||
|
const mounted = ref(false)
|
||||||
|
const sessionId = ref('')
|
||||||
|
const myVote = ref<CoolRouteId | ''>('')
|
||||||
|
const busy = ref(false)
|
||||||
|
const error = ref('')
|
||||||
|
const tally = ref<CoolVoteTally | null>(null)
|
||||||
|
|
||||||
|
function voteKey(value: CoolRound) {
|
||||||
|
return `cool-city-vote-v1:${value}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeSessionId(): string {
|
||||||
|
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) return crypto.randomUUID()
|
||||||
|
return `cool_${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function readStoredVote(value: CoolRound): CoolRouteId | '' {
|
||||||
|
const stored = localStorage.getItem(voteKey(value))
|
||||||
|
return isCoolRouteId(stored) ? stored : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
let storedSession = localStorage.getItem(SESSION_KEY)
|
||||||
|
if (!storedSession || storedSession.length < 8) {
|
||||||
|
storedSession = makeSessionId()
|
||||||
|
localStorage.setItem(SESSION_KEY, storedSession)
|
||||||
|
}
|
||||||
|
sessionId.value = storedSession
|
||||||
|
myVote.value = readStoredVote(round.value)
|
||||||
|
mounted.value = true
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(round, (value) => {
|
||||||
|
if (!mounted.value) return
|
||||||
|
myVote.value = readStoredVote(value)
|
||||||
|
tally.value = null
|
||||||
|
error.value = ''
|
||||||
|
})
|
||||||
|
|
||||||
|
async function vote(route: CoolRouteId) {
|
||||||
|
if (!mounted.value || busy.value || myVote.value || !sessionId.value) return
|
||||||
|
busy.value = true
|
||||||
|
error.value = ''
|
||||||
|
try {
|
||||||
|
const response = await $fetch<CoolVoteResponse>('/api/cool/vote', {
|
||||||
|
method: 'POST',
|
||||||
|
body: { route, sessionId: sessionId.value, round: round.value },
|
||||||
|
})
|
||||||
|
myVote.value = response.yourRoute
|
||||||
|
tally.value = response.tally
|
||||||
|
localStorage.setItem(voteKey(round.value), response.yourRoute)
|
||||||
|
} catch (cause) {
|
||||||
|
const status = (cause as { statusCode?: number; status?: number })?.statusCode ??
|
||||||
|
(cause as { status?: number })?.status
|
||||||
|
error.value =
|
||||||
|
status === 409
|
||||||
|
? 'Voting is not open right now.'
|
||||||
|
: 'The vote could not be recorded. Try again.'
|
||||||
|
} finally {
|
||||||
|
busy.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { mounted, myVote, busy, error, tally, vote }
|
||||||
|
}
|
||||||
+1
-1
@@ -18,7 +18,7 @@ const usingMock = computed(() => ['1', 'true'].includes(String(config.public.use
|
|||||||
<p class="eyebrow">About · method, data and limits</p>
|
<p class="eyebrow">About · method, data and limits</p>
|
||||||
<OnyxHeadline is="h1">A decision aid, not a city-wide truth.</OnyxHeadline>
|
<OnyxHeadline is="h1">A decision aid, not a city-wide truth.</OnyxHeadline>
|
||||||
<p class="lede">
|
<p class="lede">
|
||||||
PulseCast turns a footfall forecast into a next-week staffing plan. The forecast is a model output; the
|
PulseCast turns a footfall forecast into a weekly staffing plan. The forecast is a model output; the
|
||||||
staffing rule is a transparent heuristic. Both are shown, editable, and bounded.
|
staffing rule is a transparent heuristic. Both are shown, editable, and bounded.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,447 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { isCoolRound } from '#shared/cool'
|
||||||
|
import type { CoolCityCatchment } from '#shared/cool'
|
||||||
|
import { formatPercent } from '~/utils/format'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const round = isCoolRound(route.query.round) ? route.query.round : 'preselection'
|
||||||
|
const { city } = await useCoolCityData()
|
||||||
|
const selectedRank = ref(1)
|
||||||
|
|
||||||
|
const catchments = computed(() => city.value?.catchments ?? [])
|
||||||
|
const selected = computed<CoolCityCatchment | undefined>(
|
||||||
|
() => catchments.value.find((item) => item.rank === selectedRank.value) ?? catchments.value[0],
|
||||||
|
)
|
||||||
|
const top = computed(() => catchments.value[0])
|
||||||
|
const maxIndex = computed(() => Math.max(...catchments.value.map((item) => item.scores.gap_index), 0.001))
|
||||||
|
const places = computed(() => city.value?.official_cool_places ?? [])
|
||||||
|
|
||||||
|
const help = computed(() => {
|
||||||
|
const item = selected.value
|
||||||
|
if (!item) return []
|
||||||
|
const result: string[] = []
|
||||||
|
if (item.inputs.shade.tree_canopy_share_of_land_proxy < 0.05) result.push('Shade')
|
||||||
|
if (item.inputs.access.nearest_public_drinking_water_m > 150) result.push('Water')
|
||||||
|
if (item.inputs.access.nearest_bench_m > 100) result.push('Bench')
|
||||||
|
if (item.inputs.access.nearest_step_free_anchor_m > 100) result.push('Step-free access')
|
||||||
|
return result.length ? result : ['Maintain access']
|
||||||
|
})
|
||||||
|
|
||||||
|
const helpReason = computed(() => {
|
||||||
|
const item = selected.value
|
||||||
|
if (!item) return ''
|
||||||
|
return `p95 ${item.inputs.footfall.p95.toFixed(1)} · canopy ${formatPercent(item.inputs.shade.tree_canopy_share_of_land_proxy * 100, 1)} · water ${Math.round(item.inputs.access.nearest_public_drinking_water_m)} m`
|
||||||
|
})
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: 'Cool City — where the city should act first',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content:
|
||||||
|
'A relative cooling-gap index across eight Heilbronn sensor catchments. Ranked priorities for shade, water and benches; not a temperature map.',
|
||||||
|
},
|
||||||
|
{ name: 'theme-color', content: '#f6f3ee' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="cc-city">
|
||||||
|
<header class="cc-topbar">
|
||||||
|
<NuxtLink to="/cool" class="cc-wordmark">
|
||||||
|
<span class="cc-mark" aria-hidden="true" />
|
||||||
|
Cool City
|
||||||
|
</NuxtLink>
|
||||||
|
<span class="cc-topbar__place">Heilbronn · city view</span>
|
||||||
|
<NuxtLink class="cc-city__back" :to="{ path: '/cool/stage', query: { round } }">Back to route</NuxtLink>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="cc-city__main">
|
||||||
|
<header class="cc-city__head">
|
||||||
|
<h1>Where the city should act first.</h1>
|
||||||
|
<p class="cc-city__lede">
|
||||||
|
Eight sensor catchments, ranked by footfall, shade deficit, access deficit and vulnerability.
|
||||||
|
It is a relative priority list, not a temperature map.
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="cc-city__grid">
|
||||||
|
<section class="cc-city__map" aria-label="Map of sensor catchments and official cool places">
|
||||||
|
<CoolPlacesMap
|
||||||
|
:places="places"
|
||||||
|
:catchments="catchments"
|
||||||
|
:selected-rank="selectedRank"
|
||||||
|
show-catchments
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<aside class="cc-city__list" aria-labelledby="ranked-title">
|
||||||
|
<h2 id="ranked-title">Ranked catchments</h2>
|
||||||
|
<div class="cc-city__rows">
|
||||||
|
<button
|
||||||
|
v-for="item in catchments"
|
||||||
|
:key="item.sensor_id"
|
||||||
|
type="button"
|
||||||
|
class="cc-city__row"
|
||||||
|
:class="{ 'is-selected': selectedRank === item.rank }"
|
||||||
|
:aria-pressed="selectedRank === item.rank"
|
||||||
|
@click="selectedRank = item.rank"
|
||||||
|
>
|
||||||
|
<span class="cc-city__rank">{{ item.rank }}</span>
|
||||||
|
<span class="cc-city__name">{{ item.sensor_name }}</span>
|
||||||
|
<span class="cc-city__bar"><i :style="{ width: `${(item.scores.gap_index / maxIndex) * 100}%` }" /></span>
|
||||||
|
<span class="cc-city__score">{{ item.scores.gap_index.toFixed(3) }}</span>
|
||||||
|
<span class="cc-city__reason">{{ item.reason }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section v-if="selected" class="cc-city__detail" aria-labelledby="help-title">
|
||||||
|
<div class="cc-city__detail-copy">
|
||||||
|
<h2 id="help-title">What would help</h2>
|
||||||
|
<p class="cc-city__rankline">Rank {{ selected.rank }} · {{ selected.sensor_name }} · {{ selected.sensor_id }}</p>
|
||||||
|
<p class="cc-city__lede">{{ selected.reason }}</p>
|
||||||
|
<ul class="cc-city__help">
|
||||||
|
<li v-for="item in help" :key="item">{{ item }}</li>
|
||||||
|
</ul>
|
||||||
|
<p class="cc-city__fine">{{ helpReason }}</p>
|
||||||
|
</div>
|
||||||
|
<dl class="cc-city__facts">
|
||||||
|
<div><dt>Gap index</dt><dd>{{ selected.scores.gap_index.toFixed(3) }}</dd></div>
|
||||||
|
<div><dt>Nearest cool place</dt><dd>{{ selected.nearest_cool_place?.name ?? '—' }}</dd></div>
|
||||||
|
<div><dt>Distance</dt><dd>{{ selected.nearest_cool_place ? `${Math.round(selected.nearest_cool_place.distance_m)} m` : '—' }}</dd></div>
|
||||||
|
<div><dt>Ranking note</dt><dd>Top 2 are co-priority</dd></div>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<details class="cc-city__method">
|
||||||
|
<summary>How the gap is calculated</summary>
|
||||||
|
<div>
|
||||||
|
<p>Gap index = 0.40 × footfall + 0.30 × shade deficit + 0.20 × access deficit + 0.10 × vulnerability. The weights are deliberative, not calibrated against heat outcomes.</p>
|
||||||
|
<p>Footfall is a relative device index, not people. Shade is modeled from building footprints and tree-canopy proxies. Access combines distance to water, benches, toilets and step-free anchors within 300 m.</p>
|
||||||
|
<p><strong>Vulnerability is constant across all eight catchments</strong> in this dataset (17.26% aged 65+), so it does not differentiate the ranking.</p>
|
||||||
|
<p>Catchment = 300 m Euclidean radius, not a network isochrone. No city-wide heatmap. Top ranks 1 and 2 differ by 2.5%; treat them as co-priority.</p>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<footer class="cc-city__footer">
|
||||||
|
<span>Cool City · {{ city?.meta.generated ?? '—' }} · {{ places.length }} official cool places</span>
|
||||||
|
<NuxtLink :to="{ path: '/cool/stage', query: { round } }">Back to route</NuxtLink>
|
||||||
|
</footer>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cc-city {
|
||||||
|
min-height: 100dvh;
|
||||||
|
background: var(--cc-ground);
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__back {
|
||||||
|
margin-inline-start: auto;
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 650;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__main {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 78rem;
|
||||||
|
margin-inline: auto;
|
||||||
|
padding: 1.3rem 1.2rem 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__head {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.7rem;
|
||||||
|
padding-bottom: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__rankline {
|
||||||
|
margin: 0.25rem 0 0.3rem;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__head h1 {
|
||||||
|
max-width: 15ch;
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(2.8rem, 6vw, 5.2rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.06em;
|
||||||
|
line-height: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__lede {
|
||||||
|
max-width: 64ch;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1.15fr) minmax(20rem, 0.85fr);
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__map {
|
||||||
|
min-height: 30rem;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 28px;
|
||||||
|
background: var(--cc-ground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__list {
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 28px;
|
||||||
|
background: var(--cc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__list h2 {
|
||||||
|
margin: 0 0 0.6rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__rows {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.6rem minmax(0, 1fr) 3.2rem;
|
||||||
|
grid-template-rows: auto auto auto;
|
||||||
|
gap: 0.15rem 0.45rem;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.55rem 0.2rem;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 1px solid var(--cc-line);
|
||||||
|
background: transparent;
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__rank {
|
||||||
|
grid-row: 1 / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__name {
|
||||||
|
grid-column: 2;
|
||||||
|
grid-row: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__score {
|
||||||
|
grid-column: 3;
|
||||||
|
grid-row: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__bar {
|
||||||
|
grid-column: 2 / 4;
|
||||||
|
grid-row: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__reason {
|
||||||
|
grid-column: 2 / 4;
|
||||||
|
grid-row: 3;
|
||||||
|
overflow: hidden;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.66rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__row:hover {
|
||||||
|
background: color-mix(in srgb, var(--cc-shade) 7%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__row.is-selected {
|
||||||
|
background: color-mix(in srgb, var(--cc-heat) 8%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__row:focus-visible {
|
||||||
|
outline: 2px solid var(--cc-focus);
|
||||||
|
outline-offset: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__rank {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.76rem;
|
||||||
|
font-weight: 800;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__name {
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 650;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__bar {
|
||||||
|
height: 0.55rem;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--cc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__bar i {
|
||||||
|
display: block;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: inherit;
|
||||||
|
background: var(--cc-heat);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__score {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
text-align: right;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__detail {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
|
||||||
|
gap: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 28px;
|
||||||
|
background: var(--cc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__detail-copy h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.7rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__help {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.4rem;
|
||||||
|
margin: 0.7rem 0 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__help li {
|
||||||
|
padding: 0.25rem 0.6rem;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: var(--cc-heat-soft);
|
||||||
|
color: var(--cc-heat-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__fine {
|
||||||
|
margin: 0.4rem 0 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__facts {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 0.7rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__facts dt {
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__facts dd {
|
||||||
|
margin: 0.2rem 0 0;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 650;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__method {
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding: 0.9rem 1rem;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 24px;
|
||||||
|
background: var(--cc-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__method summary {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 650;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__method div {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding-top: 0.7rem;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__method p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__method strong {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__footer {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.5rem 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
padding-top: 0.8rem;
|
||||||
|
border-top: 1px solid var(--cc-line);
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__footer a {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.cc-city__grid,
|
||||||
|
.cc-city__detail {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__map {
|
||||||
|
min-height: 22rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-city__name {
|
||||||
|
overflow: visible;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,419 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { COOL_ROUTE_IDS, COOL_ROUTE_LABELS, COOL_TIMES, isCoolRound } from '#shared/cool'
|
||||||
|
import type { CoolDemoState, CoolRouteId, CoolRound, CoolVoteTally } from '#shared/cool'
|
||||||
|
import { coolMinutes, coolShade } from '~/utils/cool'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const round = ref<CoolRound>(isCoolRound(route.query.round) ? route.query.round : 'preselection')
|
||||||
|
const voteOnly = computed(() => route.query.vote === '1')
|
||||||
|
|
||||||
|
const { bundle } = await useCoolRouteData()
|
||||||
|
const { data: initialState } = await useFetch<CoolDemoState>('/api/cool/state', {
|
||||||
|
query: computed(() => ({ round: round.value })),
|
||||||
|
})
|
||||||
|
const { data: initialTally } = await useFetch<CoolVoteTally>('/api/cool/vote', {
|
||||||
|
query: computed(() => ({ round: round.value })),
|
||||||
|
})
|
||||||
|
const { state, update } = useCoolDemo(round, initialState.value, initialTally.value)
|
||||||
|
const { myVote, busy, error: voteError, tally, mounted, vote } = useCoolVote(round)
|
||||||
|
|
||||||
|
const timeIndex = computed({
|
||||||
|
get: () => Math.max(0, COOL_TIMES.indexOf(state.value.time)),
|
||||||
|
set: (index: number) => {
|
||||||
|
const time = COOL_TIMES[index] ?? '10:00'
|
||||||
|
const nextRoute = bundle.value.recommendationByTime[time] ?? state.value.selectedRoute
|
||||||
|
void update({ time, selectedRoute: nextRoute })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const timeMarks = COOL_TIMES.map((time, index) => ({ value: index, label: time }))
|
||||||
|
const modelLabel = computed(() => bundle.value.modelLabel)
|
||||||
|
const myVoteLabel = computed(() => (myVote.value ? COOL_ROUTE_LABELS[myVote.value] : ''))
|
||||||
|
const voteStatus = computed(() => {
|
||||||
|
if (myVote.value) {
|
||||||
|
return `${myVoteLabel.value} recorded${tally.value ? ` · ${tally.value.total} ${tally.value.total === 1 ? 'vote' : 'votes'} in this room` : ''}.`
|
||||||
|
}
|
||||||
|
if (state.value.scene === 'locked' || state.value.scene === 'coda') return 'The vote is closed. The stage has the result.'
|
||||||
|
return 'The vote opens when the presenter starts it.'
|
||||||
|
})
|
||||||
|
|
||||||
|
const routeReasons: Record<CoolRouteId, string> = {
|
||||||
|
shortest: 'Fastest, but a 15% ramp at the Marktplatz tram crossing.',
|
||||||
|
shaded: 'Twice as long, so more minutes in the sun.',
|
||||||
|
accessible: 'One minute longer, no ramp, water and benches.',
|
||||||
|
}
|
||||||
|
const routeOptions = COOL_ROUTE_IDS.map((id) => ({ value: id, label: COOL_ROUTE_LABELS[id] }))
|
||||||
|
|
||||||
|
// The phone opens on the model's route. The one pristine state is Shortest at
|
||||||
|
// 10:00; in that case show Accessible for Ruth. Any explicit stage choice wins.
|
||||||
|
const localRoute = ref<CoolRouteId>(
|
||||||
|
state.value.selectedRoute === 'shortest' && state.value.time === '10:00'
|
||||||
|
? 'accessible'
|
||||||
|
: state.value.selectedRoute,
|
||||||
|
)
|
||||||
|
let lastRemoteRoute = state.value.selectedRoute
|
||||||
|
|
||||||
|
const activeRoute = computed<CoolRouteId>({
|
||||||
|
get: () => localRoute.value,
|
||||||
|
set: (value) => {
|
||||||
|
localRoute.value = value
|
||||||
|
lastRemoteRoute = value
|
||||||
|
void update({ selectedRoute: value })
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => state.value.selectedRoute,
|
||||||
|
(value) => {
|
||||||
|
if (value === lastRemoteRoute) return
|
||||||
|
lastRemoteRoute = value
|
||||||
|
localRoute.value = value
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const activeRouteOption = computed(
|
||||||
|
() => bundle.value.routes.find((item) => item.id === activeRoute.value) ?? bundle.value.routes[0],
|
||||||
|
)
|
||||||
|
const activeValues = computed(
|
||||||
|
() => activeRouteOption.value?.values[state.value.time] ?? null,
|
||||||
|
)
|
||||||
|
|
||||||
|
const tradeoff = computed(() => {
|
||||||
|
const shortest = bundle.value.routes.find((item) => item.id === 'shortest')
|
||||||
|
const shaded = bundle.value.routes.find((item) => item.id === 'shaded')
|
||||||
|
const accessible = bundle.value.routes.find((item) => item.id === 'accessible')
|
||||||
|
if (!shortest || !shaded || !accessible) return ''
|
||||||
|
const shortestValues = shortest.values[state.value.time]
|
||||||
|
const shadedValues = shaded.values[state.value.time]
|
||||||
|
const accessibleValues = accessible.values[state.value.time]
|
||||||
|
if (!shortestValues || !shadedValues || !accessibleValues) return ''
|
||||||
|
const shortestRamp = shortest.ramp ? shortest.ramp.incline.replace('.0%', '%') : 'no'
|
||||||
|
return `Shaded: ${coolShade(shadedValues.shadePct)} shade, but ${coolMinutes(shadedValues.directSunMin)} sun because it is twice as long. Shortest: ${coolMinutes(shortestValues.directSunMin)} sun, ${shortestRamp} ramp. Accessible: ${coolMinutes(accessibleValues.directSunMin)} sun, no ramp.`
|
||||||
|
})
|
||||||
|
|
||||||
|
function tooltipTime(value: number): string {
|
||||||
|
return COOL_TIMES[value] ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubmit(routeId: CoolRouteId) {
|
||||||
|
void vote(routeId)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.query.round,
|
||||||
|
(value) => {
|
||||||
|
if (isCoolRound(value)) round.value = value
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
title: voteOnly.value ? 'Vote — Cool City' : 'Cool City — a heat-safe route through Heilbronn',
|
||||||
|
meta: [
|
||||||
|
{
|
||||||
|
name: 'description',
|
||||||
|
content: voteOnly.value
|
||||||
|
? 'Which route for Ruth? One anonymous vote for the Cool City demo.'
|
||||||
|
: 'Cool City is Heilbronn’s public heat-safe route: shortest, shaded and accessible options from Stadtgalerie to Marktplatz, with modelled shade.',
|
||||||
|
},
|
||||||
|
{ name: 'theme-color', content: '#f6f3ee' },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="cc-cool">
|
||||||
|
<header class="cc-topbar">
|
||||||
|
<NuxtLink to="/cool" class="cc-wordmark">
|
||||||
|
<span class="cc-mark" aria-hidden="true" />
|
||||||
|
Cool City
|
||||||
|
</NuxtLink>
|
||||||
|
<span class="cc-topbar__place">Heilbronn <span aria-hidden="true">·</span> {{ state.time }}</span>
|
||||||
|
<span class="cc-topbar__status"><i aria-hidden="true" /> Public route</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main v-if="voteOnly" class="cc-vote-only">
|
||||||
|
<div class="cc-vote-only__inner">
|
||||||
|
<h1>Which route for Ruth?</h1>
|
||||||
|
<p class="cc-vote-only__lede">Shortest, shaded, or accessible? One tap. No name, no location.</p>
|
||||||
|
|
||||||
|
<div v-if="!myVote && state.voteOpen" class="cc-vote-only__buttons">
|
||||||
|
<OnyxButton
|
||||||
|
v-for="id in COOL_ROUTE_IDS"
|
||||||
|
:key="id"
|
||||||
|
:label="COOL_ROUTE_LABELS[id]"
|
||||||
|
mode="outline"
|
||||||
|
:disabled="busy"
|
||||||
|
@click="onSubmit(id)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else class="cc-vote-only__confirmation" role="status">
|
||||||
|
<p v-if="myVote">You chose <strong>{{ myVoteLabel }}</strong>.</p>
|
||||||
|
<p v-else>{{ voteStatus }}</p>
|
||||||
|
<p class="cc-fine">Aggregate only. One vote per browser and round.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="voteError" class="cc-error" role="alert">{{ voteError }}</p>
|
||||||
|
<p v-if="!mounted" class="cc-fine">Preparing your anonymous vote…</p>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<main v-else class="cc-phone">
|
||||||
|
<section class="cc-ruth" aria-labelledby="ruth-title">
|
||||||
|
<h1 id="ruth-title">Ruth, 78, needs to reach Marktplatz.</h1>
|
||||||
|
<p class="cc-ruth__copy">A hot day in Heilbronn. She needs bread.</p>
|
||||||
|
<span class="cc-ruth__tag">Composite persona — illustrative, not a real person</span>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="cc-panel cc-time" aria-labelledby="time-title">
|
||||||
|
<div class="cc-time__head">
|
||||||
|
<h2 id="time-title">When?</h2>
|
||||||
|
<strong>{{ state.time }}</strong>
|
||||||
|
</div>
|
||||||
|
<OnyxSlider
|
||||||
|
v-model="timeIndex"
|
||||||
|
label="Time of day"
|
||||||
|
:min="0"
|
||||||
|
:max="COOL_TIMES.length - 1"
|
||||||
|
:step="1"
|
||||||
|
:marks="timeMarks"
|
||||||
|
:tooltip="{ formatter: tooltipTime }"
|
||||||
|
/>
|
||||||
|
<p class="cc-fine">Modeled shade, not measured. The stage follows this time.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="cc-route" aria-labelledby="route-title">
|
||||||
|
<div class="cc-route__head">
|
||||||
|
<h2 id="route-title">Which route for Ruth?</h2>
|
||||||
|
<p class="cc-route__model">Model recommendation · <strong>{{ modelLabel }}</strong></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<OnyxSegmentedControl
|
||||||
|
v-model="activeRoute"
|
||||||
|
class="cc-route__segment"
|
||||||
|
aria-label="Route"
|
||||||
|
name="cool-route"
|
||||||
|
:options="routeOptions"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CoolRouteCard
|
||||||
|
v-if="activeRouteOption"
|
||||||
|
:route="activeRouteOption"
|
||||||
|
:values="activeValues"
|
||||||
|
:reason="routeReasons[activeRoute]"
|
||||||
|
>
|
||||||
|
<template #action>
|
||||||
|
<div v-if="myVote" class="cc-route__vote-status" role="status">
|
||||||
|
<strong>You chose {{ myVoteLabel }}.</strong>
|
||||||
|
<span>One vote per browser.</span>
|
||||||
|
</div>
|
||||||
|
<OnyxButton
|
||||||
|
v-else-if="state.voteOpen"
|
||||||
|
:label="`Vote for ${activeRouteOption?.label ?? activeRoute}`"
|
||||||
|
color="primary"
|
||||||
|
:disabled="busy"
|
||||||
|
@click="onSubmit(activeRoute)"
|
||||||
|
/>
|
||||||
|
<p v-else class="cc-route__vote-status cc-route__vote-status--quiet">
|
||||||
|
Voting opens when the presenter starts it.
|
||||||
|
</p>
|
||||||
|
<p v-if="voteError" class="cc-error" role="alert">{{ voteError }}</p>
|
||||||
|
</template>
|
||||||
|
</CoolRouteCard>
|
||||||
|
|
||||||
|
<p v-if="tradeoff" class="cc-route__tradeoff">
|
||||||
|
<span class="cc-route__tradeoff-label">The trade-off at {{ state.time }}</span>
|
||||||
|
{{ tradeoff }}
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<details class="cc-details">
|
||||||
|
<summary>Details</summary>
|
||||||
|
<div class="cc-details__body">
|
||||||
|
<p><strong>Shade is modeled, not measured.</strong> NOAA solar position, building footprints and tree canopies on 14 Aug 2026, a 35°C clear-sky day.</p>
|
||||||
|
<p><strong>At 16:00:</strong> Shortest 359.5 m / 4.8 min, 43.8% shade, 2.7 min direct sun, 15% ramp. Shaded 732.3 m / 9.8 min, 50.0% shade, 4.9 min direct sun. Accessible 438.2 m / 5.8 min, 43.8% shade, 3.3 min direct sun, no ramp, water 2, benches 6.</p>
|
||||||
|
<p><strong>All three routes are step-free.</strong> The 15% ramp is at the Marktplatz tram crossing. The city data is a relative index: estimated devices, not people.</p>
|
||||||
|
<p class="cc-details__links">
|
||||||
|
<NuxtLink to="/cool/city">How this works</NuxtLink>
|
||||||
|
<NuxtLink to="/plan">Retail module</NuxtLink>
|
||||||
|
<NuxtLink to="/cool/stage">Stage</NuxtLink>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<footer class="cc-phone__footer">
|
||||||
|
<span>Cool City · Heilbronn</span>
|
||||||
|
<span>Modeled shade, not measured. Estimated devices, not people.</span>
|
||||||
|
</footer>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.cc-fine {
|
||||||
|
margin: 0.35rem 0 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-error {
|
||||||
|
margin: 0.45rem 0 0;
|
||||||
|
color: var(--cc-heat-text);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__buttons {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-vote-only__buttons :deep(.onyx-button) {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 52px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__head h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(1.5rem, 5.2vw, 1.9rem);
|
||||||
|
font-weight: 850;
|
||||||
|
letter-spacing: -0.045em;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__model {
|
||||||
|
margin: 0.3rem 0 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.74rem;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__model strong {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control) {
|
||||||
|
display: grid;
|
||||||
|
max-width: none;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 0.18rem;
|
||||||
|
padding: 0.22rem;
|
||||||
|
overflow: visible;
|
||||||
|
border: 1px solid var(--cc-line);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: color-mix(in srgb, var(--cc-ink) 5%, var(--cc-surface-solid));
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element) {
|
||||||
|
border-radius: 999px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--cc-ink-2);
|
||||||
|
font-family: var(--cc-font);
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element__label) {
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 42px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0.3rem 0.35rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element:hover) {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
background: color-mix(in srgb, var(--cc-ink) 4%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element:has(.onyx-segmented-control-element__input:checked)) {
|
||||||
|
background: var(--cc-ink);
|
||||||
|
color: var(--cc-ground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element:has(.onyx-segmented-control-element__input:checked):hover) {
|
||||||
|
background: var(--cc-ink);
|
||||||
|
color: var(--cc-ground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment :deep(.onyx-segmented-control-element:has(.onyx-segmented-control-element__input:focus-visible)) {
|
||||||
|
outline: 2px solid var(--cc-focus);
|
||||||
|
outline-offset: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__vote-status {
|
||||||
|
display: flex;
|
||||||
|
min-height: 48px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-content: center;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.3rem 0.55rem;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.84rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__vote-status strong {
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-weight: 750;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__vote-status--quiet {
|
||||||
|
display: block;
|
||||||
|
padding-block: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__tradeoff {
|
||||||
|
max-width: 62ch;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--cc-muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__tradeoff-label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.15rem;
|
||||||
|
color: var(--cc-ink);
|
||||||
|
font-size: 0.64rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 900px) {
|
||||||
|
.cc-route {
|
||||||
|
gap: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__head h2 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__segment {
|
||||||
|
max-width: 30rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cc-route__tradeoff {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 420px) {
|
||||||
|
.cc-route__vote-status {
|
||||||
|
display: block;
|
||||||
|
min-height: 0;
|
||||||
|
padding-block: 0.25rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -114,7 +114,7 @@ const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
|||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Forecast · {{ forecastWindow }}</p>
|
<p class="eyebrow">Forecast · {{ forecastWindow }}</p>
|
||||||
<OnyxHeadline is="h1">Next week peaks on {{ weekPeak ? formatWeekday(weekPeak.date) : '—' }}.</OnyxHeadline>
|
<OnyxHeadline is="h1">The window peaks on {{ weekPeak ? formatWeekday(weekPeak.date) : '—' }}.</OnyxHeadline>
|
||||||
<p class="lede">
|
<p class="lede">
|
||||||
A 168-hour forecast for <strong>{{ activeSensor?.name ?? 'the selected store' }}</strong>, aggregated by
|
A 168-hour forecast for <strong>{{ activeSensor?.name ?? 'the selected store' }}</strong>, aggregated by
|
||||||
day. The decision, shift blocks and hourly coverage are on <NuxtLink to="/plan">Plan</NuxtLink>.
|
day. The decision, shift blocks and hourly coverage are on <NuxtLink to="/plan">Plan</NuxtLink>.
|
||||||
|
|||||||
+535
-222
@@ -1,31 +1,34 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { iconArrowRight, iconTriangleWarning } from '@sit-onyx/icons'
|
||||||
|
import { addDays, berlinParts, planWeekStart } from '#shared/staffing'
|
||||||
|
import type { MetaResponse, ScenarioState, Sensor, SeriesResponse, StaffingResponse } from '#shared/types'
|
||||||
import {
|
import {
|
||||||
iconCalendar,
|
|
||||||
iconCloud,
|
|
||||||
iconLocationPin,
|
|
||||||
iconSunny,
|
|
||||||
iconTriangleWarning,
|
|
||||||
} from '@sit-onyx/icons'
|
|
||||||
import { weatherKind } from '#shared/insights'
|
|
||||||
import { berlinParts } from '#shared/staffing'
|
|
||||||
import type { ContextResponse, MetaResponse, Sensor, SeriesResponse } from '#shared/types'
|
|
||||||
import {
|
|
||||||
formatDate,
|
|
||||||
formatDateTime,
|
formatDateTime,
|
||||||
|
formatEuro,
|
||||||
formatNumber,
|
formatNumber,
|
||||||
formatPercent,
|
formatPercent,
|
||||||
formatShortDate,
|
|
||||||
formatTime,
|
formatTime,
|
||||||
|
formatWeekday,
|
||||||
|
weekLabel,
|
||||||
} from '~/utils/format'
|
} from '~/utils/format'
|
||||||
|
import {
|
||||||
useHead({ title: 'Now in Heilbronn — PulseCast' })
|
numberWord,
|
||||||
|
peakHourOf,
|
||||||
|
peakShiftOf,
|
||||||
|
planDays,
|
||||||
|
savingOf,
|
||||||
|
savingPctOf,
|
||||||
|
totalStaffHoursOf,
|
||||||
|
} from '~/utils/plan'
|
||||||
|
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const demoNow = String(config.public.demoNow)
|
const demoNow = String(config.public.demoNow)
|
||||||
|
|
||||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
|
||||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||||
|
const { data: liveScenarioState } = await useFetch<ScenarioState>('/api/scenario')
|
||||||
|
const live = useLiveScenario(liveScenarioState.value)
|
||||||
|
|
||||||
const sensorId = ref(
|
const sensorId = ref(
|
||||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||||
sensors.value?.[0]?.id ??
|
sensors.value?.[0]?.id ??
|
||||||
@@ -35,235 +38,545 @@ const { data: series } = await useFetch<SeriesResponse>('/api/series', {
|
|||||||
query: computed(() => ({ sensor: sensorId.value, step: '1h' })),
|
query: computed(() => ({ sensor: sensorId.value, step: '1h' })),
|
||||||
})
|
})
|
||||||
|
|
||||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
const { data: planData, status, refresh } = await useFetch<StaffingResponse>('/api/staffing', {
|
||||||
const sensorOptions = computed(() =>
|
query: computed(() => ({ sensor: sensorId.value, scenario: live.scenarioId, standard: 'standard' })),
|
||||||
(sensors.value ?? []).map((sensor) => ({ value: sensor.id, label: sensor.name })),
|
})
|
||||||
|
|
||||||
|
let lastScenarioId = live.scenarioId
|
||||||
|
watch(
|
||||||
|
() => live.revision,
|
||||||
|
() => {
|
||||||
|
if (live.scenarioId === lastScenarioId) void refresh()
|
||||||
|
lastScenarioId = live.scenarioId
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const plan = computed(() => planData.value ?? null)
|
||||||
|
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||||
|
const peakShift = computed(() => peakShiftOf(plan.value))
|
||||||
|
const peakHour = computed(() => peakHourOf(plan.value))
|
||||||
|
const totalStaffHours = computed(() => totalStaffHoursOf(plan.value))
|
||||||
|
const savingEur = computed(() => savingOf(plan.value))
|
||||||
|
const savingPct = computed(() => savingPctOf(plan.value))
|
||||||
|
const daySummaries = computed(() => planDays(plan.value))
|
||||||
|
|
||||||
|
const weekStart = computed(() => {
|
||||||
|
const first = plan.value?.hours[0]
|
||||||
|
return first ? berlinParts(first.t).date : planWeekStart(demoNow)
|
||||||
|
})
|
||||||
|
const weekEnd = computed(() => addDays(weekStart.value, 6))
|
||||||
|
const today = computed(() => berlinParts(demoNow).date)
|
||||||
|
const windowTag = computed(() => {
|
||||||
|
if (!plan.value) return 'No plan'
|
||||||
|
return weekStart.value <= today.value && today.value <= weekEnd.value ? 'Today–Friday' : 'Seven days'
|
||||||
|
})
|
||||||
|
const windowLabel = computed(() => (plan.value ? weekLabel(weekStart.value, weekEnd.value) : 'Window unavailable'))
|
||||||
|
|
||||||
const lastPoint = computed(() => series.value?.points.at(-1))
|
const lastPoint = computed(() => series.value?.points.at(-1))
|
||||||
const previousPoint = computed(() => series.value?.points.at(-25))
|
const lastMeasured = computed(() => (lastPoint.value ? formatDateTime(lastPoint.value.t) : '—'))
|
||||||
const deltaPct = computed(() => {
|
const latestReading = computed(() => (lastPoint.value ? formatNumber(lastPoint.value.v) : '—'))
|
||||||
if (!lastPoint.value || !previousPoint.value || previousPoint.value.v === 0) return 0
|
|
||||||
return ((lastPoint.value.v - previousPoint.value.v) / previousPoint.value.v) * 100
|
|
||||||
})
|
|
||||||
const last24 = computed(() => series.value?.points.slice(-24) ?? [])
|
|
||||||
const barMax = computed(() => Math.max(...last24.value.map((point) => point.v), 1))
|
|
||||||
|
|
||||||
const nowWeather = computed(() => context.value?.weather.now)
|
useHead(() => ({
|
||||||
const weatherIcon = computed(() =>
|
title: peakShift.value
|
||||||
nowWeather.value && weatherKind(nowWeather.value) === 'sunny' ? iconSunny : iconCloud,
|
? `${numberWord(peakShift.value.staff)} on ${formatWeekday(peakShift.value.date)} — PulseCast`
|
||||||
)
|
: 'PulseCast — footfall to shifts',
|
||||||
const weatherLabel = computed(() => {
|
}))
|
||||||
if (!nowWeather.value) return '—'
|
|
||||||
const kind = weatherKind(nowWeather.value)
|
|
||||||
return kind === 'sunny' ? 'Sunny' : kind === 'partly-cloudy' ? 'Partly cloudy' : kind === 'rain' ? 'Rain' : 'Cloudy'
|
|
||||||
})
|
|
||||||
|
|
||||||
const today = berlinParts(demoNow).date
|
|
||||||
const todayHoliday = computed(() => context.value?.holidays.find((holiday) => holiday.date === today))
|
|
||||||
const lastHoliday = computed(() =>
|
|
||||||
context.value?.holidays.filter((holiday) => holiday.date < today).at(-1),
|
|
||||||
)
|
|
||||||
const nextHoliday = computed(() =>
|
|
||||||
context.value?.holidays.find((holiday) => holiday.date > today),
|
|
||||||
)
|
|
||||||
|
|
||||||
const latestPulse = computed(() => {
|
|
||||||
if (!sensors.value?.length) return 0
|
|
||||||
return Math.round(sensors.value.reduce((sum, sensor) => sum + sensor.mean, 0) / sensors.value.length)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="page page-stack">
|
<div class="pc-page landing">
|
||||||
<header class="page-header">
|
<section class="landing__hero" aria-labelledby="landing-title">
|
||||||
<div>
|
<div class="landing__copy">
|
||||||
<p class="eyebrow">Now · replay clock {{ formatDateTime(demoNow) }}</p>
|
<div class="landing__meta">
|
||||||
<OnyxHeadline is="h1">The pulse is in the pedestrian core.</OnyxHeadline>
|
<span class="pc-tag">{{ windowTag }}</span>
|
||||||
<p class="lede">
|
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" compact />
|
||||||
Eight fixed sensors around Stadtgalerie and Kaiserstraße. This is estimated device density, not people,
|
</div>
|
||||||
and not a city-wide heatmap. The decision lives on <NuxtLink to="/plan">Plan</NuxtLink>.
|
|
||||||
|
<h1 id="landing-title" class="landing__title">
|
||||||
|
<template v-if="peakShift">{{ numberWord(peakShift.staff) }} on {{ formatWeekday(peakShift.date) }}.</template>
|
||||||
|
<template v-else>The week, shifted.</template>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p class="landing__lede">
|
||||||
|
<template v-if="plan">
|
||||||
|
PulseCast turns inner-city footfall into a shift plan you can defend.
|
||||||
|
This window: <strong>{{ totalStaffHours }} staff-hours</strong>,
|
||||||
|
<strong>{{ formatEuro(plan.summary.cost_eur) }}</strong>,
|
||||||
|
<strong>{{ formatPercent(plan.summary.coverage_pct, 1) }} coverage</strong>.
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
PulseCast turns inner-city footfall into a transparent shift plan for the week.
|
||||||
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
<div class="hero-actions">
|
|
||||||
<OnyxBadge color="warning">Replay, not live</OnyxBadge>
|
|
||||||
<OnyxBadge color="neutral" density="compact">{{ sensors?.length ?? 8 }} sensors</OnyxBadge>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="split-grid">
|
<div class="landing__actions">
|
||||||
<div class="card-stack">
|
<OnyxButton label="Open the plan" link="/plan" color="primary" :icon="iconArrowRight" icon-position="right" />
|
||||||
<OnyxCard>
|
<OnyxButton label="See the forecast" link="/forecast" mode="outline" />
|
||||||
<div class="card-header">
|
</div>
|
||||||
|
|
||||||
|
<ol class="landing__chain" aria-label="How the plan is made">
|
||||||
|
<li><span>Measured</span> footfall</li>
|
||||||
|
<li><span>Modelled</span> forecast</li>
|
||||||
|
<li><span>Declared</span> assumptions</li>
|
||||||
|
<li><span>Shift</span> plan</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<dl class="landing__proof" aria-label="What the plan is built on">
|
||||||
<div>
|
<div>
|
||||||
<OnyxHeadline is="h2">Latest replay reading</OnyxHeadline>
|
<dt>Latest reading</dt>
|
||||||
<p class="small muted" style="margin: 0">Last available hour in the API series.</p>
|
<dd>
|
||||||
|
{{ latestReading }} <span>est. devices/hour</span>
|
||||||
|
<small>{{ activeSensor?.name ?? 'Stadtgalerie' }} · last point {{ lastMeasured }}</small>
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div style="min-width: 12rem">
|
|
||||||
<OnyxSelect
|
|
||||||
v-model="sensorId"
|
|
||||||
label="Sensor"
|
|
||||||
list-label="Inner-city sensors"
|
|
||||||
:options="sensorOptions"
|
|
||||||
density="compact"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="reading-row">
|
|
||||||
<p class="reading-value">{{ lastPoint ? formatNumber(lastPoint.v) : '—' }}</p>
|
|
||||||
<div>
|
<div>
|
||||||
<p style="margin: 0; font-weight: 600">estimated devices / hour</p>
|
<dt>Modelled peak</dt>
|
||||||
<p class="small muted" style="margin: 0">
|
<dd>
|
||||||
{{ activeSensor?.name }} · {{ activeSensor?.id }}
|
{{ peakHour ? formatNumber(peakHour.footfall) : '—' }} <span>est. devices/hour</span>
|
||||||
</p>
|
<small>{{ peakHour ? `${formatWeekday(berlinParts(peakHour.t).date)} ${formatTime(peakHour.t)}` : 'waiting for the forecast' }}</small>
|
||||||
<OnyxBadge :color="deltaPct >= 0 ? 'success' : 'warning'" density="compact">
|
</dd>
|
||||||
{{ deltaPct >= 0 ? '+' : '' }}{{ formatPercent(deltaPct, 0) }} vs 24 h earlier
|
|
||||||
</OnyxBadge>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bar-chart" role="img" :aria-label="`Last 24 hours for ${activeSensor?.name}`">
|
|
||||||
<div
|
|
||||||
v-for="(point, index) in last24"
|
|
||||||
:key="point.t"
|
|
||||||
class="bar-chart__bar"
|
|
||||||
:class="{ 'bar-chart__bar--now': index === last24.length - 1 }"
|
|
||||||
:style="{ height: `${Math.max(4, (point.v / barMax) * 100)}%` }"
|
|
||||||
:title="`${formatTime(point.t)} · ${point.v}`"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="legend" style="justify-content: space-between; margin-top: var(--onyx-density-2xs)">
|
|
||||||
<span class="small muted">{{ last24[0] ? formatTime(last24[0].t) : '—' }}</span>
|
|
||||||
<span class="small muted">{{ lastPoint ? formatDateTime(lastPoint.t) : '—' }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="small muted table-note">
|
|
||||||
This is a replay snapshot, not a live sensor feed. The replay clock is
|
|
||||||
{{ formatDateTime(demoNow) }}; the last measured point is
|
|
||||||
{{ lastPoint ? formatDateTime(lastPoint.t) : '—' }}.
|
|
||||||
</p>
|
|
||||||
</OnyxCard>
|
|
||||||
|
|
||||||
<OnyxCard>
|
|
||||||
<div class="card-header">
|
|
||||||
<div>
|
<div>
|
||||||
<OnyxHeadline is="h2">Sensor cluster</OnyxHeadline>
|
<dt>Assumed</dt>
|
||||||
<p class="small muted" style="margin: 0">
|
<dd>
|
||||||
Select a sensor to update the reading. Positions are relative; this is not a geographic map.
|
{{ plan?.assumptions.labor_cost_eur_h ?? 16 }} <span>€/staff-hour</span>
|
||||||
</p>
|
<small>{{ plan?.assumptions.visitors_per_staff_hour ?? 25 }} visitors/staff-h · ×{{ plan?.assumptions.safety_factor ?? 1.15 }} safety</small>
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<OnyxBadge color="info" density="compact">580 m cluster</OnyxBadge>
|
|
||||||
</div>
|
|
||||||
<SensorClusterMap :sensors="sensors ?? []" :active-id="sensorId" @select="sensorId = $event" />
|
|
||||||
</OnyxCard>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<aside class="card-stack">
|
|
||||||
<OnyxCard>
|
|
||||||
<div class="card-header">
|
|
||||||
<OnyxHeadline is="h2">Heilbronn weather</OnyxHeadline>
|
|
||||||
<OnyxBadge color="neutral" density="compact">Open-Meteo context</OnyxBadge>
|
|
||||||
</div>
|
|
||||||
<div class="reading-row">
|
|
||||||
<OnyxIcon :icon="weatherIcon" size="48px" color="primary" />
|
|
||||||
<div>
|
|
||||||
<p style="margin: 0; font-size: 2rem; font-weight: 700; line-height: 1">
|
|
||||||
{{ nowWeather ? `${nowWeather.temp_c} °C` : '—' }}
|
|
||||||
</p>
|
|
||||||
<p class="small muted" style="margin: 0">{{ weatherLabel }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<dl class="metric-list" style="margin-top: var(--onyx-density-md)">
|
|
||||||
<div><dt>Precipitation</dt><dd>{{ nowWeather?.precip_mm ?? '—' }} mm</dd></div>
|
|
||||||
<div><dt>Cloud cover</dt><dd>{{ nowWeather?.cloud_pct ?? '—' }}%</dd></div>
|
|
||||||
<div><dt>Wind</dt><dd>{{ nowWeather?.wind_kmh ?? '—' }} km/h</dd></div>
|
|
||||||
<div><dt>Humidity</dt><dd>{{ nowWeather?.humidity_pct ?? '—' }}%</dd></div>
|
|
||||||
</dl>
|
</dl>
|
||||||
<p class="small muted table-note">
|
|
||||||
Updated {{ context ? formatDateTime(context.updated_at) : '—' }} · context
|
|
||||||
{{ context?.cached ? 'cached' : 'live' }}
|
|
||||||
</p>
|
|
||||||
</OnyxCard>
|
|
||||||
|
|
||||||
<OnyxCard>
|
|
||||||
<div class="card-header">
|
|
||||||
<OnyxHeadline is="h2">Holiday context</OnyxHeadline>
|
|
||||||
<OnyxIcon :icon="iconCalendar" size="24px" color="primary" />
|
|
||||||
</div>
|
|
||||||
<OnyxBadge v-if="todayHoliday" color="warning">{{ todayHoliday.name }} today</OnyxBadge>
|
|
||||||
<OnyxBadge v-else color="success">No public holiday today</OnyxBadge>
|
|
||||||
<p class="small muted" style="margin: var(--onyx-density-sm) 0 0">
|
|
||||||
<template v-if="nextHoliday">
|
|
||||||
Next: <strong>{{ nextHoliday.name }}</strong> on {{ formatDate(nextHoliday.date) }}.
|
|
||||||
</template>
|
|
||||||
<template v-else>No upcoming holiday in the holiday calendar.</template>
|
|
||||||
</p>
|
|
||||||
<p v-if="lastHoliday" class="small muted" style="margin: var(--onyx-density-xs) 0 0">
|
|
||||||
Last: {{ lastHoliday.name }} on {{ formatShortDate(lastHoliday.date) }}.
|
|
||||||
</p>
|
|
||||||
<p class="small muted table-note">
|
|
||||||
Baden-Württemberg public holidays; used as model context, not as a causal claim.
|
|
||||||
</p>
|
|
||||||
</OnyxCard>
|
|
||||||
|
|
||||||
<OnyxCard>
|
|
||||||
<div class="card-header">
|
|
||||||
<OnyxHeadline is="h3">What to do next</OnyxHeadline>
|
|
||||||
<OnyxIcon :icon="iconLocationPin" size="24px" color="primary" />
|
|
||||||
</div>
|
|
||||||
<p class="small" style="margin-top: 0">
|
|
||||||
The average sensor is at <strong>{{ latestPulse }}</strong> estimated devices/hour. That is context,
|
|
||||||
not a staffing decision. Open the plan to turn next week’s forecast into shifts.
|
|
||||||
</p>
|
|
||||||
<OnyxButton label="Open the staffing plan" link="/plan" color="primary" />
|
|
||||||
</OnyxCard>
|
|
||||||
</aside>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<OnyxCard>
|
<aside class="landing__board" aria-label="Live weekly shift board">
|
||||||
<div class="card-header">
|
<div class="landing__board-head">
|
||||||
<div>
|
<div>
|
||||||
<OnyxHeadline is="h2">Eight sensors</OnyxHeadline>
|
<p class="pc-label">The week, block by block</p>
|
||||||
<p class="small muted" style="margin: 0">Measured points, stable order by ID. Battery may be null in the API.</p>
|
<p class="landing__board-window">{{ windowLabel }} · {{ windowTag }}</p>
|
||||||
</div>
|
</div>
|
||||||
<OnyxBadge color="neutral" density="compact">measured points only</OnyxBadge>
|
<span class="pc-tag pc-tag--signal">Live plan</span>
|
||||||
</div>
|
</div>
|
||||||
<OnyxTable striped with-page-scrolling :table-attrs="{ style: 'min-width: 36rem' }">
|
|
||||||
<template #head>
|
<template v-if="plan && daySummaries.length">
|
||||||
<tr>
|
<WeekBoard
|
||||||
<th scope="col">Sensor</th>
|
:days="daySummaries"
|
||||||
<th scope="col">Mean</th>
|
:peak-date="peakShift?.date"
|
||||||
<th scope="col">P95</th>
|
show-pulse
|
||||||
<th scope="col">Battery</th>
|
label="Live weekly shift board"
|
||||||
<th scope="col">Source ID</th>
|
/>
|
||||||
</tr>
|
|
||||||
|
<div class="landing__board-receipt">
|
||||||
|
<div>
|
||||||
|
<span class="pc-label">Peak shift</span>
|
||||||
|
<strong>
|
||||||
|
<template v-if="peakShift">
|
||||||
|
{{ peakShift.staff }} staff · {{ peakShift.start }}–{{ peakShift.end }}
|
||||||
</template>
|
</template>
|
||||||
<tr v-for="sensor in sensors" :key="sensor.id">
|
<template v-else>—</template>
|
||||||
<th scope="row" style="text-align: left; font-weight: 600">
|
</strong>
|
||||||
{{ sensor.name }}
|
|
||||||
<OnyxBadge v-if="sensor.id === sensorId" color="primary" density="compact" style="margin-left: 0.35rem">selected</OnyxBadge>
|
|
||||||
</th>
|
|
||||||
<td>{{ sensor.mean }}</td>
|
|
||||||
<td>{{ sensor.p95 }}</td>
|
|
||||||
<td>
|
|
||||||
<OnyxBadge :color="sensor.battery === null ? 'neutral' : sensor.battery >= 60 ? 'success' : 'warning'" density="compact">
|
|
||||||
{{ sensor.battery === null ? 'n/a' : `${sensor.battery}%` }}
|
|
||||||
</OnyxBadge>
|
|
||||||
</td>
|
|
||||||
<td class="mono">{{ sensor.id }}</td>
|
|
||||||
</tr>
|
|
||||||
</OnyxTable>
|
|
||||||
|
|
||||||
<p v-if="meta" class="small muted table-note">
|
|
||||||
Coverage {{ formatDate(meta.coverage.from) }} → {{ formatDate(meta.coverage.to) }} ·
|
|
||||||
{{ meta.coverage.cadence_min }}-min cadence · data {{ meta.data_version }} · model {{ meta.model_version }}
|
|
||||||
</p>
|
|
||||||
</OnyxCard>
|
|
||||||
|
|
||||||
<div v-if="!sensors?.length" class="callout callout--warning">
|
|
||||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
|
||||||
Sensor data is missing. Check that the Go API is running and that NUXT_API_INTERNAL_BASE points to it.
|
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="pc-label">Cost vs flat</span>
|
||||||
|
<strong>{{ formatEuro(plan.summary.cost_eur) }} <span>vs {{ formatEuro(plan.summary.flat_schedule_cost_eur) }}</span></strong>
|
||||||
|
<small>{{ formatEuro(savingEur) }} saved · {{ Math.round(savingPct) }}% lower</small>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="pc-label">Coverage</span>
|
||||||
|
<strong>{{ formatPercent(plan.summary.coverage_pct, 1) }}</strong>
|
||||||
|
<small>{{ plan.summary.understaffed_hours }} h short · {{ plan.summary.overstaffed_hours }} h over</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="landing__board-foot">
|
||||||
|
<span>{{ totalStaffHours }} staff-hours · {{ plan.assumptions.shift_length_h }} h blocks</span>
|
||||||
|
<NuxtLink to="/plan">Open the plan <span aria-hidden="true">→</span></NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div v-else-if="status === 'error'" class="landing__board-empty" role="alert">
|
||||||
|
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||||
|
<p>The live plan is unavailable. Retry when the connection is back.</p>
|
||||||
|
<OnyxButton label="Retry" mode="outline" density="compact" @click="refresh()" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else class="landing__board-empty" aria-busy="true">
|
||||||
|
<div class="pc-skeleton" style="width: 100%; height: 9rem" />
|
||||||
|
<div class="pc-skeleton" style="width: 76%; height: 1.1rem; margin-top: 0.8rem" />
|
||||||
|
<p class="pc-small pc-muted">Loading the current plan…</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="landing__board-note">
|
||||||
|
<span>Live demo plan · not a city-wide claim.</span>
|
||||||
|
<span>{{ meta?.coverage.sensors ?? 8 }} sensors · 580 m · no POS data</span>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.landing {
|
||||||
|
min-height: calc(100dvh - 8rem);
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__hero {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1.02fr) minmax(26rem, 0.98fr);
|
||||||
|
gap: clamp(1.5rem, 4vw, 4rem);
|
||||||
|
align-items: stretch;
|
||||||
|
padding-block: clamp(0.5rem, 2vw, 1.5rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__copy {
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__meta {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__title {
|
||||||
|
max-width: 10ch;
|
||||||
|
margin: 0;
|
||||||
|
font-size: clamp(3.6rem, 7.1vw, 6.7rem);
|
||||||
|
font-stretch: 76%;
|
||||||
|
font-weight: 850;
|
||||||
|
line-height: 0.84;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__lede {
|
||||||
|
max-width: 48ch;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--pc-ink-2);
|
||||||
|
font-size: clamp(1.05rem, 1.35vw, 1.22rem);
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__lede strong {
|
||||||
|
font-weight: 780;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.35rem;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.65rem 0;
|
||||||
|
border-block: 1px solid var(--pc-line);
|
||||||
|
list-style: none;
|
||||||
|
counter-reset: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain li {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.3rem;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain li + li::before {
|
||||||
|
content: "→";
|
||||||
|
margin-inline-end: 0.2rem;
|
||||||
|
color: var(--pc-signal-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain li span {
|
||||||
|
color: var(--pc-ink);
|
||||||
|
font-weight: 750;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain li span::after {
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
gap: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-top: 2px solid var(--pc-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof > div {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.7rem 0.75rem 0;
|
||||||
|
border-inline-end: 1px solid var(--pc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof > div:first-child {
|
||||||
|
padding-inline-start: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof > div:last-child {
|
||||||
|
border-inline-end: 0;
|
||||||
|
padding-inline-end: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dt {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dd {
|
||||||
|
margin: 0.25rem 0 0;
|
||||||
|
font-size: 1.35rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
line-height: 1;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dd span {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.15rem;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dd small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.65rem;
|
||||||
|
font-weight: 450;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board {
|
||||||
|
display: flex;
|
||||||
|
min-width: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 2px solid var(--pc-ink);
|
||||||
|
background: var(--pc-paper);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-head {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.85rem 0.85rem 0.55rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-head p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-window {
|
||||||
|
margin-top: 0.2rem !important;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.78rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board .pc-board {
|
||||||
|
border-inline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1.1fr 1.6fr 0.8fr;
|
||||||
|
gap: 0;
|
||||||
|
border-top: 2px solid var(--pc-ink);
|
||||||
|
border-bottom: 1px solid var(--pc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt > div {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.7rem 0.75rem;
|
||||||
|
border-inline-end: 1px solid var(--pc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt > div:last-child {
|
||||||
|
border-inline-end: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt .pc-label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
font-size: 0.58rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt strong span {
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.62rem;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-foot {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.55rem 0.85rem;
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.68rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-foot a {
|
||||||
|
color: var(--pc-ink);
|
||||||
|
font-weight: 750;
|
||||||
|
text-decoration-color: var(--pc-signal-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-note {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.35rem;
|
||||||
|
margin-top: auto;
|
||||||
|
padding: 0.45rem 0.85rem;
|
||||||
|
border-top: 1px solid var(--pc-line);
|
||||||
|
color: var(--pc-muted);
|
||||||
|
font-size: 0.6rem;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-empty {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 16rem;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.6rem;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-empty p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1100px) {
|
||||||
|
.landing__hero {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__copy {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__meta {
|
||||||
|
order: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__title {
|
||||||
|
order: 2;
|
||||||
|
max-width: 14ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__lede {
|
||||||
|
order: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__actions {
|
||||||
|
order: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board {
|
||||||
|
order: 5;
|
||||||
|
max-width: 46rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__chain {
|
||||||
|
order: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof {
|
||||||
|
order: 7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.landing {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__title {
|
||||||
|
max-width: 11ch;
|
||||||
|
font-size: clamp(3rem, 14vw, 4rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof > div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 7rem minmax(0, 1fr);
|
||||||
|
gap: 0.4rem;
|
||||||
|
padding: 0.55rem 0;
|
||||||
|
border-inline-end: 0;
|
||||||
|
border-bottom: 1px solid var(--pc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof > div:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dd {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__proof dd small {
|
||||||
|
margin-top: 0.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt > div {
|
||||||
|
border-inline-end: 0;
|
||||||
|
border-bottom: 1px solid var(--pc-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing__board-receipt > div:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+398
-217
@@ -1,17 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import { iconSync, iconTriangleWarning } from '@sit-onyx/icons'
|
||||||
iconArrowRight,
|
import { addDays, berlinParts, planWeekStart } from '#shared/staffing'
|
||||||
iconCircleInformation,
|
|
||||||
iconMobileSignal,
|
|
||||||
iconSync,
|
|
||||||
iconTriangleWarning,
|
|
||||||
iconUserGroup,
|
|
||||||
} from '@sit-onyx/icons'
|
|
||||||
import { scenarioLabel } from '#shared/live'
|
import { scenarioLabel } from '#shared/live'
|
||||||
import type { ScenarioState, Sensor, Shift, StaffingResponse } from '#shared/types'
|
import type { ScenarioState, Sensor, StaffingResponse } from '#shared/types'
|
||||||
import { formatDateTime, formatEuro, formatNumber, formatPercent, formatShortDate, formatWeekday } from '~/utils/format'
|
import {
|
||||||
|
formatDateTime,
|
||||||
|
formatEuro,
|
||||||
|
formatNumber,
|
||||||
|
formatPercent,
|
||||||
|
formatShortDate,
|
||||||
|
formatTime,
|
||||||
|
formatWeekday,
|
||||||
|
weekLabel,
|
||||||
|
} from '~/utils/format'
|
||||||
|
import {
|
||||||
|
peakHourOf,
|
||||||
|
peakShiftOf,
|
||||||
|
planDays,
|
||||||
|
savingOf,
|
||||||
|
totalStaffHoursOf,
|
||||||
|
} from '~/utils/plan'
|
||||||
|
|
||||||
useHead({ title: 'Live recommendation — PulseCast' })
|
const config = useRuntimeConfig()
|
||||||
|
const demoNow = String(config.public.demoNow)
|
||||||
|
|
||||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||||
const { data: initialScenario } = await useFetch<ScenarioState>('/api/scenario')
|
const { data: initialScenario } = await useFetch<ScenarioState>('/api/scenario')
|
||||||
@@ -25,7 +36,6 @@ const live = useLiveScenario(initialScenario.value)
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
data: planData,
|
data: planData,
|
||||||
status: planStatus,
|
|
||||||
error: planError,
|
error: planError,
|
||||||
refresh: refreshPlan,
|
refresh: refreshPlan,
|
||||||
} = await useFetch<StaffingResponse>('/api/staffing', {
|
} = await useFetch<StaffingResponse>('/api/staffing', {
|
||||||
@@ -36,7 +46,6 @@ const {
|
|||||||
})),
|
})),
|
||||||
})
|
})
|
||||||
|
|
||||||
// Same scenario id with a new version: refresh because the query string does not move.
|
|
||||||
let lastScenarioId = live.scenarioId
|
let lastScenarioId = live.scenarioId
|
||||||
watch(
|
watch(
|
||||||
() => live.revision,
|
() => live.revision,
|
||||||
@@ -48,278 +57,450 @@ watch(
|
|||||||
|
|
||||||
const plan = computed(() => planData.value ?? null)
|
const plan = computed(() => planData.value ?? null)
|
||||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||||
|
const peakShift = computed(() => peakShiftOf(plan.value))
|
||||||
|
const peakHour = computed(() => peakHourOf(plan.value))
|
||||||
|
const totalStaffHours = computed(() => totalStaffHoursOf(plan.value))
|
||||||
|
const savingEur = computed(() => savingOf(plan.value))
|
||||||
|
const savingPct = computed(() => savingPctOf(plan.value))
|
||||||
|
const daySummaries = computed(() => planDays(plan.value))
|
||||||
|
|
||||||
function maxOf<T>(items: T[], score: (item: T) => number): T | undefined {
|
const weekStart = computed(() => {
|
||||||
let best: T | undefined
|
const first = plan.value?.hours[0]
|
||||||
for (const item of items) if (!best || score(item) > score(best)) best = item
|
return first ? berlinParts(first.t).date : planWeekStart(demoNow)
|
||||||
return best
|
})
|
||||||
|
const weekEnd = computed(() => addDays(weekStart.value, 6))
|
||||||
|
const today = computed(() => berlinParts(demoNow).date)
|
||||||
|
const windowTag = computed(() => {
|
||||||
|
if (!plan.value) return 'No plan'
|
||||||
|
return weekStart.value <= today.value && today.value <= weekEnd.value ? 'Today–Friday' : 'Seven days'
|
||||||
|
})
|
||||||
|
const windowLabel = computed(() => (plan.value ? weekLabel(weekStart.value, weekEnd.value) : 'Window unavailable'))
|
||||||
|
|
||||||
|
const freshness = computed(() => live.lastEventAt || live.scenarioAt || plan.value?.context_version || '')
|
||||||
|
const scenarioName = computed(() => scenarioLabel(live.scenarioId))
|
||||||
|
const reason = computed(() => {
|
||||||
|
if (peakHour.value) {
|
||||||
|
return `Peak forecast ${formatNumber(peakHour.value.footfall)} est. devices/hour at ${formatTime(peakHour.value.t)}.`
|
||||||
}
|
}
|
||||||
|
return plan.value?.why[0] ?? 'Waiting for the forecast.'
|
||||||
|
})
|
||||||
|
|
||||||
const peakShift = computed<Shift | undefined>(() =>
|
const changed = ref(false)
|
||||||
plan.value ? maxOf(plan.value.shifts, (shift) => shift.staff) : undefined,
|
let changedTimer: ReturnType<typeof setTimeout> | undefined
|
||||||
|
let mounted = false
|
||||||
|
watch(
|
||||||
|
() => live.revision,
|
||||||
|
() => {
|
||||||
|
if (!mounted) return
|
||||||
|
changed.value = true
|
||||||
|
if (changedTimer) clearTimeout(changedTimer)
|
||||||
|
changedTimer = setTimeout(() => {
|
||||||
|
changed.value = false
|
||||||
|
}, 8000)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
const peakStaff = computed(() => peakShift.value?.staff ?? 0)
|
|
||||||
const totalStaffHours = computed(() =>
|
onMounted(() => {
|
||||||
plan.value ? plan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) : 0,
|
mounted = true
|
||||||
)
|
})
|
||||||
const currentReason = computed(() => plan.value?.why[0] ?? '')
|
onBeforeUnmount(() => {
|
||||||
const lastUpdate = computed(() => {
|
if (changedTimer) clearTimeout(changedTimer)
|
||||||
if (live.scenarioAt) return live.scenarioAt
|
})
|
||||||
return plan.value?.context_version ?? ''
|
|
||||||
|
useHead({
|
||||||
|
title: 'Live plan — PulseCast',
|
||||||
|
meta: [{ name: 'theme-color', content: '#0e100e' }],
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="page page-stack live-page">
|
<div class="pc-dark live">
|
||||||
<header class="live-header">
|
<header class="live__top">
|
||||||
<div>
|
<NuxtLink to="/" class="live__wordmark">
|
||||||
<p class="eyebrow">Live · no login</p>
|
<span class="live__mark" aria-hidden="true" />
|
||||||
<OnyxHeadline is="h1">The plan on your phone.</OnyxHeadline>
|
PulseCast
|
||||||
<p class="lede">
|
</NuxtLink>
|
||||||
{{ activeSensor?.name ?? 'Stadtgalerie' }} · {{ scenarioLabel(live.scenarioId) }}. Updates arrive over SSE;
|
<span class="live__top-status">
|
||||||
if the stream drops, this page polls every 5 seconds.
|
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" dark />
|
||||||
</p>
|
</span>
|
||||||
</div>
|
|
||||||
<div class="live-header__status">
|
|
||||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
|
||||||
<OnyxBadge color="neutral" density="compact">v{{ live.version || '—' }}</OnyxBadge>
|
|
||||||
</div>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div v-if="planError" class="callout callout--warning" role="alert">
|
<main class="live__main">
|
||||||
|
<div v-if="planError" class="pc-alert pc-alert--dark live__alert" role="alert">
|
||||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||||
<div>
|
<span>The live plan is unavailable. Retry, or keep the last known plan on screen.</span>
|
||||||
<strong>The live plan is unavailable.</strong>
|
|
||||||
<span class="muted"> {{ planError.statusMessage ?? 'The API did not answer.' }}</span>
|
|
||||||
</div>
|
|
||||||
<OnyxButton label="Retry" mode="outline" density="compact" :icon="iconSync" @click="refreshPlan()" />
|
<OnyxButton label="Retry" mode="outline" density="compact" :icon="iconSync" @click="refreshPlan()" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="planStatus === 'pending' && !plan" class="callout">
|
<section class="live__hero" aria-labelledby="live-title">
|
||||||
<OnyxIcon :icon="iconSync" size="18px" color="primary" />
|
<div class="live__hero-top">
|
||||||
<span>Loading the current recommendation…</span>
|
<span class="pc-tag pc-tag--dark">{{ windowTag }}</span>
|
||||||
|
<span v-if="changed" class="pc-tag pc-tag--signal" role="status">Plan updated</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="plan && !plan.shifts.length" class="callout callout--warning" role="status">
|
<p class="live__day">
|
||||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
|
||||||
<span>No shift blocks are available yet. The presenter may still be preparing the plan.</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<section class="live-hero" aria-labelledby="live-decision">
|
|
||||||
<p class="live-hero__kicker"><OnyxIcon :icon="iconUserGroup" size="18px" color="primary" /> Current recommendation</p>
|
|
||||||
<p id="live-decision" class="live-hero__value">
|
|
||||||
<template v-if="plan">{{ peakStaff }} staff</template>
|
|
||||||
<template v-else>No plan yet</template>
|
|
||||||
</p>
|
|
||||||
<p class="live-hero__shift">
|
|
||||||
<template v-if="peakShift">
|
<template v-if="peakShift">
|
||||||
<strong>{{ formatWeekday(peakShift.date) }} {{ formatShortDate(peakShift.date) }}</strong><br />
|
{{ formatWeekday(peakShift.date) }} {{ formatShortDate(peakShift.date) }} · peak shift
|
||||||
{{ peakShift.start }}–{{ peakShift.end }} · peak shift
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>Waiting for the peak shift</template>
|
<template v-else>Waiting for the plan</template>
|
||||||
</p>
|
</p>
|
||||||
<p v-if="currentReason" class="live-hero__why">
|
|
||||||
<OnyxIcon :icon="iconCircleInformation" size="16px" color="primary" />
|
<h1 id="live-title" class="live__number">
|
||||||
<span>{{ currentReason }}</span>
|
<template v-if="peakShift">{{ peakShift.staff }}<span class="live__unit">staff</span></template>
|
||||||
|
<template v-else><span class="live__number-empty">No plan</span></template>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p class="live__shift">
|
||||||
|
<template v-if="peakShift">{{ peakShift.start }}–{{ peakShift.end }}</template>
|
||||||
|
<template v-else>The next shift appears here.</template>
|
||||||
</p>
|
</p>
|
||||||
<OnyxButton
|
|
||||||
label="Open the full plan"
|
<p class="live__reason">{{ reason }}</p>
|
||||||
:link="`/plan?scenario=${live.scenarioId}`"
|
|
||||||
color="primary"
|
<p class="live__fresh">
|
||||||
:icon="iconArrowRight"
|
<span>{{ freshness ? `Updated ${formatDateTime(freshness)}` : 'Waiting for the live stream' }}</span>
|
||||||
icon-position="right"
|
<span>v{{ live.version || '—' }}</span>
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="live__board" aria-labelledby="live-week-title">
|
||||||
|
<div class="live__section-head">
|
||||||
|
<h2 id="live-week-title" class="pc-label">The week</h2>
|
||||||
|
<span>{{ windowLabel }} · {{ windowTag }}</span>
|
||||||
|
</div>
|
||||||
|
<WeekBoard
|
||||||
|
v-if="daySummaries.length"
|
||||||
|
:days="daySummaries"
|
||||||
|
:peak-date="peakShift?.date"
|
||||||
|
dense
|
||||||
|
dark
|
||||||
|
label="The week at a glance"
|
||||||
/>
|
/>
|
||||||
|
<div v-else class="pc-skeleton pc-skeleton--dark" style="height: 7rem" aria-busy="true" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="live-metrics" aria-label="Plan at a glance">
|
<section class="live__receipt" aria-label="Plan cost and coverage">
|
||||||
<div class="live-metric">
|
<div>
|
||||||
<p class="live-metric__label">Staff-hours</p>
|
<span class="pc-label">Staff-hours</span>
|
||||||
<p class="live-metric__value">{{ plan ? formatNumber(totalStaffHours) : '—' }}</p>
|
<strong>{{ plan ? totalStaffHours : '—' }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="live-metric">
|
<div>
|
||||||
<p class="live-metric__label">Labour cost</p>
|
<span class="pc-label">Planned cost</span>
|
||||||
<p class="live-metric__value">{{ plan ? formatEuro(plan.summary.cost_eur) : '—' }}</p>
|
<strong>{{ plan ? formatEuro(plan.summary.cost_eur) : '—' }}</strong>
|
||||||
|
<small v-if="plan">vs {{ formatEuro(plan.summary.flat_schedule_cost_eur) }} flat · {{ formatEuro(savingEur) }} saved</small>
|
||||||
|
<small v-else>Waiting for the plan</small>
|
||||||
</div>
|
</div>
|
||||||
<div class="live-metric">
|
<div>
|
||||||
<p class="live-metric__label">Coverage</p>
|
<span class="pc-label">Coverage</span>
|
||||||
<p class="live-metric__value">{{ plan ? formatPercent(plan.summary.coverage_pct, 1) : '—' }}</p>
|
<strong>{{ plan ? formatPercent(plan.summary.coverage_pct, 1) : '—' }}</strong>
|
||||||
</div>
|
<small v-if="plan">{{ plan.summary.understaffed_hours }} h short · {{ plan.summary.overstaffed_hours }} h over</small>
|
||||||
<div class="live-metric">
|
<small v-else>Waiting for the plan</small>
|
||||||
<p class="live-metric__label">Understaffed</p>
|
|
||||||
<p class="live-metric__value">{{ plan ? `${plan.summary.understaffed_hours} h` : '—' }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="live-status-card">
|
<section class="live__context" aria-label="Live context">
|
||||||
<div class="live-status-card__row">
|
<div><span>Scenario</span><strong>{{ scenarioName }}</strong></div>
|
||||||
<span class="live-status-card__label">Scenario</span>
|
<div>
|
||||||
<strong>{{ scenarioLabel(live.scenarioId) }}</strong>
|
<span>Transport</span>
|
||||||
|
<strong>{{ live.statusLabel }}<template v-if="live.status === 'polling'"> · 5 s</template></strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="live-status-card__row">
|
<div><span>Updated</span><strong>{{ freshness ? formatDateTime(freshness) : '—' }}</strong></div>
|
||||||
<span class="live-status-card__label">Version</span>
|
|
||||||
<span>{{ live.version || '—' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="live-status-card__row">
|
|
||||||
<span class="live-status-card__label">Last update</span>
|
|
||||||
<span>{{ lastUpdate ? formatDateTime(lastUpdate) : '—' }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="live-status-card__row">
|
|
||||||
<span class="live-status-card__label">Transport</span>
|
|
||||||
<span>{{ live.statusLabel }}<template v-if="live.status === 'polling'"> · 5 s</template></span>
|
|
||||||
</div>
|
|
||||||
<p v-if="live.error" class="small muted table-note">{{ live.error }}</p>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<footer class="live-footer">
|
<NuxtLink class="pc-link-button pc-link-button--primary live__cta" to="/plan">
|
||||||
<p>
|
Open the full plan <span aria-hidden="true">→</span>
|
||||||
<strong>Decision support, not an optimizer.</strong> The plan uses
|
</NuxtLink>
|
||||||
{{ plan?.assumptions.visitors_per_staff_hour ?? 25 }} visitors per staff-hour,
|
|
||||||
×{{ plan?.assumptions.safety_factor ?? 1.15 }} safety, {{ plan?.assumptions.shift_length_h ?? 4 }} h shift
|
<p class="live__note">
|
||||||
blocks and €{{ plan?.assumptions.labor_cost_eur_h ?? 16 }}/h.
|
Estimated devices, not people. {{ plan?.assumptions.visitors_per_staff_hour ?? 25 }} visitors/staff-hour ·
|
||||||
|
×{{ plan?.assumptions.safety_factor ?? 1.15 }} safety · €{{ plan?.assumptions.labor_cost_eur_h ?? 16 }}/h.
|
||||||
|
No login. If the stream drops, this page polls every five seconds.
|
||||||
</p>
|
</p>
|
||||||
<p class="muted">
|
|
||||||
Estimated devices, not people · {{ sensors?.length ?? 8 }} sensors in a 580 m cluster · no POS, sales or
|
<p v-if="activeSensor" class="live__sensor">{{ activeSensor.name }} · {{ activeSensor.id }}</p>
|
||||||
payroll data.
|
</main>
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.live-page {
|
.live {
|
||||||
max-width: 44rem;
|
min-height: 100dvh;
|
||||||
gap: clamp(0.85rem, 2vw, 1.25rem);
|
padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
|
||||||
|
max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-header {
|
.live__top {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
align-items: center;
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: var(--onyx-density-sm);
|
gap: 0.75rem;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 34rem;
|
||||||
|
margin-inline: auto;
|
||||||
|
padding-bottom: 0.7rem;
|
||||||
|
border-bottom: 1px solid var(--pc-dark-line);
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-header h1 {
|
.live__wordmark {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.45rem;
|
||||||
|
color: var(--pc-paper);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__mark {
|
||||||
|
display: block;
|
||||||
|
width: 0.42rem;
|
||||||
|
height: 1.1rem;
|
||||||
|
background: var(--pc-signal-bright);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__top-status {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__main {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 34rem;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.9rem;
|
||||||
|
margin-inline: auto;
|
||||||
|
padding-top: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__alert {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__hero {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding-bottom: 0.9rem;
|
||||||
|
border-bottom: 2px solid var(--pc-paper);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__hero-top {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__hero .pc-label {
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__day {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 750;
|
||||||
|
letter-spacing: 0.09em;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-header__status {
|
.live__number {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.45rem;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--pc-signal-bright);
|
||||||
|
font-size: clamp(7.5rem, 38vw, 12rem);
|
||||||
|
font-stretch: 74%;
|
||||||
|
font-weight: 850;
|
||||||
|
line-height: 0.78;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__unit {
|
||||||
|
color: var(--pc-paper);
|
||||||
|
font-size: clamp(1rem, 4.2vw, 1.35rem);
|
||||||
|
font-stretch: 100%;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__number-empty {
|
||||||
|
color: var(--pc-paper);
|
||||||
|
font-size: clamp(2rem, 9vw, 3rem);
|
||||||
|
font-stretch: 100%;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__shift {
|
||||||
|
margin: 0.5rem 0 0;
|
||||||
|
color: var(--pc-paper);
|
||||||
|
font-size: clamp(1.8rem, 8.5vw, 2.6rem);
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.03em;
|
||||||
|
line-height: 1;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__reason {
|
||||||
|
max-width: 34ch;
|
||||||
|
margin: 0.6rem 0 0;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.86rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__fresh {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: var(--onyx-density-xs);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.4rem;
|
||||||
|
margin: 0.8rem 0 0;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-hero {
|
.live__fresh span:last-child {
|
||||||
padding: clamp(1.1rem, 3vw, 1.75rem);
|
color: var(--pc-paper);
|
||||||
border: 1px solid var(--onyx-color-base-primary-300);
|
font-weight: 700;
|
||||||
border-radius: var(--onyx-radius-component-container-soft);
|
|
||||||
background:
|
|
||||||
radial-gradient(circle at 100% 0%, var(--onyx-color-base-primary-200), transparent 48%),
|
|
||||||
linear-gradient(135deg, var(--onyx-color-base-primary-100), var(--onyx-color-base-neutral-100) 72%);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-hero__kicker {
|
.live__board {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__section-head {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
margin: 0;
|
color: var(--pc-dark-muted);
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
font-size: 0.68rem;
|
||||||
font-size: 0.8rem;
|
font-variant-numeric: tabular-nums;
|
||||||
font-weight: 600;
|
}
|
||||||
|
|
||||||
|
.live__section-head .pc-label {
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
border-block: 1px solid var(--pc-dark-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt > div {
|
||||||
|
min-width: 0;
|
||||||
|
padding: 0.55rem 0.5rem;
|
||||||
|
border-inline-end: 1px solid var(--pc-dark-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt > div:first-child {
|
||||||
|
padding-inline-start: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt > div:last-child {
|
||||||
|
border-inline-end: 0;
|
||||||
|
padding-inline-end: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt .pc-label {
|
||||||
|
display: block;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.58rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt strong {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
color: var(--pc-paper);
|
||||||
|
font-size: clamp(1.15rem, 5vw, 1.5rem);
|
||||||
|
font-weight: 800;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
line-height: 1;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__receipt small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.58rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__context {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.15rem;
|
||||||
|
padding-block: 0.55rem;
|
||||||
|
border-bottom: 1px solid var(--pc-dark-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__context > div {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding-block: 0.22rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__context span {
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-size: 0.68rem;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-hero__value {
|
.live__context strong {
|
||||||
margin: var(--onyx-density-xs) 0 0;
|
color: var(--pc-paper);
|
||||||
font-size: clamp(3rem, 16vw, 5.5rem);
|
font-size: 0.76rem;
|
||||||
font-weight: 800;
|
font-weight: 650;
|
||||||
letter-spacing: -0.04em;
|
text-align: right;
|
||||||
line-height: 0.95;
|
|
||||||
color: var(--onyx-color-text-icons-primary-intense);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-hero__shift {
|
.live__cta {
|
||||||
margin: var(--onyx-density-sm) 0 0;
|
width: 100%;
|
||||||
font-size: clamp(1rem, 3.5vw, 1.25rem);
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-hero__why {
|
.live__note {
|
||||||
display: flex;
|
|
||||||
gap: var(--onyx-density-xs);
|
|
||||||
align-items: flex-start;
|
|
||||||
margin: var(--onyx-density-md) 0;
|
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
line-height: 1.45;
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-metrics {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: var(--onyx-density-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-metric {
|
|
||||||
min-width: 0;
|
|
||||||
padding: var(--onyx-density-md);
|
|
||||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
|
||||||
border-radius: var(--onyx-radius-component-container-soft);
|
|
||||||
background: var(--onyx-color-base-neutral-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-metric__label {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
color: var(--pc-dark-muted);
|
||||||
font-size: 0.78rem;
|
font-size: 0.68rem;
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-metric__value {
|
|
||||||
margin: var(--onyx-density-xs) 0 0;
|
|
||||||
font-size: clamp(1.35rem, 6vw, 1.9rem);
|
|
||||||
font-weight: 700;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-status-card {
|
|
||||||
display: grid;
|
|
||||||
gap: var(--onyx-density-xs);
|
|
||||||
padding: var(--onyx-density-md);
|
|
||||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
|
||||||
border-radius: var(--onyx-radius-component-container-soft);
|
|
||||||
background: var(--onyx-color-base-neutral-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-status-card__row {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: var(--onyx-density-sm);
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-status-card__label {
|
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.live-footer {
|
|
||||||
padding-top: var(--onyx-density-sm);
|
|
||||||
border-top: 1px solid var(--onyx-color-base-neutral-300);
|
|
||||||
color: var(--onyx-color-text-icons-neutral-medium);
|
|
||||||
font-size: 0.75rem;
|
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.live-footer p {
|
.live__sensor {
|
||||||
margin: 0 0 var(--onyx-density-xs);
|
margin: 0;
|
||||||
|
color: var(--pc-dark-muted);
|
||||||
|
font-family: var(--pc-font);
|
||||||
|
font-size: 0.6rem;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 577px) {
|
@media (min-width: 700px) {
|
||||||
.live-metrics {
|
.live {
|
||||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
padding-block: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__top,
|
||||||
|
.live__main {
|
||||||
|
max-width: 36rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.live__main {
|
||||||
|
gap: 1.1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
+513
-295
File diff suppressed because it is too large.
Load diff
+530
-413
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,44 @@
|
|||||||
|
export interface GeoPoint {
|
||||||
|
lat: number
|
||||||
|
lon: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ProjectedPoint {
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createProjection(
|
||||||
|
points: GeoPoint[],
|
||||||
|
width = 1200,
|
||||||
|
height = 800,
|
||||||
|
padding = 80,
|
||||||
|
): (point: GeoPoint) => ProjectedPoint {
|
||||||
|
const lats = points.map((point) => point.lat)
|
||||||
|
const lons = points.map((point) => point.lon)
|
||||||
|
const minLat = Math.min(...lats)
|
||||||
|
const maxLat = Math.max(...lats)
|
||||||
|
const minLon = Math.min(...lons)
|
||||||
|
const maxLon = Math.max(...lons)
|
||||||
|
const spanLat = Math.max(maxLat - minLat, 0.0001)
|
||||||
|
const spanLon = Math.max(maxLon - minLon, 0.0001)
|
||||||
|
const innerW = width - padding * 2
|
||||||
|
const innerH = height - padding * 2
|
||||||
|
|
||||||
|
return (point: GeoPoint) => ({
|
||||||
|
x: padding + ((point.lon - minLon) / spanLon) * innerW,
|
||||||
|
y: padding + ((maxLat - point.lat) / spanLat) * innerH,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pathFromCoordinates(
|
||||||
|
coordinates: Array<[number, number]>,
|
||||||
|
project: (point: GeoPoint) => ProjectedPoint,
|
||||||
|
): string {
|
||||||
|
return coordinates
|
||||||
|
.map(([lon, lat], index) => {
|
||||||
|
const point = project({ lat, lon })
|
||||||
|
return `${index === 0 ? 'M' : 'L'} ${point.x.toFixed(1)} ${point.y.toFixed(1)}`
|
||||||
|
})
|
||||||
|
.join(' ')
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import type { CoolRouteValues } from '#shared/cool'
|
||||||
|
|
||||||
|
export function coolValue(value: number | null | undefined, suffix = ''): string {
|
||||||
|
if (value === null || value === undefined || Number.isNaN(value)) return 'TBD'
|
||||||
|
return `${value}${suffix}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolShade(value: number | null | undefined): string {
|
||||||
|
if (value === null || value === undefined) return 'TBD'
|
||||||
|
return `${value.toFixed(1)}%`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolDistance(value: number | null | undefined): string {
|
||||||
|
if (value === null || value === undefined) return 'TBD'
|
||||||
|
if (value >= 1000) return `${(value / 1000).toFixed(2)} km`
|
||||||
|
return `${Math.floor(value)} m`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolMinutes(value: number | null | undefined): string {
|
||||||
|
if (value === null || value === undefined) return 'TBD'
|
||||||
|
return `${value.toFixed(1)} min`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolYesNo(value: boolean | null | undefined): string {
|
||||||
|
if (value === null || value === undefined) return 'TBD'
|
||||||
|
return value ? 'Yes' : 'No'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolStops(value: number | null | undefined): string {
|
||||||
|
if (value === null || value === undefined) return 'TBD'
|
||||||
|
return String(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolValues(values: CoolRouteValues | null | undefined): CoolRouteValues {
|
||||||
|
return (
|
||||||
|
values ?? {
|
||||||
|
shadePct: null,
|
||||||
|
directSunMin: null,
|
||||||
|
distanceM: null,
|
||||||
|
durationMin: null,
|
||||||
|
stepFree: null,
|
||||||
|
waterStops: null,
|
||||||
|
benchStops: null,
|
||||||
|
rampInclinePct: null,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coolTallyPct(count: number, total: number): number {
|
||||||
|
if (!total) return 0
|
||||||
|
return Math.round((count / total) * 100)
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
import { berlinParts } from '#shared/staffing'
|
||||||
|
import type { Point, Shift, StaffingHour, StaffingResponse } from '#shared/types'
|
||||||
|
import { formatShortDate, formatWeekday, formatWeekdayShort } from '~/utils/format'
|
||||||
|
|
||||||
|
export interface PlanDay {
|
||||||
|
date: string
|
||||||
|
dayNumber: string
|
||||||
|
month: string
|
||||||
|
weekday: string
|
||||||
|
weekdayLong: string
|
||||||
|
shifts: Shift[]
|
||||||
|
hours: StaffingHour[]
|
||||||
|
staffHours: number
|
||||||
|
peakStaff: number
|
||||||
|
peakFootfall: number
|
||||||
|
peakHour: number
|
||||||
|
cost: number
|
||||||
|
overHours: number
|
||||||
|
underHours: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function maxOf<T>(items: T[], score: (item: T) => number): T | undefined {
|
||||||
|
let best: T | undefined
|
||||||
|
for (const item of items) {
|
||||||
|
if (!best || score(item) > score(best)) best = item
|
||||||
|
}
|
||||||
|
return best
|
||||||
|
}
|
||||||
|
|
||||||
|
export function peakShiftOf(plan: StaffingResponse | null | undefined): Shift | undefined {
|
||||||
|
return plan ? maxOf(plan.shifts, (shift) => shift.staff) : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
export function peakHourOf(plan: StaffingResponse | null | undefined): StaffingHour | undefined {
|
||||||
|
return plan ? maxOf(plan.hours, (hour) => hour.footfall) : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
export function totalStaffHoursOf(plan: StaffingResponse | null | undefined): number {
|
||||||
|
return plan ? plan.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
export function savingOf(plan: StaffingResponse | null | undefined): number {
|
||||||
|
if (!plan) return 0
|
||||||
|
return Math.max(0, plan.summary.flat_schedule_cost_eur - plan.summary.cost_eur)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function savingPctOf(plan: StaffingResponse | null | undefined): number {
|
||||||
|
if (!plan || plan.summary.flat_schedule_cost_eur <= 0) return 0
|
||||||
|
return (savingOf(plan) / plan.summary.flat_schedule_cost_eur) * 100
|
||||||
|
}
|
||||||
|
|
||||||
|
export function planDays(plan: StaffingResponse | null | undefined): PlanDay[] {
|
||||||
|
if (!plan) return []
|
||||||
|
|
||||||
|
const shiftsByDate: Record<string, Shift[]> = {}
|
||||||
|
for (const shift of plan.shifts) (shiftsByDate[shift.date] ??= []).push(shift)
|
||||||
|
|
||||||
|
const hoursByDate: Record<string, StaffingHour[]> = {}
|
||||||
|
for (const hour of plan.hours) {
|
||||||
|
const date = berlinParts(hour.t).date
|
||||||
|
;(hoursByDate[date] ??= []).push(hour)
|
||||||
|
}
|
||||||
|
|
||||||
|
const dates = [...new Set([...Object.keys(shiftsByDate), ...Object.keys(hoursByDate)])].sort()
|
||||||
|
const costPerHour = plan.assumptions.labor_cost_eur_h
|
||||||
|
|
||||||
|
return dates.map((date) => {
|
||||||
|
const shifts = (shiftsByDate[date] ?? []).slice().sort((a, b) => a.start.localeCompare(b.start))
|
||||||
|
const hours = (hoursByDate[date] ?? []).slice().sort((a, b) => a.t.localeCompare(b.t))
|
||||||
|
const peakHour = maxOf(hours, (hour) => hour.footfall)
|
||||||
|
const staffHours = hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0)
|
||||||
|
const [dayNumber = '', month = ''] = formatShortDate(date).split(' ')
|
||||||
|
|
||||||
|
return {
|
||||||
|
date,
|
||||||
|
dayNumber,
|
||||||
|
month,
|
||||||
|
weekday: formatWeekdayShort(date),
|
||||||
|
weekdayLong: formatWeekday(date),
|
||||||
|
shifts,
|
||||||
|
hours,
|
||||||
|
staffHours,
|
||||||
|
peakStaff: Math.max(0, ...hours.map((hour) => hour.scheduled_staff), ...shifts.map((shift) => shift.staff)),
|
||||||
|
peakFootfall: peakHour?.footfall ?? 0,
|
||||||
|
peakHour: peakHour ? berlinParts(peakHour.t).hour : 0,
|
||||||
|
cost: staffHours * costPerHour,
|
||||||
|
overHours: hours.filter((hour) => hour.coverage === 'over').length,
|
||||||
|
underHours: hours.filter((hour) => hour.coverage === 'under').length,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function planPulsePoints(plan: StaffingResponse | null | undefined): Point[] {
|
||||||
|
return (plan?.hours ?? []).map((hour) => ({ t: hour.t, v: hour.footfall }))
|
||||||
|
}
|
||||||
|
|
||||||
|
export function numberWord(value: number): string {
|
||||||
|
const words = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten']
|
||||||
|
return words[value] ?? String(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function shiftLabel(shift: Shift): string {
|
||||||
|
return `${shift.start}–${shift.end}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export function coverWord(value: number, singular: string, plural = `${singular}s`): string {
|
||||||
|
return `${value} ${value === 1 ? singular : plural}`
|
||||||
|
}
|
||||||
+6
-5
@@ -7,7 +7,7 @@ export default defineNuxtConfig({
|
|||||||
compatibilityDate: '2026-11-01',
|
compatibilityDate: '2026-11-01',
|
||||||
ssr: true,
|
ssr: true,
|
||||||
modules: ['@sit-onyx/nuxt'],
|
modules: ['@sit-onyx/nuxt'],
|
||||||
css: ['~/assets/css/main.css'],
|
css: ['~/assets/css/main.css', '~/assets/css/cool.css'],
|
||||||
devtools: { enabled: false },
|
devtools: { enabled: false },
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
// Server-side Go API. K8s sets NUXT_API_INTERNAL_BASE=http://api:8080.
|
// Server-side Go API. K8s sets NUXT_API_INTERNAL_BASE=http://api:8080.
|
||||||
@@ -33,20 +33,21 @@ export default defineNuxtConfig({
|
|||||||
app: {
|
app: {
|
||||||
head: {
|
head: {
|
||||||
htmlAttrs: { lang: 'en' },
|
htmlAttrs: { lang: 'en' },
|
||||||
title: 'PulseCast — next week’s staffing plan',
|
title: 'PulseCast — footfall to shifts',
|
||||||
meta: [
|
meta: [
|
||||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1, viewport-fit=cover' },
|
||||||
{
|
{
|
||||||
name: 'description',
|
name: 'description',
|
||||||
content:
|
content:
|
||||||
'PulseCast turns inner-city footfall into a transparent next-week staffing plan for Heilbronn retailers.',
|
'PulseCast turns inner-city footfall into a transparent staffing plan for Heilbronn retailers: the peak shift, the week cost, coverage and the assumptions behind them.',
|
||||||
},
|
},
|
||||||
{ name: 'theme-color', content: '#0f766e' },
|
{ name: 'theme-color', content: '#f4efe6' },
|
||||||
],
|
],
|
||||||
link: [{ rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
|
link: [{ rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
preset: 'node-server',
|
preset: 'node-server',
|
||||||
|
compressPublicAssets: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,952 @@
|
|||||||
|
{
|
||||||
|
"status": "ready",
|
||||||
|
"generatedAt": "2026-08-14",
|
||||||
|
"hotDay": {
|
||||||
|
"date": "2026-08-14",
|
||||||
|
"temperature_max_c": 35,
|
||||||
|
"temperature_min_c": 18.2,
|
||||||
|
"precipitation_mm": 0,
|
||||||
|
"sunshine_hours": 13.9,
|
||||||
|
"cloud_cover_pct": {
|
||||||
|
"10:00": 0,
|
||||||
|
"12:00": 0,
|
||||||
|
"14:00": 0,
|
||||||
|
"16:00": 0
|
||||||
|
},
|
||||||
|
"source": "Open-Meteo historical archive, 49.1423 N 9.2187 E, Europe/Berlin"
|
||||||
|
},
|
||||||
|
"label": "Modeled shade on the 2026-08-14 hot day (35°C, clear sky).",
|
||||||
|
"shadeLabel": "modeled shade, not measured",
|
||||||
|
"origin": {
|
||||||
|
"name": "Stadtgalerie",
|
||||||
|
"note": "Stadtgalerie (OSM-tagged main entrance, east side)",
|
||||||
|
"lat": 49.140269,
|
||||||
|
"lon": 9.218444
|
||||||
|
},
|
||||||
|
"destination": {
|
||||||
|
"name": "Marktplatz",
|
||||||
|
"lat": 49.142318,
|
||||||
|
"lon": 9.218659
|
||||||
|
},
|
||||||
|
"times": [
|
||||||
|
"10:00",
|
||||||
|
"12:00",
|
||||||
|
"14:00",
|
||||||
|
"16:00"
|
||||||
|
],
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"id": "shortest",
|
||||||
|
"label": "Shortest",
|
||||||
|
"longName": "Shortest",
|
||||||
|
"description": "Direct via Fleiner Straße, Kirchbrunnenstraße and Windgasse.",
|
||||||
|
"fullDescription": "Direct route via Fleiner Straße, Kirchbrunnenstraße and Windgasse.",
|
||||||
|
"values": {
|
||||||
|
"10:00": {
|
||||||
|
"shadePct": 61.6,
|
||||||
|
"directSunMin": 1.8,
|
||||||
|
"distanceM": 359.5,
|
||||||
|
"durationMin": 4.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 8,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"12:00": {
|
||||||
|
"shadePct": 46.6,
|
||||||
|
"directSunMin": 2.6,
|
||||||
|
"distanceM": 359.5,
|
||||||
|
"durationMin": 4.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 8,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"14:00": {
|
||||||
|
"shadePct": 27.4,
|
||||||
|
"directSunMin": 3.5,
|
||||||
|
"distanceM": 359.5,
|
||||||
|
"durationMin": 4.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 8,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"16:00": {
|
||||||
|
"shadePct": 43.8,
|
||||||
|
"directSunMin": 2.7,
|
||||||
|
"distanceM": 359.5,
|
||||||
|
"durationMin": 4.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 8,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ramp": {
|
||||||
|
"incline": "15.0%",
|
||||||
|
"location": "Marktplatz tram crossing",
|
||||||
|
"wheelchair": "yes"
|
||||||
|
},
|
||||||
|
"accessibilityNotes": [
|
||||||
|
"Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.",
|
||||||
|
"The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.",
|
||||||
|
"The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.",
|
||||||
|
"The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel."
|
||||||
|
],
|
||||||
|
"geometry": [
|
||||||
|
[
|
||||||
|
9.218444,
|
||||||
|
49.140269
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218519,
|
||||||
|
49.140295
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21863,
|
||||||
|
49.140235
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218708,
|
||||||
|
49.140241
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218776,
|
||||||
|
49.140433
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218928,
|
||||||
|
49.140615
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219171,
|
||||||
|
49.140903
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219365,
|
||||||
|
49.141179
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219399,
|
||||||
|
49.141228
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219422,
|
||||||
|
49.141249
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219685,
|
||||||
|
49.141379
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219485,
|
||||||
|
49.14145
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219432,
|
||||||
|
49.14146
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21907,
|
||||||
|
49.141483
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218977,
|
||||||
|
49.141489
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218891,
|
||||||
|
49.141495
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218896,
|
||||||
|
49.141614
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218894,
|
||||||
|
49.141628
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21889,
|
||||||
|
49.14164
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218876,
|
||||||
|
49.141673
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218874,
|
||||||
|
49.141683
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218873,
|
||||||
|
49.141694
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218882,
|
||||||
|
49.141756
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218926,
|
||||||
|
49.141883
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218973,
|
||||||
|
49.141936
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218975,
|
||||||
|
49.141945
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218977,
|
||||||
|
49.141953
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218981,
|
||||||
|
49.141969
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218984,
|
||||||
|
49.141979
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218986,
|
||||||
|
49.14199
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21899,
|
||||||
|
49.142005
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219019,
|
||||||
|
49.14205
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219065,
|
||||||
|
49.142364
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218659,
|
||||||
|
49.142318
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "shaded",
|
||||||
|
"label": "Shaded",
|
||||||
|
"longName": "Shaded via Deutschhof & Kiliansplatz",
|
||||||
|
"description": "Via the shaded passage, the Deutschhof courtyard and Kiliansplatz.",
|
||||||
|
"fullDescription": "Detour via the shaded passage at the Deutschhof, the Deutschhof courtyard (Taubenbrunnen) and Kiliansplatz.",
|
||||||
|
"values": {
|
||||||
|
"10:00": {
|
||||||
|
"shadePct": 61.5,
|
||||||
|
"directSunMin": 3.8,
|
||||||
|
"distanceM": 732.3,
|
||||||
|
"durationMin": 9.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 9,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"12:00": {
|
||||||
|
"shadePct": 54.1,
|
||||||
|
"directSunMin": 4.5,
|
||||||
|
"distanceM": 732.3,
|
||||||
|
"durationMin": 9.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 9,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"14:00": {
|
||||||
|
"shadePct": 42.6,
|
||||||
|
"directSunMin": 5.6,
|
||||||
|
"distanceM": 732.3,
|
||||||
|
"durationMin": 9.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 9,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
},
|
||||||
|
"16:00": {
|
||||||
|
"shadePct": 50,
|
||||||
|
"directSunMin": 4.9,
|
||||||
|
"distanceM": 732.3,
|
||||||
|
"durationMin": 9.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 9,
|
||||||
|
"rampInclinePct": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ramp": {
|
||||||
|
"incline": "15.0%",
|
||||||
|
"location": "Marktplatz tram crossing",
|
||||||
|
"wheelchair": "yes"
|
||||||
|
},
|
||||||
|
"accessibilityNotes": [
|
||||||
|
"Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.",
|
||||||
|
"The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.",
|
||||||
|
"The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.",
|
||||||
|
"The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel."
|
||||||
|
],
|
||||||
|
"geometry": [
|
||||||
|
[
|
||||||
|
9.218444,
|
||||||
|
49.140269
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218519,
|
||||||
|
49.140295
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21863,
|
||||||
|
49.140235
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218708,
|
||||||
|
49.140241
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218776,
|
||||||
|
49.140433
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218928,
|
||||||
|
49.140615
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219171,
|
||||||
|
49.140903
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219082,
|
||||||
|
49.140927
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218896,
|
||||||
|
49.140978
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21888,
|
||||||
|
49.140984
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218863,
|
||||||
|
49.140991
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218808,
|
||||||
|
49.141022
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218788,
|
||||||
|
49.14103
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218766,
|
||||||
|
49.141036
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218451,
|
||||||
|
49.141096
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218408,
|
||||||
|
49.140996
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218403,
|
||||||
|
49.14098
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218315,
|
||||||
|
49.141
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218078,
|
||||||
|
49.141029
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218044,
|
||||||
|
49.141031
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217998,
|
||||||
|
49.141033
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217824,
|
||||||
|
49.14104
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217795,
|
||||||
|
49.141042
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217769,
|
||||||
|
49.141051
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217747,
|
||||||
|
49.14104
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21773,
|
||||||
|
49.141035
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217711,
|
||||||
|
49.141032
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217675,
|
||||||
|
49.141027
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217651,
|
||||||
|
49.141021
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217642,
|
||||||
|
49.141015
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217633,
|
||||||
|
49.141009
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217626,
|
||||||
|
49.141
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217599,
|
||||||
|
49.140959
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217584,
|
||||||
|
49.140939
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217576,
|
||||||
|
49.14093
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217569,
|
||||||
|
49.140923
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217564,
|
||||||
|
49.140915
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217561,
|
||||||
|
49.140907
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217541,
|
||||||
|
49.140834
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217536,
|
||||||
|
49.140819
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217534,
|
||||||
|
49.140806
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217534,
|
||||||
|
49.140793
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21756,
|
||||||
|
49.140668
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217534,
|
||||||
|
49.140793
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217534,
|
||||||
|
49.140806
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217536,
|
||||||
|
49.140819
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217541,
|
||||||
|
49.140834
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217561,
|
||||||
|
49.140907
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217564,
|
||||||
|
49.140915
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217569,
|
||||||
|
49.140923
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217576,
|
||||||
|
49.14093
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217584,
|
||||||
|
49.140939
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217599,
|
||||||
|
49.140959
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217626,
|
||||||
|
49.141
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217633,
|
||||||
|
49.141009
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217642,
|
||||||
|
49.141015
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217651,
|
||||||
|
49.141021
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217675,
|
||||||
|
49.141027
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217711,
|
||||||
|
49.141032
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21773,
|
||||||
|
49.141035
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217747,
|
||||||
|
49.14104
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217769,
|
||||||
|
49.141051
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217795,
|
||||||
|
49.141042
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217824,
|
||||||
|
49.14104
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.217998,
|
||||||
|
49.141033
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218044,
|
||||||
|
49.141031
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218078,
|
||||||
|
49.141029
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218315,
|
||||||
|
49.141
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218403,
|
||||||
|
49.14098
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218408,
|
||||||
|
49.140996
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218451,
|
||||||
|
49.141096
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218766,
|
||||||
|
49.141036
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218788,
|
||||||
|
49.14103
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218808,
|
||||||
|
49.141022
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218863,
|
||||||
|
49.140991
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21888,
|
||||||
|
49.140984
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218896,
|
||||||
|
49.140978
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219082,
|
||||||
|
49.140927
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219171,
|
||||||
|
49.140903
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219365,
|
||||||
|
49.141179
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219399,
|
||||||
|
49.141228
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219422,
|
||||||
|
49.141249
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219685,
|
||||||
|
49.141379
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219914,
|
||||||
|
49.141492
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220133,
|
||||||
|
49.14176
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220158,
|
||||||
|
49.141805
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220171,
|
||||||
|
49.141829
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220105,
|
||||||
|
49.141838
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219952,
|
||||||
|
49.141856
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21981,
|
||||||
|
49.141873
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218981,
|
||||||
|
49.141969
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218984,
|
||||||
|
49.141979
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218986,
|
||||||
|
49.14199
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21899,
|
||||||
|
49.142005
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219019,
|
||||||
|
49.14205
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219065,
|
||||||
|
49.142364
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218659,
|
||||||
|
49.142318
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "accessible",
|
||||||
|
"label": "Accessible",
|
||||||
|
"longName": "Step-free with water & benches",
|
||||||
|
"description": "Step-free with water and benches, via Fleiner Straße and Sülmerstraße.",
|
||||||
|
"fullDescription": "Step-free route via Fleiner Straße, Sülmerstraße and Falkenstraße, entering Marktplatz from the north to avoid the 15% tram-crossing ramp.",
|
||||||
|
"values": {
|
||||||
|
"10:00": {
|
||||||
|
"shadePct": 67.4,
|
||||||
|
"directSunMin": 1.9,
|
||||||
|
"distanceM": 438.2,
|
||||||
|
"durationMin": 5.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 6,
|
||||||
|
"rampInclinePct": null
|
||||||
|
},
|
||||||
|
"12:00": {
|
||||||
|
"shadePct": 55.1,
|
||||||
|
"directSunMin": 2.6,
|
||||||
|
"distanceM": 438.2,
|
||||||
|
"durationMin": 5.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 6,
|
||||||
|
"rampInclinePct": null
|
||||||
|
},
|
||||||
|
"14:00": {
|
||||||
|
"shadePct": 30.3,
|
||||||
|
"directSunMin": 4,
|
||||||
|
"distanceM": 438.2,
|
||||||
|
"durationMin": 5.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 6,
|
||||||
|
"rampInclinePct": null
|
||||||
|
},
|
||||||
|
"16:00": {
|
||||||
|
"shadePct": 43.8,
|
||||||
|
"directSunMin": 3.3,
|
||||||
|
"distanceM": 438.2,
|
||||||
|
"durationMin": 5.8,
|
||||||
|
"stepFree": true,
|
||||||
|
"waterStops": 2,
|
||||||
|
"benchStops": 6,
|
||||||
|
"rampInclinePct": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ramp": null,
|
||||||
|
"accessibilityNotes": [
|
||||||
|
"Step-free status is based on OSM highway=steps, wheelchair and locked-gate tags, not a field survey.",
|
||||||
|
"The accessible route avoids the 15% ramp at the Marktplatz tram crossing by entering Marktplatz from the north via Sülmerstraße/Falkenstraße.",
|
||||||
|
"The Deutschhof courtyard is a dead end in OSM: the east/south passage is tagged access=no and the north-east gate is locked=yes. The shaded route enters and leaves through the real tunnel/passage on the north side.",
|
||||||
|
"The 'shaded passage' label is descriptive; OSM has no signed name for the tunnel."
|
||||||
|
],
|
||||||
|
"geometry": [
|
||||||
|
[
|
||||||
|
9.218444,
|
||||||
|
49.140269
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218519,
|
||||||
|
49.140295
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.21863,
|
||||||
|
49.140235
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218708,
|
||||||
|
49.140241
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218776,
|
||||||
|
49.140433
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218928,
|
||||||
|
49.140615
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219171,
|
||||||
|
49.140903
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219365,
|
||||||
|
49.141179
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219399,
|
||||||
|
49.141228
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219422,
|
||||||
|
49.141249
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219685,
|
||||||
|
49.141379
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219914,
|
||||||
|
49.141492
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220133,
|
||||||
|
49.14176
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220158,
|
||||||
|
49.141805
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220171,
|
||||||
|
49.141829
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220176,
|
||||||
|
49.141838
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220212,
|
||||||
|
49.141921
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220309,
|
||||||
|
49.142145
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220393,
|
||||||
|
49.142357
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220161,
|
||||||
|
49.142396
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.220084,
|
||||||
|
49.142408
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219981,
|
||||||
|
49.142423
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219843,
|
||||||
|
49.142446
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219601,
|
||||||
|
49.14249
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219389,
|
||||||
|
49.142528
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219329,
|
||||||
|
49.142538
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219255,
|
||||||
|
49.142545
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219199,
|
||||||
|
49.142543
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219139,
|
||||||
|
49.142531
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219094,
|
||||||
|
49.1425
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219079,
|
||||||
|
49.142458
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.219065,
|
||||||
|
49.142364
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9.218659,
|
||||||
|
49.142318
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"recommendationByTime": {
|
||||||
|
"10:00": "shortest",
|
||||||
|
"12:00": "shortest",
|
||||||
|
"14:00": "accessible",
|
||||||
|
"16:00": "accessible"
|
||||||
|
},
|
||||||
|
"modelLabel": "Accessible for Ruth",
|
||||||
|
"water": [
|
||||||
|
{
|
||||||
|
"name": "Drinking water fountain (Kiliansplatz)",
|
||||||
|
"lat": 49.141237,
|
||||||
|
"lon": 9.219556,
|
||||||
|
"wheelchair": null,
|
||||||
|
"nearRoutesM": {
|
||||||
|
"shortest": 7,
|
||||||
|
"shaded": 7,
|
||||||
|
"accessible": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Trinkwasser am Marktplatz",
|
||||||
|
"lat": 49.1422,
|
||||||
|
"lon": 9.218956,
|
||||||
|
"wheelchair": "yes",
|
||||||
|
"nearRoutesM": {
|
||||||
|
"shortest": 6.1,
|
||||||
|
"shaded": 6.1,
|
||||||
|
"accessible": 16.6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"city": "Heilbronn",
|
||||||
|
"hotDay": {
|
||||||
|
"date": "2026-08-14",
|
||||||
|
"temperature_max_c": 35,
|
||||||
|
"temperature_min_c": 18.2,
|
||||||
|
"precipitation_mm": 0,
|
||||||
|
"sunshine_hours": 13.9,
|
||||||
|
"cloud_cover_pct": {
|
||||||
|
"10:00": 0,
|
||||||
|
"12:00": 0,
|
||||||
|
"14:00": 0,
|
||||||
|
"16:00": 0
|
||||||
|
},
|
||||||
|
"source": "Open-Meteo historical archive, 49.1423 N 9.2187 E, Europe/Berlin"
|
||||||
|
},
|
||||||
|
"shadeLabel": "modeled shade, not measured",
|
||||||
|
"method": "NOAA solar position + 2D building-footprint shadow sweep + tree-canopy shadow discs; 5 m route sampling.",
|
||||||
|
"solarPositions": {
|
||||||
|
"10:00": {
|
||||||
|
"altitude_deg": 35.3,
|
||||||
|
"azimuth_deg": 110.8
|
||||||
|
},
|
||||||
|
"12:00": {
|
||||||
|
"altitude_deg": 50.8,
|
||||||
|
"azimuth_deg": 145
|
||||||
|
},
|
||||||
|
"14:00": {
|
||||||
|
"altitude_deg": 54.5,
|
||||||
|
"azimuth_deg": 193.5
|
||||||
|
},
|
||||||
|
"16:00": {
|
||||||
|
"altitude_deg": 43.3,
|
||||||
|
"azimuth_deg": 235.1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dataGaps": [
|
||||||
|
"Building heights: 445 of 854 main footprints have no height or building:levels in OSM; type-based defaults are used.",
|
||||||
|
"Tree heights are modeled from cadastre crown diameters, not measured.",
|
||||||
|
"Shade is clear-sky geometric shade; cloud cover is reported but not applied to direct_sun_min.",
|
||||||
|
"OSM is crowd-sourced; completeness of benches, water and kerb tags is not guaranteed."
|
||||||
|
],
|
||||||
|
"walkingSpeedMps": 1.25
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
+5
-2
@@ -1,4 +1,7 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none">
|
||||||
<rect width="48" height="48" rx="12" fill="#0F766E"/>
|
<rect width="48" height="48" fill="#16130F"/>
|
||||||
<path d="M7 26h8l3-9 5 16 4-11 3 4h11" stroke="#CCFBF1" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>
|
<rect x="7" y="27" width="6" height="13" fill="#F4EFE6"/>
|
||||||
|
<rect x="17" y="17" width="6" height="23" fill="#F4EFE6"/>
|
||||||
|
<rect x="27" y="8" width="6" height="32" fill="#E84100"/>
|
||||||
|
<rect x="37" y="22" width="4" height="18" fill="#F4EFE6"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 370 B |
@@ -0,0 +1,17 @@
|
|||||||
|
import { isCoolRound } from '../../../shared/cool'
|
||||||
|
import { getCoolVoteTally, resetCoolRound } from '../../utils/cool-votes'
|
||||||
|
|
||||||
|
interface ResetBody {
|
||||||
|
round?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
setHeader(event, 'cache-control', 'no-store')
|
||||||
|
const body = await readBody<ResetBody>(event)
|
||||||
|
const round = body?.round ?? 'preselection'
|
||||||
|
if (!isCoolRound(round)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
||||||
|
}
|
||||||
|
const state = resetCoolRound(round)
|
||||||
|
return { state, tally: getCoolVoteTally(round) }
|
||||||
|
})
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { getCoolState } from '../../utils/cool-votes'
|
||||||
|
import { isCoolRound } from '../../../shared/cool'
|
||||||
|
|
||||||
|
export default defineEventHandler((event) => {
|
||||||
|
setHeader(event, 'cache-control', 'no-store')
|
||||||
|
const query = getQuery(event)
|
||||||
|
const round = query.round === undefined ? 'preselection' : query.round
|
||||||
|
if (!isCoolRound(round)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
||||||
|
}
|
||||||
|
return getCoolState(round)
|
||||||
|
})
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { isCoolRouteId, isCoolRound, isCoolScene, isCoolTime } from '../../../shared/cool'
|
||||||
|
import { updateCoolState } from '../../utils/cool-votes'
|
||||||
|
|
||||||
|
interface StateBody {
|
||||||
|
round?: unknown
|
||||||
|
time?: unknown
|
||||||
|
selectedRoute?: unknown
|
||||||
|
scene?: unknown
|
||||||
|
voteOpen?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
setHeader(event, 'cache-control', 'no-store')
|
||||||
|
const body = await readBody<StateBody>(event)
|
||||||
|
const round = body?.round ?? 'preselection'
|
||||||
|
if (!isCoolRound(round)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
||||||
|
}
|
||||||
|
if (body.time !== undefined && !isCoolTime(body.time)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid time. Expected 10:00 | 12:00 | 14:00 | 16:00.' })
|
||||||
|
}
|
||||||
|
if (body.selectedRoute !== undefined && !isCoolRouteId(body.selectedRoute)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid route.' })
|
||||||
|
}
|
||||||
|
if (body.scene !== undefined && !isCoolScene(body.scene)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid scene.' })
|
||||||
|
}
|
||||||
|
if (body.voteOpen !== undefined && typeof body.voteOpen !== 'boolean') {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'voteOpen must be a boolean.' })
|
||||||
|
}
|
||||||
|
|
||||||
|
return updateCoolState(round, {
|
||||||
|
...(isCoolTime(body.time) ? { time: body.time } : {}),
|
||||||
|
...(isCoolRouteId(body.selectedRoute) ? { selectedRoute: body.selectedRoute } : {}),
|
||||||
|
...(isCoolScene(body.scene) ? { scene: body.scene } : {}),
|
||||||
|
...(typeof body.voteOpen === 'boolean' ? { voteOpen: body.voteOpen } : {}),
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { isCoolRound } from '../../../shared/cool'
|
||||||
|
import { getCoolVoteTally } from '../../utils/cool-votes'
|
||||||
|
|
||||||
|
export default defineEventHandler((event) => {
|
||||||
|
setHeader(event, 'cache-control', 'no-store')
|
||||||
|
const query = getQuery(event)
|
||||||
|
const round = query.round === undefined ? 'preselection' : query.round
|
||||||
|
if (!isCoolRound(round)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
||||||
|
}
|
||||||
|
return getCoolVoteTally(round)
|
||||||
|
})
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { isCoolRouteId, isCoolRound } from '../../../shared/cool'
|
||||||
|
import { getCoolState, isValidCoolSessionId, recordCoolVote } from '../../utils/cool-votes'
|
||||||
|
|
||||||
|
interface VoteBody {
|
||||||
|
route?: unknown
|
||||||
|
sessionId?: unknown
|
||||||
|
round?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineEventHandler(async (event) => {
|
||||||
|
setHeader(event, 'cache-control', 'no-store')
|
||||||
|
const body = await readBody<VoteBody>(event)
|
||||||
|
const round = body?.round ?? 'preselection'
|
||||||
|
|
||||||
|
if (!isCoolRound(round)) {
|
||||||
|
throw createError({ statusCode: 400, statusMessage: 'Invalid round. Expected preselection | final.' })
|
||||||
|
}
|
||||||
|
if (!isCoolRouteId(body?.route)) {
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: 'Invalid route. Expected shortest | shaded | accessible.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!isValidCoolSessionId(body?.sessionId)) {
|
||||||
|
throw createError({
|
||||||
|
statusCode: 400,
|
||||||
|
statusMessage: 'Invalid session. Expected an anonymous 8–80 character ID.',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!getCoolState(round).voteOpen) {
|
||||||
|
throw createError({ statusCode: 409, statusMessage: 'Voting is not open.' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = recordCoolVote(round, body.route, body.sessionId)
|
||||||
|
setResponseStatus(event, result.duplicate ? 200 : 201)
|
||||||
|
return {
|
||||||
|
yourRoute: result.route,
|
||||||
|
duplicate: result.duplicate,
|
||||||
|
tally: result.tally,
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
import { isCoolRouteId, isCoolScene, isCoolTime } from '../../shared/cool'
|
||||||
|
import type {
|
||||||
|
CoolDemoState,
|
||||||
|
CoolRouteId,
|
||||||
|
CoolRound,
|
||||||
|
CoolVoteCounts,
|
||||||
|
CoolVoteTally,
|
||||||
|
} from '../../shared/cool'
|
||||||
|
|
||||||
|
type StatePatch = Partial<Pick<CoolDemoState, 'time' | 'selectedRoute' | 'scene' | 'voteOpen'>>
|
||||||
|
|
||||||
|
const states = new Map<CoolRound, CoolDemoState>()
|
||||||
|
const votes = new Map<CoolRound, Map<string, CoolRouteId>>()
|
||||||
|
const counts = new Map<CoolRound, CoolVoteCounts>()
|
||||||
|
let updatedAt = new Map<CoolRound, string | null>()
|
||||||
|
|
||||||
|
function blankState(round: CoolRound): CoolDemoState {
|
||||||
|
return {
|
||||||
|
round,
|
||||||
|
time: '10:00',
|
||||||
|
selectedRoute: 'shortest',
|
||||||
|
scene: 'ruth',
|
||||||
|
voteOpen: false,
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureVotes(round: CoolRound): Map<string, CoolRouteId> {
|
||||||
|
let map = votes.get(round)
|
||||||
|
if (!map) {
|
||||||
|
map = new Map()
|
||||||
|
votes.set(round, map)
|
||||||
|
}
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureCounts(round: CoolRound): CoolVoteCounts {
|
||||||
|
let value = counts.get(round)
|
||||||
|
if (!value) {
|
||||||
|
value = { shortest: 0, shaded: 0, accessible: 0 }
|
||||||
|
counts.set(round, value)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCoolState(round: CoolRound): CoolDemoState {
|
||||||
|
let state = states.get(round)
|
||||||
|
if (!state) {
|
||||||
|
state = blankState(round)
|
||||||
|
states.set(round, state)
|
||||||
|
}
|
||||||
|
return { ...state }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateCoolState(round: CoolRound, patch: StatePatch): CoolDemoState {
|
||||||
|
const current = getCoolState(round)
|
||||||
|
const next: CoolDemoState = {
|
||||||
|
...current,
|
||||||
|
...(isCoolTime(patch.time) ? { time: patch.time } : {}),
|
||||||
|
...(isCoolRouteId(patch.selectedRoute) ? { selectedRoute: patch.selectedRoute } : {}),
|
||||||
|
...(isCoolScene(patch.scene) ? { scene: patch.scene } : {}),
|
||||||
|
...(typeof patch.voteOpen === 'boolean' ? { voteOpen: patch.voteOpen } : {}),
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
states.set(round, next)
|
||||||
|
return { ...next }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resetCoolRound(round: CoolRound): CoolDemoState {
|
||||||
|
const next = blankState(round)
|
||||||
|
states.set(round, next)
|
||||||
|
votes.set(round, new Map())
|
||||||
|
counts.set(round, { shortest: 0, shaded: 0, accessible: 0 })
|
||||||
|
updatedAt = new Map([...updatedAt].filter(([key]) => key !== round))
|
||||||
|
return { ...next }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCoolVoteTally(round: CoolRound): CoolVoteTally {
|
||||||
|
return {
|
||||||
|
round,
|
||||||
|
counts: { ...ensureCounts(round) },
|
||||||
|
total: ensureVotes(round).size,
|
||||||
|
updatedAt: updatedAt.get(round) ?? null,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function recordCoolVote(
|
||||||
|
round: CoolRound,
|
||||||
|
route: CoolRouteId,
|
||||||
|
sessionId: string,
|
||||||
|
): { duplicate: boolean; route: CoolRouteId; tally: CoolVoteTally } {
|
||||||
|
const state = getCoolState(round)
|
||||||
|
if (!state.voteOpen) {
|
||||||
|
throw new Error('Voting is not open')
|
||||||
|
}
|
||||||
|
|
||||||
|
const roundVotes = ensureVotes(round)
|
||||||
|
const existing = roundVotes.get(sessionId)
|
||||||
|
if (existing) {
|
||||||
|
return { duplicate: true, route: existing, tally: getCoolVoteTally(round) }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isCoolRouteId(route)) throw new Error(`Invalid route: ${route}`)
|
||||||
|
roundVotes.set(sessionId, route)
|
||||||
|
const current = ensureCounts(round)
|
||||||
|
counts.set(round, { ...current, [route]: current[route] + 1 })
|
||||||
|
updatedAt.set(round, new Date().toISOString())
|
||||||
|
return { duplicate: false, route, tally: getCoolVoteTally(round) }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isValidCoolSessionId(value: unknown): value is string {
|
||||||
|
return typeof value === 'string' && /^[A-Za-z0-9_-]{8,80}$/.test(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Test helper only. */
|
||||||
|
export function resetCoolDemoStore(): void {
|
||||||
|
states.clear()
|
||||||
|
votes.clear()
|
||||||
|
counts.clear()
|
||||||
|
updatedAt = new Map()
|
||||||
|
}
|
||||||
+260
@@ -0,0 +1,260 @@
|
|||||||
|
export const COOL_ROUTE_IDS = ['shortest', 'shaded', 'accessible'] as const
|
||||||
|
export type CoolRouteId = (typeof COOL_ROUTE_IDS)[number]
|
||||||
|
|
||||||
|
export const COOL_TIMES = ['10:00', '12:00', '14:00', '16:00'] as const
|
||||||
|
export type CoolTime = (typeof COOL_TIMES)[number]
|
||||||
|
|
||||||
|
export const COOL_ROUNDS = ['preselection', 'final'] as const
|
||||||
|
export type CoolRound = (typeof COOL_ROUNDS)[number]
|
||||||
|
|
||||||
|
export const COOL_SCENES = ['ruth', 'places', 'routes', 'vote', 'locked', 'coda'] as const
|
||||||
|
export type CoolScene = (typeof COOL_SCENES)[number]
|
||||||
|
|
||||||
|
export const COOL_ROUTE_LABELS: Record<CoolRouteId, string> = {
|
||||||
|
shortest: 'Shortest',
|
||||||
|
shaded: 'Shaded',
|
||||||
|
accessible: 'Accessible',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const COOL_ROUTE_DESCRIPTIONS: Record<CoolRouteId, string> = {
|
||||||
|
shortest: 'Direct via Fleiner Straße.',
|
||||||
|
shaded: 'Via the shaded passage and Kiliansplatz.',
|
||||||
|
accessible: 'Step-free, with water and benches.',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const COOL_MODEL_LABEL = 'Accessible for Ruth'
|
||||||
|
export const COOL_COMPOSITE_LABEL = 'Composite persona — illustrative, not a real person'
|
||||||
|
export const COOL_CLOSING_LINE =
|
||||||
|
'The pulse is not the people. But the city still has to protect them.'
|
||||||
|
|
||||||
|
export interface CoolRouteValues {
|
||||||
|
shadePct: number
|
||||||
|
directSunMin: number
|
||||||
|
distanceM: number
|
||||||
|
durationMin: number
|
||||||
|
stepFree: boolean
|
||||||
|
waterStops: number
|
||||||
|
benchStops: number
|
||||||
|
rampInclinePct: number | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolRouteOption {
|
||||||
|
id: CoolRouteId
|
||||||
|
label: string
|
||||||
|
longName: string
|
||||||
|
description: string
|
||||||
|
fullDescription: string
|
||||||
|
values: Record<string, CoolRouteValues>
|
||||||
|
ramp: { incline: string; location: string; wheelchair: string | null } | null
|
||||||
|
accessibilityNotes: string[]
|
||||||
|
geometry: Array<[number, number]>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolPoint {
|
||||||
|
name: string
|
||||||
|
lat: number
|
||||||
|
lon: number
|
||||||
|
wheelchair?: string | null
|
||||||
|
nearRoutesM?: Record<string, number>
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolRouteBundle {
|
||||||
|
status: 'ready' | 'pending'
|
||||||
|
generatedAt: string
|
||||||
|
hotDay: {
|
||||||
|
date: string
|
||||||
|
temperature_max_c: number
|
||||||
|
temperature_min_c: number
|
||||||
|
precipitation_mm: number
|
||||||
|
sunshine_hours: number
|
||||||
|
source: string
|
||||||
|
} | null
|
||||||
|
label: string
|
||||||
|
shadeLabel: string
|
||||||
|
origin: { name: string; note?: string; lat?: number; lon?: number }
|
||||||
|
destination: { name: string; note?: string; lat?: number; lon?: number }
|
||||||
|
times: CoolTime[]
|
||||||
|
routes: CoolRouteOption[]
|
||||||
|
recommendationByTime: Record<string, CoolRouteId>
|
||||||
|
modelLabel: string
|
||||||
|
water: CoolPoint[]
|
||||||
|
meta: {
|
||||||
|
city: string
|
||||||
|
shadeLabel: string
|
||||||
|
method: string
|
||||||
|
solarPositions: Record<string, { altitude_deg: number; azimuth_deg: number }>
|
||||||
|
dataGaps: string[]
|
||||||
|
walkingSpeedMps: number
|
||||||
|
} | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolDemoState {
|
||||||
|
round: CoolRound
|
||||||
|
time: CoolTime
|
||||||
|
selectedRoute: CoolRouteId
|
||||||
|
scene: CoolScene
|
||||||
|
voteOpen: boolean
|
||||||
|
updatedAt: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolVoteCounts {
|
||||||
|
shortest: number
|
||||||
|
shaded: number
|
||||||
|
accessible: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolVoteTally {
|
||||||
|
round: CoolRound
|
||||||
|
counts: CoolVoteCounts
|
||||||
|
total: number
|
||||||
|
updatedAt: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolVoteResponse {
|
||||||
|
yourRoute: CoolRouteId
|
||||||
|
duplicate: boolean
|
||||||
|
tally: CoolVoteTally
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolCityCatchment {
|
||||||
|
rank: number
|
||||||
|
sensor_id: string
|
||||||
|
sensor_name: string
|
||||||
|
center: { lat: number; lon: number }
|
||||||
|
radius_m: number
|
||||||
|
geometry: { type: string; coordinates: number[][][] }
|
||||||
|
inputs: {
|
||||||
|
footfall: { mean: number; p95: number }
|
||||||
|
shade: {
|
||||||
|
building_footprint_share_of_land: number
|
||||||
|
tree_canopy_share_of_land_proxy: number
|
||||||
|
water_share_of_catchment: number
|
||||||
|
building_polygons: number
|
||||||
|
mapped_tree_points: number
|
||||||
|
}
|
||||||
|
access: {
|
||||||
|
nearest_public_drinking_water_m: number
|
||||||
|
nearest_bench_m: number
|
||||||
|
nearest_public_toilet_m: number
|
||||||
|
nearest_step_free_anchor_m: number
|
||||||
|
within_300m: Record<string, number>
|
||||||
|
}
|
||||||
|
vulnerability: {
|
||||||
|
district: string
|
||||||
|
age_65plus_share: number
|
||||||
|
age_65plus_count: number
|
||||||
|
district_population: number
|
||||||
|
reference_date: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
normalized_inputs: Record<string, number>
|
||||||
|
scores: {
|
||||||
|
footfall: number
|
||||||
|
shade_deficit: number
|
||||||
|
access_deficit: number
|
||||||
|
vulnerability: number
|
||||||
|
gap_index: number
|
||||||
|
}
|
||||||
|
nearest_cool_place: { name: string; category: string; distance_m: number } | null
|
||||||
|
reason: string
|
||||||
|
max_overlap_with: { sensor_id: string; distance_m: number; overlap_fraction: number } | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolCityPlace {
|
||||||
|
name: string
|
||||||
|
category: string
|
||||||
|
lat: number
|
||||||
|
lon: number
|
||||||
|
distance_to_cluster_center_m: number
|
||||||
|
within_1km?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CoolCityBundle {
|
||||||
|
meta: {
|
||||||
|
city: string
|
||||||
|
generated: string
|
||||||
|
sensor_source: string
|
||||||
|
sensor_data_version: string
|
||||||
|
sensor_model_version: string
|
||||||
|
catchment_radius_m: number
|
||||||
|
catchment_area_m2: number
|
||||||
|
method: string
|
||||||
|
weights: Record<string, number>
|
||||||
|
weights_note: string
|
||||||
|
ranking_note: string
|
||||||
|
subweights: Record<string, unknown>
|
||||||
|
assumptions: string[]
|
||||||
|
sources: Array<{ name: string; url: string; retrieved: string; license: string }>
|
||||||
|
self_check?: Record<string, unknown>
|
||||||
|
sensitivity?: Record<string, unknown>
|
||||||
|
data_gaps?: string[]
|
||||||
|
layer_counts?: Record<string, number>
|
||||||
|
}
|
||||||
|
catchments: CoolCityCatchment[]
|
||||||
|
official_cool_places: CoolCityPlace[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCoolRouteId(value: unknown): value is CoolRouteId {
|
||||||
|
return typeof value === 'string' && (COOL_ROUTE_IDS as readonly string[]).includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCoolTime(value: unknown): value is CoolTime {
|
||||||
|
return typeof value === 'string' && (COOL_TIMES as readonly string[]).includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCoolRound(value: unknown): value is CoolRound {
|
||||||
|
return typeof value === 'string' && (COOL_ROUNDS as readonly string[]).includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCoolScene(value: unknown): value is CoolScene {
|
||||||
|
return typeof value === 'string' && (COOL_SCENES as readonly string[]).includes(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function defaultCoolState(round: CoolRound = 'preselection'): CoolDemoState {
|
||||||
|
return {
|
||||||
|
round,
|
||||||
|
time: '10:00',
|
||||||
|
selectedRoute: 'shortest',
|
||||||
|
scene: 'ruth',
|
||||||
|
voteOpen: false,
|
||||||
|
updatedAt: '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function emptyCoolTally(round: CoolRound = 'preselection'): CoolVoteTally {
|
||||||
|
return {
|
||||||
|
round,
|
||||||
|
counts: { shortest: 0, shaded: 0, accessible: 0 },
|
||||||
|
total: 0,
|
||||||
|
updatedAt: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Runtime fallback only; the shipped route.json has the real modelled values. */
|
||||||
|
export function pendingCoolRouteBundle(): CoolRouteBundle {
|
||||||
|
return {
|
||||||
|
status: 'pending',
|
||||||
|
generatedAt: '',
|
||||||
|
hotDay: null,
|
||||||
|
label: 'Route/shade bundle pending. No estimates shown.',
|
||||||
|
shadeLabel: 'modeled shade, not measured',
|
||||||
|
origin: { name: 'Stadtgalerie' },
|
||||||
|
destination: { name: 'Marktplatz' },
|
||||||
|
times: [...COOL_TIMES],
|
||||||
|
routes: COOL_ROUTE_IDS.map((id) => ({
|
||||||
|
id,
|
||||||
|
label: COOL_ROUTE_LABELS[id],
|
||||||
|
longName: COOL_ROUTE_LABELS[id],
|
||||||
|
description: COOL_ROUTE_DESCRIPTIONS[id],
|
||||||
|
fullDescription: '',
|
||||||
|
values: {},
|
||||||
|
ramp: null,
|
||||||
|
accessibilityNotes: [],
|
||||||
|
geometry: [],
|
||||||
|
})),
|
||||||
|
recommendationByTime: {},
|
||||||
|
modelLabel: COOL_MODEL_LABEL,
|
||||||
|
water: [],
|
||||||
|
meta: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import { beforeEach, describe, expect, it } from 'vitest'
|
||||||
|
import {
|
||||||
|
getCoolState,
|
||||||
|
getCoolVoteTally,
|
||||||
|
isValidCoolSessionId,
|
||||||
|
recordCoolVote,
|
||||||
|
resetCoolDemoStore,
|
||||||
|
resetCoolRound,
|
||||||
|
updateCoolState,
|
||||||
|
} from '../server/utils/cool-votes'
|
||||||
|
|
||||||
|
describe('Cool City demo state and vote tally', () => {
|
||||||
|
beforeEach(() => resetCoolDemoStore())
|
||||||
|
|
||||||
|
it('starts with the Ruth card and 10:00, shortest, closed', () => {
|
||||||
|
const state = getCoolState('preselection')
|
||||||
|
expect(state.scene).toBe('ruth')
|
||||||
|
expect(state.time).toBe('10:00')
|
||||||
|
expect(state.selectedRoute).toBe('shortest')
|
||||||
|
expect(state.voteOpen).toBe(false)
|
||||||
|
expect(getCoolVoteTally('preselection').total).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('updates scene, time, route and vote phase', () => {
|
||||||
|
updateCoolState('preselection', { scene: 'routes', time: '16:00', selectedRoute: 'accessible' })
|
||||||
|
updateCoolState('preselection', { scene: 'vote', voteOpen: true })
|
||||||
|
const state = getCoolState('preselection')
|
||||||
|
expect(state.scene).toBe('vote')
|
||||||
|
expect(state.time).toBe('16:00')
|
||||||
|
expect(state.selectedRoute).toBe('accessible')
|
||||||
|
expect(state.voteOpen).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not count duplicate sessions', () => {
|
||||||
|
updateCoolState('preselection', { scene: 'vote', voteOpen: true })
|
||||||
|
const first = recordCoolVote('preselection', 'accessible', 'session_12345678')
|
||||||
|
expect(first.duplicate).toBe(false)
|
||||||
|
expect(first.tally.counts.accessible).toBe(1)
|
||||||
|
|
||||||
|
const duplicate = recordCoolVote('preselection', 'shortest', 'session_12345678')
|
||||||
|
expect(duplicate.duplicate).toBe(true)
|
||||||
|
expect(duplicate.route).toBe('accessible')
|
||||||
|
expect(duplicate.tally.counts.shortest).toBe(0)
|
||||||
|
expect(duplicate.tally.total).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('keeps preselection and final rounds separate', () => {
|
||||||
|
updateCoolState('preselection', { scene: 'vote', voteOpen: true })
|
||||||
|
updateCoolState('final', { scene: 'vote', voteOpen: true })
|
||||||
|
recordCoolVote('preselection', 'shortest', 'session_aaaaaaaa')
|
||||||
|
recordCoolVote('final', 'accessible', 'session_bbbbbbbb')
|
||||||
|
expect(getCoolVoteTally('preselection').counts.shortest).toBe(1)
|
||||||
|
expect(getCoolVoteTally('final').counts.accessible).toBe(1)
|
||||||
|
expect(getCoolVoteTally('final').counts.shortest).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('refuses votes before the round is open', () => {
|
||||||
|
expect(() => recordCoolVote('preselection', 'accessible', 'session_12345678')).toThrow(
|
||||||
|
'Voting is not open',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('resets votes and state for one round only', () => {
|
||||||
|
updateCoolState('preselection', { scene: 'vote', voteOpen: true })
|
||||||
|
updateCoolState('final', { scene: 'vote', voteOpen: true })
|
||||||
|
recordCoolVote('preselection', 'accessible', 'session_aaaaaaaa')
|
||||||
|
recordCoolVote('final', 'shortest', 'session_bbbbbbbb')
|
||||||
|
resetCoolRound('preselection')
|
||||||
|
expect(getCoolState('preselection').scene).toBe('ruth')
|
||||||
|
expect(getCoolVoteTally('preselection').total).toBe(0)
|
||||||
|
expect(getCoolVoteTally('final').total).toBe(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('accepts opaque random session IDs and rejects unsafe values', () => {
|
||||||
|
expect(isValidCoolSessionId('8a1f9a2e-9e2c-4f6b-9c2b-3a4b5c6d7e8f')).toBe(true)
|
||||||
|
expect(isValidCoolSessionId('session_12345678')).toBe(true)
|
||||||
|
expect(isValidCoolSessionId('short')).toBe(false)
|
||||||
|
expect(isValidCoolSessionId('has spaces in it')).toBe(false)
|
||||||
|
expect(isValidCoolSessionId('')).toBe(false)
|
||||||
|
expect(isValidCoolSessionId(undefined)).toBe(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in new issue
Block a user