import { ReactElement } from "react"; import useSWR from "swr"; import { useRouter } from "next/router"; import Link from "next/link"; // services import { UserService } from "services/user.service"; // layouts import { ProfileSettingsLayout } from "layouts/settings-layout"; // components import { ActivityIcon, ActivityMessage } from "components/core"; import { RichReadOnlyEditor } from "@plane/rich-text-editor"; // 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"; // type import { NextPageWithLayout } from "types/app"; const userService = new UserService(); const ProfileActivityPage: NextPageWithLayout = () => { const router = useRouter(); const { workspaceSlug } = router.query; const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity()); return ( Activity {userActivity ? ( {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?.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?.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)} > ); } })} ) : ( )} ); }; ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { return {page}; }; export default ProfileActivityPage;
Commented {timeAgo(activityItem.created_at)}