import { ReactElement, useState } from "react"; import { useRouter } from "next/router"; import { observer } from "mobx-react"; // hooks import { useUser } from "hooks/store"; // layouts import { AppLayout } from "layouts/app-layout"; import { ProfileAuthWrapper } from "layouts/user-profile-layout"; // components import { UserProfileHeader } from "components/headers"; import { DownloadActivityButton, WorkspaceActivityListPage } from "components/profile"; // ui import { Button } from "@plane/ui"; // types import { NextPageWithLayout } from "lib/types"; // constants import { EUserWorkspaceRoles } from "constants/workspace"; const PER_PAGE = 100; const ProfileActivityPage: NextPageWithLayout = observer(() => { // states const [pageCount, setPageCount] = useState(1); const [totalPages, setTotalPages] = useState(0); const [resultsCount, setResultsCount] = useState(0); // router const router = useRouter(); const { userId } = router.query; // store hooks const { currentUser, membership: { currentWorkspaceRole }, } = useUser(); 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 canDownloadActivity = currentUser?.id === userId && !!currentWorkspaceRole && currentWorkspaceRole >= EUserWorkspaceRoles.MEMBER; return (

Recent activity

{canDownloadActivity && }
{activityPages} {pageCount < totalPages && resultsCount !== 0 && (
)}
); }); ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { return ( }> {page} ); }; export default ProfileActivityPage;