import { useEffect } from "react"; import Link from "next/link"; import { observer } from "mobx-react"; import useSWR from "swr"; import { History, MessageSquare } from "lucide-react"; // hooks import { useUser } from "hooks/store"; // services import { UserService } from "services/user.service"; // editor import { RichReadOnlyEditor } from "@plane/rich-text-editor"; // components import { ActivityIcon, ActivityMessage, IssueLink } from "components/core"; // ui import { ActivitySettingsLoader } from "components/ui"; // helpers import { calculateTimeAgo } from "helpers/date-time.helper"; // fetch-keys import { USER_ACTIVITY } from "constants/fetch-keys"; // services const userService = new UserService(); type Props = { cursor: string; perPage: number; updateResultsCount: (count: number) => void; updateTotalPages: (count: number) => void; }; export const ProfileActivityListPage: React.FC = observer((props) => { const { cursor, perPage, updateResultsCount, updateTotalPages } = props; // store hooks const { currentUser } = useUser(); const { data: userProfileActivity } = useSWR( USER_ACTIVITY({ cursor, }), () => userService.getUserActivity({ cursor, per_page: perPage, }) ); useEffect(() => { if (!userProfileActivity) return; updateTotalPages(userProfileActivity.total_pages); updateResultsCount(userProfileActivity.results.length); }, [updateResultsCount, updateTotalPages, userProfileActivity]); // TODO: refactor this component return ( <> {userProfileActivity ? ( ) : ( )} ); });