File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed
apps/storefront-telegram/app Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 11<template >
22 <div class =" relative w-full h-auto aspect-3/2 perspective-normal motion-preset-slide-down" >
33 <div
4- class =" absolute inset-0 bg-primary rounded-lg"
4+ class =" absolute inset-0 bg-primary rounded-lg transition duration-200 "
55 :style =" {
66 transform: `rotateX(${x * 5}deg) rotateY(${y * 5}deg)`,
77 }"
88 />
99
1010 <div
11- class =" z-10 w-full h-full p-4 flex flex-col justify-between tg-text-button"
11+ class =" z-10 w-full h-full p-4 flex flex-col justify-between transition duration-200 tg-text-button"
1212 :style =" {
1313 transform: `rotateX(${x * 3}deg) rotateY(${y * 3}deg)`,
1414 }"
Original file line number Diff line number Diff line change 11<template >
22 <div
3- v-element-visibility =" [
4- (isVisible) => (isVisible && category?.slug) ? visibleCategory = category.slug : null,
5- observerOptions,
6- ]"
3+ ref =" target"
74 class =" flex flex-col gap-3 mb-10"
85 >
9- <h2 :id =" category?.slug" class =" scroll-mt-28 text-2xl/5 font-semibold tracking-tight" >
6+ <h2 :id =" category?.slug" class =" scroll-mt-32 text-2xl/5 font-semibold tracking-tight" >
107 {{ category?.name }}
118 </h2 >
129
2219</template >
2320
2421<script setup lang="ts">
25- import { vElementVisibility } from ' @vueuse/components'
26-
2722const { categoryId } = defineProps <{
2823 categoryId: string
2924}>()
3025
3126const { visibleCategory, observerOptions } = useCatalog ()
3227
28+ const target = useTemplateRef <HTMLDivElement >(' target' )
29+ const targetIsVisible = useElementVisibility (target , observerOptions )
30+
31+ watch (targetIsVisible , (isVisible ) => {
32+ if (isVisible && category ?.slug ) {
33+ visibleCategory .value = category .slug
34+ }
35+ })
36+
3337const menuStore = useMenuStore ()
3438const category = menuStore .menu ?.categories .find ((c ) => c .id === categoryId )
3539const products = category ?.products .filter ((p ) => p .isAvailableForPurchase && p .variants .length )
Original file line number Diff line number Diff line change 11function _useCatalog ( ) {
22 const visibleCategory = ref < string | null > ( null )
33
4- const observerOptions = { rootMargin : '0px 0px 0px 0px' }
4+ const observerOptions = { rootMargin : '0px 0px -150px 0px' }
55
66 const scrollToCategory = useDebounceFn ( ( ) => {
77 const category = window . document . getElementById ( `to-${ visibleCategory . value } ` )
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export async function init(options: {
9292
9393 // Gyroscope
9494 postEvent ( 'web_app_start_gyroscope' , {
95- refresh_rate : 500 ,
95+ refresh_rate : 80 ,
9696 } )
9797
9898 if ( mountViewport . isAvailable ( ) ) {
You can’t perform that action at this time.
0 commit comments