diff --git a/app/components/HeroSlider.vue b/app/components/HeroSlider.vue new file mode 100644 index 0000000..5bd14fd --- /dev/null +++ b/app/components/HeroSlider.vue @@ -0,0 +1,55 @@ + + + diff --git a/app/lib/icons.ts b/app/lib/icons.ts index a25ec52..08af149 100644 --- a/app/lib/icons.ts +++ b/app/lib/icons.ts @@ -23,6 +23,7 @@ import { faCirclePlay, faCircleQuestion, faClock, + faClockRotateLeft, faClosedCaptioning, faComment, faCommentDots, @@ -114,6 +115,7 @@ library.add( faCirclePlay, faCircleQuestion, faClock, + faClockRotateLeft, faClosedCaptioning, faComment, faCommentDots, diff --git a/app/pages/index.vue b/app/pages/index.vue index 9f102f3..e1c83bd 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -37,8 +37,8 @@ const { clearWatchHistory: removeWatchHistory, } = useWatchHistory() -let heroTimer: ReturnType | undefined const heroDetailCache = new Map() +const heroSliderRef = ref<{ goTo: (index: number) => void } | null>(null) const heroDescription = computed(() => { const content = String(heroDetail.value?.content || '').trim() @@ -164,18 +164,8 @@ function getEpisodeDisplay(movie: any) { return ep } -function selectHero(index: number) { - heroIndex.value = index -} - -function nextHero() { - if (!heroSlides.value.length) return - heroIndex.value = (heroIndex.value + 1) % heroSlides.value.length -} - -function previousHero() { - if (!heroSlides.value.length) return - heroIndex.value = (heroIndex.value - 1 + heroSlides.value.length) % heroSlides.value.length +function goToSlide(index: number) { + heroSliderRef.value?.goTo(index) } function watchHistoryLink(item: WatchHistoryItem) { @@ -267,13 +257,11 @@ watch(hero, async (currentHero) => { }, { immediate: true }) onMounted(() => { - heroTimer = setInterval(nextHero, 6500) loadWatchHistory() window.addEventListener('storage', loadWatchHistory) }) onBeforeUnmount(() => { - if (heroTimer) clearInterval(heroTimer) if (import.meta.client) window.removeEventListener('storage', loadWatchHistory) }) @@ -300,12 +288,16 @@ useHead({
-
- - - +
+
+ + +
+
+ +
- +
diff --git a/package-lock.json b/package-lock.json index d53bc74..5af2e9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "jsonwebtoken": "^9.0.3", "mysql2": "^3.23.1", "nuxt": "^4.4.5", + "swiper": "^14.0.6", "tailwindcss": "^4.3.0", "vue": "^3.5.34", "vue-router": "^5.0.6" @@ -10422,6 +10423,25 @@ "node": ">=16" } }, + "node_modules/swiper": { + "version": "14.0.6", + "resolved": "https://registry.npmjs.org/swiper/-/swiper-14.0.6.tgz", + "integrity": "sha512-ArptjmcZMBvpLCbvzSKuqvQpjjITCbZdymiGOrbZQffQ3ZSjgpvMByXX0WZBUt+FV4PPIumdYfZ9ZdBbFsdH6g==", + "funding": [ + { + "type": "custom", + "url": "https://sponsors.nolimits4web.com" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nolimits4web" + } + ], + "license": "MIT", + "engines": { + "node": ">= 4.7.0" + } + }, "node_modules/tagged-tag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/tagged-tag/-/tagged-tag-1.0.0.tgz", diff --git a/package.json b/package.json index e7201c5..393b482 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "jsonwebtoken": "^9.0.3", "mysql2": "^3.23.1", "nuxt": "^4.4.5", + "swiper": "^14.0.6", "tailwindcss": "^4.3.0", "vue": "^3.5.34", "vue-router": "^5.0.6"