import { ReactElement } from "react"; import useSWR from "swr"; import Link from "next/link"; import { observer } from "mobx-react"; //hooks import { useUser } from "hooks/store"; // services import { UserService } from "services/user.service"; // layouts import { ProfileSettingsLayout } from "layouts/settings-layout"; // components import { ActivityIcon, ActivityMessage, IssueLink } from "components/core"; import { RichReadOnlyEditor } from "@plane/rich-text-editor"; // icons import { History, MessageSquare } from "lucide-react"; // ui import { Loader } from "@plane/ui"; // fetch-keys import { USER_ACTIVITY } from "constants/fetch-keys"; // helper import { calculateTimeAgo } from "helpers/date-time.helper"; // type import { NextPageWithLayout } from "lib/types"; import { SidebarHamburgerToggle } from "components/core/sidebar/sidebar-menu-hamburger-toggle"; const userService = new UserService(); const ProfileActivityPage: NextPageWithLayout = observer(() => { const { data: userActivity } = useSWR(USER_ACTIVITY, () => userService.getUserActivity()); // store hooks const { currentUser } = useUser(); 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 {calculateTimeAgo(activityItem.created_at)} ); } const message = activityItem.verb === "created" && activityItem.field !== "cycles" && activityItem.field !== "modules" && activityItem.field !== "attachment" && activityItem.field !== "link" && activityItem.field !== "estimate" && !activityItem.field ? ( created ) : ( ); 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 ) : ( {currentUser?.id === activityItem.actor_detail.id ? "You" : activityItem.actor_detail.display_name} )}{" "} {message}{" "} {calculateTimeAgo(activityItem.created_at)} > ); } })} ) : ( )} ); }); ProfileActivityPage.getLayout = function getLayout(page: ReactElement) { return {page}; }; export default ProfileActivityPage;
Commented {calculateTimeAgo(activityItem.created_at)}