"use client"; import { useState } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // ui import { Button } from "@plane/ui"; // components import { DownloadActivityButton, WorkspaceActivityListPage } from "@/components/profile"; // constants import { EUserWorkspaceRoles } from "@/constants/workspace"; // hooks import { useUser } from "@/hooks/store"; const PER_PAGE = 100; const ProfileActivityPage = observer(() => { // states const [pageCount, setPageCount] = useState(1); const [totalPages, setTotalPages] = useState(0); const [resultsCount, setResultsCount] = useState(0); // router const { userId } = useParams(); // store hooks const { data: currentUser } = useUser(); const { 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 && (
)}
); }); export default ProfileActivityPage;