From bf2b518489814dfa2317c025cf2ed606418bd773 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Tue, 25 Oct 2022 19:19:42 -0700 Subject: [PATCH] tab swipe fix --- packages/client/src/pages/admin-file.vue | 9 +++------ packages/client/src/pages/channels.vue | 9 +++------ packages/client/src/pages/gallery/index.vue | 9 +++------ packages/client/src/pages/instance-info.vue | 9 +++------ packages/client/src/pages/notifications.vue | 9 +++------ packages/client/src/pages/user/index.vue | 9 +++------ 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/packages/client/src/pages/admin-file.vue b/packages/client/src/pages/admin-file.vue index ff3b52de7..30a89d3e9 100644 --- a/packages/client/src/pages/admin-file.vue +++ b/packages/client/src/pages/admin-file.vue @@ -102,12 +102,9 @@ import 'swiper/scss/virtual'; let tabs = ['overview']; if (iAmModerator) tabs.push('ip'); tabs.push('raw'); -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + let file: any = $ref(null); let info: any = $ref(null); let isSensitive: boolean = $ref(false); diff --git a/packages/client/src/pages/channels.vue b/packages/client/src/pages/channels.vue index cbc23a90a..c4a403207 100644 --- a/packages/client/src/pages/channels.vue +++ b/packages/client/src/pages/channels.vue @@ -55,12 +55,9 @@ import 'swiper/scss/virtual'; const router = useRouter(); const tabs = ['featured', 'following', 'owned']; -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + const featuredPagination = { endpoint: 'channels/featured' as const, diff --git a/packages/client/src/pages/gallery/index.vue b/packages/client/src/pages/gallery/index.vue index 3a01f3db4..e6f56c8dc 100644 --- a/packages/client/src/pages/gallery/index.vue +++ b/packages/client/src/pages/gallery/index.vue @@ -70,12 +70,9 @@ const props = defineProps<{ }>(); const tabs = ['explore', 'liked', 'my']; -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + let tagsRef = $ref(); const recentPostsPagination = { diff --git a/packages/client/src/pages/instance-info.vue b/packages/client/src/pages/instance-info.vue index 52497172f..3b3410351 100644 --- a/packages/client/src/pages/instance-info.vue +++ b/packages/client/src/pages/instance-info.vue @@ -164,12 +164,9 @@ const props = defineProps<{ let tabs = ['overview']; if (iAmModerator) tabs.push('chart', 'users', 'raw'); -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + let chartSrc = $ref('instance-requests'); let meta = $ref(null); let instance = $ref(null); diff --git a/packages/client/src/pages/notifications.vue b/packages/client/src/pages/notifications.vue index 4319a7a8e..964fffe3b 100644 --- a/packages/client/src/pages/notifications.vue +++ b/packages/client/src/pages/notifications.vue @@ -50,12 +50,9 @@ import 'swiper/scss'; import 'swiper/scss/virtual'; const tabs = ['all', 'unread', 'mentions', 'directNotes']; -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + let includeTypes = $ref(null); let unreadOnly = $computed(() => tab === 'unread'); os.api('notifications/mark-all-as-read'); diff --git a/packages/client/src/pages/user/index.vue b/packages/client/src/pages/user/index.vue index dd932b8c0..bed0d655d 100644 --- a/packages/client/src/pages/user/index.vue +++ b/packages/client/src/pages/user/index.vue @@ -75,12 +75,9 @@ if (($i && ($i.id === user?.id)) || user?.publicReactions) { if ((user?.instance != null)) { tabs.push('clips', 'pages', 'gallery'); } -let tab = $computed({ - get: () => tabs[0], - set: (x) => { - syncSlide(tabs.indexOf(x)); - }, -}); +let tab = $ref(tabs[0]); +watch($$(tab), () => (syncSlide(tabs.indexOf(tab)))); + let error = $ref(null); function fetchUser(): void {