import { useEffect } from "react"; import { RichReadOnlyEditor } from "@plane/rich-text-editor"; import { observer } from "mobx-react"; import Link from "next/link"; import useSWR from "swr"; import { History, MessageSquare } from "lucide-react"; // hooks import { ActivityIcon, ActivityMessage, IssueLink } from "components/core"; import { ActivitySettingsLoader } from "components/ui"; import { USER_ACTIVITY } from "constants/fetch-keys"; import { calculateTimeAgo } from "helpers/date-time.helper"; import { useUser } from "hooks/store"; // services import { UserService } from "services/user.service"; // editor // components // ui // helpers // 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 ? ( ) : ( )} ); });