import { useRouter } from "next/router"; import useSWR from "swr"; // services import userService from "services/user.service"; // components import { ActivityMessage } from "components/core"; // ui import { Icon, Loader } from "components/ui"; // helpers import { timeAgo } from "helpers/date-time.helper"; // fetch-keys import { USER_PROFILE_ACTIVITY } from "constants/fetch-keys"; export const ProfileActivity = () => { const router = useRouter(); const { workspaceSlug, userId } = router.query; const { data: userProfileActivity } = useSWR( workspaceSlug && userId ? USER_PROFILE_ACTIVITY(workspaceSlug.toString(), userId.toString()) : null, workspaceSlug && userId ? () => userService.getUserProfileActivity(workspaceSlug.toString(), userId.toString()) : null ); return (

Recent Activity

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

{activity.actor_detail.first_name} {activity.actor_detail.last_name}{" "} {activity.field ? ( ) : ( created this{" "} Issue )}

{timeAgo(activity.created_at)}

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