"use client"; import { ReleaseSection } from "#/components/ReleaseSection/ReleaseSection"; import { Spinner } from "#/components/Spinner/Spinner"; import { useState, useEffect } from "react"; import { useScrollPosition } from "#/hooks/useScrollPosition"; import { useUserStore } from "../store/auth"; import { _FetchHomePageReleases } from "#/api/utils"; import { Button, ButtonGroup } 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() { setIsLoading(true); setContent(null); const data: any = await _FetchHomePageReleases(props.slug, token, page); setContent(data.content); setIsLoading(false); } _loadInitialReleases(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [token]); useEffect(() => { async function _loadNextReleasesPage() { const data: any = await _FetchHomePageReleases(props.slug, token, page); const newContent = [...content, ...data.content]; setContent(newContent); } if (content) { _loadNextReleasesPage(); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [page]); const scrollPosition = useScrollPosition(); useEffect(() => { if (scrollPosition == 98) { setPage(page + 1); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [scrollPosition]); return ( <>
В списке {props.SectionTitleMapping[props.slug]} пока ничего нет...