From e4861bcf0b932b1953b524a6f7a9b49b9cb1809f Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 5 Sep 2022 18:13:17 -0700 Subject: [PATCH] refactor: :sparkles: Swiper, no swiping! :fox: Swiper everywhere, attempt to sync to header bar --- package.json | 2 +- packages/client/src/pages/timeline.vue | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 23c5ae5e91..c756c57bff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "calckey", - "version": "12.118.1-calc.2-beta.2-rc.5", + "version": "12.118.1-calc.2-beta.2-rc.6", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 65e2501c14..f651069823 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -25,7 +25,7 @@ {{ i18n.ts.newNoteRecived }} -
+ +
import('./timeline.tutorial.vue')); @@ -148,7 +149,7 @@ async function chooseAntenna(ev: MouseEvent): Promise { } function saveSrc( - newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global' + newSrc: 'home' | 'local' | 'recommended' | 'social' | 'global', ): void { defaultStore.set('tl', { ...defaultStore.state.tl, @@ -271,13 +272,17 @@ if (isGlobalTimelineAvailable) { let swiperRef = null; -const setSwiperRef = (swiper) => { +function setSwiperRef(swiper) { swiperRef = swiper; -}; +} -const slideTo = (index) => { - swiperRef.slideTo(index - 1, 0); -}; +function onSlideChange() { + if (swiperRef) { + const index = swiperRef.activeIndex; + saveSrc(timelines[swiperRef.activeIndex]); + swiperRef.slideTo(index - 1, 0); + } +}