nest header within global

This commit is contained in:
lightling 2024-03-27 18:03:54 -04:00
parent 3125f0249c
commit 0a39829748
3 changed files with 3 additions and 11 deletions

View file

@ -107,6 +107,7 @@ declare module 'content/routes.js' {
* Defines global values for the site. * Defines global values for the site.
*/ */
type SiteGlobals = { type SiteGlobals = {
header: HeaderEntry[],
id: string id: string
warning: WarningModal warning: WarningModal
} }
@ -115,10 +116,4 @@ declare module 'content/routes.js' {
* Global values the site uses. * Global values the site uses.
*/ */
const siteGlobals: SiteGlobals const siteGlobals: SiteGlobals
/**
* The header the app uses.
* If not present, the header will not show.
*/
const header: HeaderEntry[]
} }

View file

@ -13,7 +13,6 @@ import WarningPrompt from 'src/components/shared/warning-prompt.vue'
const router = useRouter() const router = useRouter()
const routeStore = useRouteStore() const routeStore = useRouteStore()
const headerConfig = routeStore._header
const globalConfig = routeStore._globals const globalConfig = routeStore._globals
let currentRoute = getCurrentRoute() let currentRoute = getCurrentRoute()
@ -87,11 +86,11 @@ onMounted(async () => {
<template lang="pug"> <template lang="pug">
#main-container #main-container
header( header(
v-if='ready && !!headerConfig' v-if='ready && !!globalConfig.header'
) )
ul ul
HeaderLink( HeaderLink(
v-for='entry in headerConfig' v-for='entry in globalConfig.header'
:entry='entry' :entry='entry'
) )
main( main(

View file

@ -1,7 +1,6 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { type RouteRecordRaw } from 'vue-router' import { type RouteRecordRaw } from 'vue-router'
import { import {
header,
routes, routes,
siteGlobals, siteGlobals,
type GalleryListDefinition, type GalleryListDefinition,
@ -90,7 +89,6 @@ export const initializeRouteStore = (routerRoutes: readonly RouteRecordRaw[]) =>
} as any } as any
} }
}) })
routeStore._header = header
routeStore._globals = siteGlobals routeStore._globals = siteGlobals
} }