Files
Noel Sabia 2bc52a314d
ci / check (push) Successful in 55s
feat: build the Cool City public route demo
- 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
2026-11-14 13:49:22 +01:00

97 lines
3.1 KiB
Vue

<script setup lang="ts">
import {
iconCalendar,
iconChart,
iconCircleInformation,
iconFlash,
iconHome,
} from '@sit-onyx/icons'
const route = useRoute()
const config = useRuntimeConfig()
const usingMock = computed(() => {
const value = config.public.useMock
return value === true || value === '1' || value === '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 = [
{ to: '/', label: 'Now', icon: iconHome },
{ to: '/forecast', label: 'Forecast', icon: iconChart },
{ to: '/plan', label: 'Plan', icon: iconCalendar },
{ to: '/simulate', label: 'Simulate', icon: iconFlash },
{ to: '/about', label: 'About', icon: iconCircleInformation },
]
const hiddenPageLabels: Record<string, string> = { '/control': 'Control' }
const activeLabel = computed(
() => 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>
<template>
<NuxtPage v-if="isStandalone" />
<OnyxAppLayout v-else>
<template #navBar>
<OnyxNavBar app-name="PulseCast" logo-url="/logo.svg" mobile="sm">
<OnyxUnstableNavButton
v-for="item in navigation"
:key="item.to"
:link="item.to"
:label="item.label"
:icon="item.icon"
/>
<template #contextArea>
<NuxtLink class="pc-present" to="/stage">Stage</NuxtLink>
<NuxtLink class="pc-present" to="/live">Live</NuxtLink>
</template>
<template #mobileActivePage>{{ activeLabel }}</template>
</OnyxNavBar>
</template>
<OnyxPageLayout>
<NuxtPage />
<template #footer>
<footer class="app-footer">
<span><strong>PulseCast</strong> — staff the pulse, not the noise.</span>
<span class="pc-small">
Decision support, not an optimizer.
<NuxtLink to="/about">Method &amp; limits</NuxtLink> ·
<NuxtLink to="/cool">Cool City public module</NuxtLink>
<template v-if="usingMock"> · demo data</template>
</span>
</footer>
</template>
</OnyxPageLayout>
</OnyxAppLayout>
</template>