import { ReactElement, useState } from "react"; import { observer } from "mobx-react"; // ui import { Button } from "@plane/ui"; // components import { PageHead } from "@/components/core"; import { SidebarHamburgerToggle } from "@/components/core/sidebar"; import { ProfileActivityListPage } from "@/components/profile"; //hooks import { useAppTheme } from "@/hooks/store"; // layouts import { ProfileSettingsLayout } from "@/layouts/settings-layout"; // type import { NextPageWithLayout } from "@/lib/types"; const PER_PAGE = 100; const ProfileActivityPage: NextPageWithLayout = observer(() => { // states const [pageCount, setPageCount] = useState(1); const [totalPages, setTotalPages] = useState(0); const [resultsCount, setResultsCount] = useState(0); // store hooks const { toggleSidebar } = useAppTheme(); const updateTotalPages = (count: number) => setTotalPages(count); const updateResultsCount = (count: number) => setResultsCount(count); const handleLoadMore = () => setPageCount((prev) => prev + 1); const activityPages: JSX.Element[] = []; for (let i = 0; i < pageCount; i++) activityPages.push( ); const isLoadMoreVisible = pageCount < totalPages && resultsCount !== 0; return ( <> toggleSidebar()} /> Activity {activityPages} {isLoadMoreVisible && ( Load more )} > ); }); ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { return {page}; }; export default ProfileActivityPage;