11<template >
22 <button
33 class =" flex flex-col items-center justify-center gap-1 px-4 cursor-pointer tg-text-subtitle"
4- @click =" canScrollToTop ? handleScrollToTop() : handleRedirect(route.path)"
4+ @click =" (isCatalogPage && canScrollToTop && isThisRoute) ? handleScrollToTop() : handleRedirect(route.path)"
55 >
66 <div
77 class =" relative py-1 w-full rounded-2xl flex flex-row items-center justify-center"
1010 ]"
1111 >
1212 <UIcon
13- v-if =" canScrollToTop"
13+ v-if =" isCatalogPage && canScrollToTop && isThisRoute "
1414 name =" i-lucide-arrow-up"
1515 class =" size-6 motion-preset-shake"
1616 />
1717 <UIcon
18- v-else-if =" canReturn "
18+ v-else-if =" isClientInnerPage && canReturnToCabinet && isThisRoute "
1919 name =" i-lucide-undo-2"
2020 class =" size-6 motion-preset-shake"
2121 />
@@ -42,17 +42,11 @@ import type { NavigationRoute } from '#shared/types/index'
4242const { route } = defineProps <{ route: NavigationRoute }>()
4343
4444const { vibrate } = useFeedback ()
45+ const { canScrollToTop, isCatalogPage, isClientInnerPage, canReturnToCabinet } = useNavigation ()
4546const router = useRouter ()
4647
4748const isThisRoute = computed (() => route .exact ? router .currentRoute .value .path === route .path : router .currentRoute .value .path .startsWith (route .path ))
4849
49- const { y } = useWindowScroll ()
50- const isCatalogButton = computed (() => route .path === ' /' && router .currentRoute .value .path === ' /' )
51- const canScrollToTop = computed (() => isCatalogButton .value && y .value > 650 )
52-
53- const isClientButton = computed (() => route .path === ' /client' && router .currentRoute .value .path .startsWith (' /client' ))
54- const canReturn = computed (() => isClientButton .value && router .currentRoute .value .path !== ' /client' )
55-
5650function handleScrollToTop() {
5751 vibrate ()
5852 window .scrollTo ({ top: 0 , behavior: ' smooth' })
0 commit comments