merge: sync main into sensing engine
This commit is contained in:
commit
9ba70965ba
60 files changed
+15132
-87
No files matched your search
+97
-1
@@ -1,5 +1,101 @@
|
||||
<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 isSensing = computed(() => route.path === '/' || route.path.startsWith('/sensors'))
|
||||
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>
|
||||
<NuxtLayout>
|
||||
<NuxtLayout v-if="isSensing">
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
|
||||
<NuxtPage v-else-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 & limits</NuxtLink> ·
|
||||
<NuxtLink to="/cool">Cool City public module</NuxtLink>
|
||||
<template v-if="usingMock"> · demo data</template>
|
||||
</span>
|
||||
</footer>
|
||||
</template>
|
||||
</OnyxPageLayout>
|
||||
</OnyxAppLayout>
|
||||
</template>
|
||||
Reference in new issue
Block a user