feat: build the Cool City public route demo
ci / check (push) Successful in 55s

- add /cool, /cool?vote=1, /cool/stage and /cool/city on the existing Nuxt/Onyx stack
- wire real route/shade metrics and OSM geometry from the route bundle; city-gap data for the city view
- show shade % and direct-sun minutes together; recommend Accessible for Ruth with the 15% ramp trade-off
- add in-memory time/scene/round state and one anonymous vote per session, polled every 2 s
- keep the retail module linked but out of the Cool City story
This commit is contained in:
Noel Sabia committed 2026-11-14 13:49:22 +01:00
1 parent 33063afbdf
commit 2bc52a314d
28 files changed
+8633 -45

No files matched your search

+200
View File
@@ -0,0 +1,200 @@
<script setup lang="ts">
import type { CoolRouteOption, CoolRouteValues } from '#shared/cool'
import { coolDistance, coolMinutes, coolShade, coolStops, coolValues, coolYesNo } from '~/utils/cool'
const props = withDefaults(
defineProps<{
route: CoolRouteOption
values: CoolRouteValues | null
recommended?: boolean
selected?: boolean
selectable?: boolean
}>(),
{ recommended: false, selected: false, selectable: false },
)
const emit = defineEmits<{ select: [id: CoolRouteOption['id']] }>()
const data = computed(() => coolValues(props.values))
</script>
<template>
<component
:is="selectable ? 'button' : 'article'"
class="cc-route-card"
:class="[
`cc-route-card--${route.id}`,
{ 'cc-route-card--recommended': recommended, 'cc-route-card--selected': selected },
]"
:type="selectable ? 'button' : undefined"
:aria-pressed="selectable ? selected : undefined"
@click="selectable ? emit('select', route.id) : undefined"
>
<span class="cc-route-card__line" aria-hidden="true" />
<span class="cc-route-card__head">
<span class="cc-route-card__label">{{ route.label }}</span>
<span v-if="recommended" class="cc-route-card__tag">Accessible for Ruth</span>
<span v-else-if="selected" class="cc-route-card__tag cc-route-card__tag--quiet">Selected</span>
</span>
<span class="cc-route-card__desc">{{ route.description }}</span>
<span class="cc-route-card__primary">
<strong>{{ coolShade(data.shadePct) }}</strong> shade
<span class="cc-route-card__modeled">modelled</span>
<span class="cc-route-card__divider">·</span>
<strong>{{ coolMinutes(data.directSunMin) }}</strong> direct sun
</span>
<span class="cc-route-card__secondary">
{{ coolDistance(data.distanceM) }} · {{ coolMinutes(data.durationMin) }} ·
<template v-if="route.ramp">{{ route.ramp.incline.replace('.0%', '%') }} ramp</template>
<template v-else>no ramp</template>
</span>
<span class="cc-route-card__access">
Step-free {{ coolYesNo(data.stepFree) }} · Water {{ coolStops(data.waterStops) }} ·
Benches {{ coolStops(data.benchStops) }}
</span>
</component>
</template>
<style scoped>
.cc-route-card {
display: flex;
width: 100%;
min-width: 0;
flex-direction: column;
gap: 0.3rem;
padding: 0.95rem 1rem 0.85rem;
border: 1px solid var(--cc-line);
border-radius: 24px;
background: var(--cc-surface, rgba(255, 255, 255, 0.86));
box-shadow: var(--cc-shadow-soft);
color: var(--cc-ink);
font: inherit;
text-align: left;
}
button.cc-route-card {
cursor: pointer;
}
button.cc-route-card:hover {
border-color: var(--cc-line-strong);
}
.cc-route-card:focus-visible {
outline: 3px solid var(--cc-focus);
outline-offset: 2px;
}
.cc-route-card--selected {
border-color: var(--cc-ink);
box-shadow: 0 0 0 2px var(--cc-ink), var(--cc-shadow-soft);
}
.cc-route-card--recommended {
border-color: var(--cc-shade);
}
.cc-route-card__line {
display: block;
width: 100%;
height: 4px;
margin-bottom: 0.25rem;
border-radius: 999px;
background: var(--cc-ink);
}
.cc-route-card--shortest .cc-route-card__line {
background: var(--cc-heat);
}
.cc-route-card--shaded .cc-route-card__line {
background: var(--cc-shade);
}
.cc-route-card--accessible .cc-route-card__line {
background: var(--cc-ink);
}
.cc-route-card__head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.45rem;
}
.cc-route-card__label {
font-size: 1.18rem;
font-weight: 800;
letter-spacing: -0.02em;
}
.cc-route-card__tag {
margin-inline-start: auto;
padding: 0.16rem 0.42rem;
border-radius: 999px;
background: var(--cc-shade);
color: #fff;
font-size: 0.6rem;
font-weight: 750;
letter-spacing: 0.04em;
}
.cc-route-card__tag--quiet {
background: var(--cc-ink);
}
.cc-route-card__desc {
color: var(--cc-muted);
font-size: 0.8rem;
line-height: 1.35;
}
.cc-route-card__primary {
margin-top: 0.25rem;
color: var(--cc-ink);
font-size: 1.05rem;
font-weight: 500;
line-height: 1.35;
font-variant-numeric: tabular-nums;
}
.cc-route-card__primary strong {
font-size: 1.35rem;
font-weight: 800;
letter-spacing: -0.03em;
}
.cc-route-card__modeled {
margin-inline-start: 0.2rem;
color: var(--cc-muted);
font-size: 0.58rem;
font-weight: 600;
letter-spacing: 0.03em;
text-transform: uppercase;
}
.cc-route-card__divider {
margin-inline: 0.25rem;
color: var(--cc-line-strong);
}
.cc-route-card__secondary,
.cc-route-card__access {
color: var(--cc-muted);
font-size: 0.72rem;
line-height: 1.4;
font-variant-numeric: tabular-nums;
}
.cc-route-card__access {
font-size: 0.68rem;
}
@media (min-width: 760px) {
.cc-route-card {
padding: 1.05rem 1.1rem;
}
}
</style>