- 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:
1 parent
33063afbdf
commit
2bc52a314d
28 files changed
+8633
-45
No files matched your search
@@ -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 }
|
||||
}
|
||||
Reference in new issue
Block a user