feat: add faster navigation between Index Category and fix films had no category name

This commit is contained in:
Kentai Radiquum 2024-11-20 20:22:18 +05:00
parent d8903ae300
commit d3f966e62c
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
2 changed files with 12 additions and 0 deletions

View file

@ -5,6 +5,7 @@ const SectionTitleMapping = {
finished: "Завершенные релизы",
ongoing: "В эфире",
announce: "Анонсированные релизы",
films: "Фильмы",
};
export async function generateMetadata({ params }) {

View file

@ -6,12 +6,14 @@ import { useScrollPosition } from "#/hooks/useScrollPosition";
import { useUserStore } from "../store/auth";
import { _FetchHomePageReleases } from "#/api/utils";
import { Button } from "flowbite-react";
import { useRouter } from "next/navigation";
export function IndexCategoryPage(props) {
const token = useUserStore((state) => state.token);
const [isLoading, setIsLoading] = useState(true);
const [content, setContent] = useState(null);
const [page, setPage] = useState(0);
const router = useRouter();
useEffect(() => {
async function _loadInitialReleases() {
@ -50,6 +52,15 @@ export function IndexCategoryPage(props) {
return (
<>
<div className="mb-4 overflow-auto">
<Button.Group>
<Button className="whitespace-nowrap" disabled={props.slug == "last"} color="light" onClick={() => router.push("/home/last")}>{props.SectionTitleMapping["last"]}</Button>
<Button className="whitespace-nowrap" disabled={props.slug == "finished"} color="light" onClick={() => router.push("/home/finished")}>{props.SectionTitleMapping["finished"]}</Button>
<Button className="whitespace-nowrap" disabled={props.slug == "ongoing"} color="light" onClick={() => router.push("/home/ongoing")}>{props.SectionTitleMapping["ongoing"]}</Button>
<Button className="whitespace-nowrap" disabled={props.slug == "announce"} color="light" onClick={() => router.push("/home/announce")}>{props.SectionTitleMapping["announce"]}</Button>
<Button className="whitespace-nowrap" disabled={props.slug == "films"} color="light" onClick={() => router.push("/home/films")}>{props.SectionTitleMapping["films"]}</Button>
</Button.Group>
</div>
{content && content.length > 0 ? (
<ReleaseSection
sectionTitle={props.SectionTitleMapping[props.slug]}