From e30124e3f575f00d2d1cf7230be73272289046bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Tue, 9 Dec 2025 23:40:04 +0100 Subject: [PATCH] chore: improve threshold management --- app/components/AppHeader.vue | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue index ae41d89..cbb83d4 100644 --- a/app/components/AppHeader.vue +++ b/app/components/AppHeader.vue @@ -2,24 +2,13 @@ const isLargeScreen = useMediaQuery('(min-width: 1024px)') const appConfig = useAppConfig() +const { height } = useWindowSize() -const scrollThreshold = ref(0) - -onMounted(() => { - const updateThreshold = () => { - const viewportHeight = window.innerHeight || document.documentElement.clientHeight; - - scrollThreshold.value = Math.round(viewportHeight * 0.68); - } - - updateThreshold() +const scrollThreshold = computed(() => { + return Math.round(height.value * 0.68); }) -const effectiveScrollThreshold = computed(() => { - return import.meta.client ? scrollThreshold.value : 0; -}); - -const { isScrolled } = useScroll(effectiveScrollThreshold.value) +const { isScrolled } = useScroll(scrollThreshold.value)