From db8af9bda1d57061fa3f240c2be9bb8bc0b5f838 Mon Sep 17 00:00:00 2001 From: zephex-alt <166333351+zephex-alt@users.noreply.github.com> Date: Sun, 5 May 2024 05:12:06 +0000 Subject: UI enhancement --- src/app/anime/[id]/buttons.jsx | 58 ++++++++++++++++++++++++---- src/app/anime/[id]/info.module.css | 25 +++++++++++- src/app/anime/recent/page.jsx | 4 +- src/app/anime/search/search.module.css | 3 +- src/app/anime/top-airing/page.jsx | 4 +- src/app/anime/top-airing/trending.module.css | 2 +- src/app/kdrama/components/popular.jsx | 2 +- src/app/kdrama/components/recent.jsx | 2 +- src/app/kdrama/styles/search.module.css | 5 ++- src/app/page.module.css | 18 +++++++-- 10 files changed, 101 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/app/anime/[id]/buttons.jsx b/src/app/anime/[id]/buttons.jsx index 9c297d2..c1b4615 100644 --- a/src/app/anime/[id]/buttons.jsx +++ b/src/app/anime/[id]/buttons.jsx @@ -1,7 +1,7 @@ "use client"; import styles from "./info.module.css"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import { fetch_video_link } from "../videoLinkfetcher"; import { MediaPlayer, MediaProvider } from "@vidstack/react"; import "@vidstack/react/player/styles/default/theme.css"; @@ -15,6 +15,13 @@ import { storeLocal } from "../history/storeData"; export default function Button({ data2: info }) { const currentDate = new Date(); const [videoLink, setVideoLink] = useState(null); + const [buttonGroups, setButtonGroups] = useState(null); + + useEffect(() => { + create_button_group(0, 50); + }, []); + + const groups = createGroups(info.episodes, 50); async function video(id) { const link = await fetch_video_link(id); @@ -25,6 +32,14 @@ export default function Button({ data2: info }) { } } + function createGroups(array, size) { + const groups = []; + for (let i = 0; i < array.length; i += size) { + groups.push(array.slice(i, i + size)); + } + return groups; + } + function store_to_local(name, image, episode, id) { let newData = { name: name, @@ -42,13 +57,11 @@ export default function Button({ data2: info }) { storeLocal(newData); } - return ( -
-

Episodes:

+ function create_button_group(start, end) { + setButtonGroups(
- {info && - info.episodes && - info.episodes.map((item, index) => ( + {info.episodes && + info.episodes.slice(start, end).map((item, index) => (
+ ); + } + function handleSelectChange(event) { + const selectedIndex = event.target.selectedIndex; + const selectedGroup = groups[selectedIndex]; + if (selectedGroup) { + create_button_group( + selectedGroup[0].number - 1, + selectedGroup[selectedGroup.length - 1].number + ); + } + } + + return ( +
+

Episodes:

+ {info.episodes && ( + + )} + {buttonGroups} {videoLink && (
diff --git a/src/app/anime/search/search.module.css b/src/app/anime/search/search.module.css index 55e29d8..185f6d5 100644 --- a/src/app/anime/search/search.module.css +++ b/src/app/anime/search/search.module.css @@ -56,9 +56,10 @@ display: flex; overflow-x: auto; margin-bottom: 1rem; + margin-left: 0.5rem; } -.animeEntry .anime { +.animeEntry:hover .anime { opacity: 0.5; } diff --git a/src/app/anime/top-airing/page.jsx b/src/app/anime/top-airing/page.jsx index ff329f6..a0fc302 100644 --- a/src/app/anime/top-airing/page.jsx +++ b/src/app/anime/top-airing/page.jsx @@ -28,8 +28,8 @@ export default async function Trending() { Drama diff --git a/src/app/anime/top-airing/trending.module.css b/src/app/anime/top-airing/trending.module.css index 31f6b16..2abaf4b 100644 --- a/src/app/anime/top-airing/trending.module.css +++ b/src/app/anime/top-airing/trending.module.css @@ -42,7 +42,7 @@ .trendingEntries p { text-align: center; width: auto; - max-width: 180px; + max-width: 190px; margin: 0.5rem 0 0 0; overflow: hidden; white-space: nowrap; diff --git a/src/app/kdrama/components/popular.jsx b/src/app/kdrama/components/popular.jsx index d09e0ff..8b88fd7 100644 --- a/src/app/kdrama/components/popular.jsx +++ b/src/app/kdrama/components/popular.jsx @@ -13,7 +13,7 @@ export default async function PopularDramas() {
{popular && - popular.results.slice(0, 16).map((item, index) => ( + popular.results.slice(0, 24).map((item, index) => ( {popular && - popular.results.slice(0, 16).map((item, index) => ( + popular.results.slice(0, 24).map((item, index) => ( .contentContainer div:hover { opacity: 1; cursor: pointer; - transform: scale(0.96) rotateX(15deg) rotateY(-8deg); + transform: scale(0.95) rotateX(12deg) rotateY(-8deg); } @media screen and (max-width: 1024px) { .contentContainer { display: block; } + + .content:hover > .contentContainer div { + opacity: 0.5; + } + + .content:hover > .contentContainer div:hover { + opacity: 1; + cursor: pointer; + transform: scale(0.95); + } } -- cgit v1.2.3