import useSWR from "swr"; import { useRouter } from "next/router"; import Link from "next/link"; // services import { UserService } from "services/user.service"; // layouts import { WorkspaceSettingLayout } from "layouts/setting-layout/workspace-setting-layout"; // components import { ActivityIcon, ActivityMessage } from "components/core"; import { RichReadOnlyEditor } from "@plane/rich-text-editor"; import { WorkspaceSettingHeader } from "components/headers"; // icons import { History, MessageSquare } from "lucide-react"; // ui import { ExternalLinkIcon, Loader } from "@plane/ui"; // fetch-keys import { USER_ACTIVITY } from "constants/fetch-keys"; // helper import { timeAgo } from "helpers/date-time.helper"; const userService = new UserService(); const ProfileActivity = () => { const router = useRouter(); const { workspaceSlug } = router.query; const { data: userActivity } = useSWR( workspaceSlug ? USER_ACTIVITY : null, workspaceSlug ? () => userService.getUserWorkspaceActivity(workspaceSlug.toString()) : null ); return ( }> {userActivity ? (

Activity

    {userActivity.results.map((activityItem: any) => { if (activityItem.field === "comment") { return (
    {activityItem.field ? ( activityItem.new_value === "restore" && ( ) ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.display_name} ) : (
    {activityItem.actor_detail.display_name?.charAt(0)}
    )}
    {activityItem.actor_detail.is_bot ? activityItem.actor_detail.first_name + " Bot" : activityItem.actor_detail.display_name}

    Commented {timeAgo(activityItem.created_at)}

    ); } const message = activityItem.verb === "created" && activityItem.field !== "cycles" && activityItem.field !== "modules" && activityItem.field !== "attachment" && activityItem.field !== "link" && activityItem.field !== "estimate" ? ( created{" "} this issue. ) : activityItem.field ? ( ) : ( "created the issue." ); if ("field" in activityItem && activityItem.field !== "updated_by") { return (
  • <>
    {activityItem.field ? ( activityItem.new_value === "restore" ? ( ) : ( ) ) : activityItem.actor_detail.avatar && activityItem.actor_detail.avatar !== "" ? ( {activityItem.actor_detail.display_name} ) : (
    {activityItem.actor_detail.display_name?.charAt(0)}
    )}
    {activityItem.field === "archived_at" && activityItem.new_value !== "restore" ? ( Plane ) : activityItem.actor_detail.is_bot ? ( {activityItem.actor_detail.first_name} Bot ) : ( {activityItem.actor_detail.display_name} )}{" "} {message} {timeAgo(activityItem.created_at)}
  • ); } })}
) : ( )}
); }; export default ProfileActivity;