Lean build: gate Displays links by staged route

This commit is contained in:
2026-07-19 12:22:16 -04:00
parent b7f40f5824
commit 4932b8c6a1

View File

@@ -24,10 +24,10 @@
</router-link>
</template>
<div class="nav-section">Displays</div>
<a :href="withBase('/shopfloor')" target="_blank" class="external-link">Shopfloor Dashboard</a>
<a :href="withBase('/tv')" target="_blank" class="external-link">TV Slideshow</a>
<a v-if="isPluginEnabled('printedparts')" :href="withBase('/parts-kiosk')"
<div v-if="showDisplays" class="nav-section">Displays</div>
<a v-if="hasRoute('/shopfloor')" :href="withBase('/shopfloor')" target="_blank" class="external-link">Shopfloor Dashboard</a>
<a v-if="hasRoute('/tv')" :href="withBase('/tv')" target="_blank" class="external-link">TV Slideshow</a>
<a v-if="hasRoute('/parts-kiosk')" :href="withBase('/parts-kiosk')"
target="_blank" class="external-link">Parts Kiosk</a>
<router-link v-if="authStore.isAdmin" to="/settings">Settings</router-link>
@@ -111,11 +111,20 @@ import { currentTheme, toggleTheme } from '../stores/theme'
import { dashboardApi, notificationsApi } from '../api'
import { getFacilityName, getSiteLogo, getServicenowUrls } from '../utils/siteSettings'
import { withBase } from '../utils/basePath'
import { isPluginEnabled } from '../composables/enabledPlugins'
const router = useRouter()
const route = useRoute()
const authStore = useAuthStore()
// The Displays links are hardcoded (not plugin-driven nav), so gate each by
// whether its route was actually staged into THIS build. A lean site without
// slides / printedparts must not show a TV Slideshow / Parts Kiosk link that
// dead-ends on a blank page. Route existence is the true "is it in this build"
// test - more reliable than plugin-enabled state, which a copied registry can
// report for a plugin that was never staged.
const stagedRoutePaths = new Set(router.getRoutes().map(r => r.path))
const hasRoute = (path) => stagedRoutePaths.has(path)
const showDisplays = ['/shopfloor', '/tv', '/parts-kiosk'].some(hasRoute)
const routeViewKey = computed(() =>
route.path.startsWith('/settings') ? '/settings' : route.path
)