11<template >
2- <div class =" app" >
3- <!-- Main site header/footer only (hide for /registry sub-site) -->
2+ <div class =" app" :class =" { 'app--registry': isRegistry }" >
43 <SiteHeader v-if =" !isRegistry" />
54
6- <main class =" main" :class = " { 'main--registry': isRegistry } " >
5+ <main class =" main" >
76 <router-view />
87 </main >
98
109 <SiteFooter v-if =" !isRegistry" />
1110
12- <!-- PWA install prompt toast -->
1311 <PwaInstallToast
1412 :show =" showInstallToast"
1513 :canInstall =" canInstall"
1917 @dismiss =" dismissInstall"
2018 />
2119
22- <!-- PWA update toast -->
2320 <PwaUpdateToast
2421 :show =" showPwaToast"
2522 :version =" appVersion"
3027</template >
3128
3229<script setup>
33- import { inject , computed , onMounted , onBeforeUnmount , ref } from " vue" ;
30+ import { inject , computed , onMounted , onBeforeUnmount , ref , watch } from " vue" ;
3431import { useRoute } from " vue-router" ;
3532
3633import SiteHeader from " ./components/SiteHeader.vue" ;
3734import SiteFooter from " ./components/SiteFooter.vue" ;
38-
3935import PwaUpdateToast from " ./components/PwaUpdateToast.vue" ;
4036import PwaInstallToast from " ./components/PwaInstallToast.vue" ;
4137
4238const route = useRoute ();
4339
44- // Hide global header/footer for the registry sub-site
45- const isRegistry = computed (() => route .path === " /registry" || route .path .startsWith (" /registry/" ));
40+ const isRegistry = computed (
41+ () => route .path === " /registry" || route .path .startsWith (" /registry/" )
42+ );
43+
44+ // Ajoute/retire une classe globale pour override le CSS global
45+ watch (
46+ isRegistry,
47+ (v ) => {
48+ document .documentElement .classList .toggle (" is-registry" , v);
49+ },
50+ { immediate: true }
51+ );
4652
4753// ---------------------------
4854// PWA Update Toast (existing)
@@ -55,7 +61,6 @@ const appVersion = import.meta.env.VITE_APP_VERSION;
5561function refresh () {
5662 window .__vix_pwa_refresh__ ? .();
5763}
58-
5964function dismiss () {
6065 window .__vix_pwa_dismiss__ ? .();
6166}
@@ -73,17 +78,14 @@ const INSTALL_DISMISS_KEY = "vix_pwa_install_dismiss_until";
7378function nowMs () {
7479 return Date .now ();
7580}
76-
7781function shouldShowInstallToast () {
7882 const until = Number (localStorage .getItem (INSTALL_DISMISS_KEY ) || " 0" );
7983 return nowMs () > until;
8084}
81-
8285function setDismissCooldown (days = 7 ) {
8386 const until = nowMs () + days * 24 * 60 * 60 * 1000 ;
8487 localStorage .setItem (INSTALL_DISMISS_KEY , String (until));
8588}
86-
8789function dismissInstall () {
8890 setDismissCooldown (7 );
8991 showInstallToast .value = false ;
@@ -111,7 +113,6 @@ async function triggerInstall() {
111113
112114function onBeforeInstallPrompt (e ) {
113115 e .preventDefault ();
114-
115116 deferredPrompt = e;
116117 canInstall .value = true ;
117118
@@ -137,6 +138,9 @@ onMounted(() => {
137138onBeforeUnmount (() => {
138139 window .removeEventListener (" beforeinstallprompt" , onBeforeInstallPrompt);
139140 window .removeEventListener (" appinstalled" , onAppInstalled);
141+
142+ // nettoyage au cas où on quitte l'app
143+ document .documentElement .classList .remove (" is-registry" );
140144});
141145< / script>
142146
@@ -150,8 +154,7 @@ onBeforeUnmount(() => {
150154 min- height: calc (100vh - var (-- header- h));
151155}
152156
153- /* Registry sub-site manages its own header spacing */
154- .main -- registry {
157+ .app -- registry .main {
155158 padding- top: 0 ;
156159 min- height: 100vh ;
157160}
0 commit comments