"use client"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; import useSWR from "swr"; // ui import { Loader } from "@plane/ui"; // components import { ActivityMessage, IssueLink } from "@/components/core"; import { ProfileEmptyState } from "@/components/ui"; // constants import { USER_PROFILE_ACTIVITY } from "@/constants/fetch-keys"; // helpers import { calculateTimeAgo } from "@/helpers/date-time.helper"; //hooks // services import { useUser } from "@/hooks/store"; import { UserService } from "@/services/user.service"; // assets import recentActivityEmptyState from "public/empty-state/recent_activity.svg"; const userService = new UserService(); export const ProfileActivity = observer(() => { const { workspaceSlug, userId } = useParams(); // store hooks const { data: currentUser } = useUser(); const { data: userProfileActivity } = useSWR( workspaceSlug && userId ? USER_PROFILE_ACTIVITY(workspaceSlug.toString(), userId.toString(), {}) : null, workspaceSlug && userId ? () => userService.getUserProfileActivity(workspaceSlug.toString(), userId.toString(), { per_page: 10, }) : null ); return (

Recent activity

{userProfileActivity ? ( userProfileActivity.results.length > 0 ? (
{userProfileActivity.results.map((activity) => (
{activity.actor_detail?.avatar && activity.actor_detail?.avatar !== "" ? ( {activity.actor_detail?.display_name} ) : (
{activity.actor_detail?.display_name?.charAt(0)}
)}

{currentUser?.id === activity.actor_detail?.id ? "You" : activity.actor_detail?.display_name}{" "} {activity.field ? ( ) : ( created )}

{calculateTimeAgo(activity.created_at)}

))}
) : ( ) ) : ( )}
); });