import { useEffect } from "react"; import Link from "next/link"; import { observer } from "mobx-react-lite"; import { History } from "lucide-react"; // hooks import { useDashboard, useUser } from "hooks/store"; // components import { ActivityIcon, ActivityMessage, IssueLink } from "components/core"; import { RecentActivityEmptyState, WidgetLoader, WidgetProps } from "components/dashboard/widgets"; // ui import { Avatar } from "@plane/ui"; // helpers import { calculateTimeAgo } from "helpers/date-time.helper"; // types import { TRecentActivityWidgetResponse } from "@plane/types"; const WIDGET_KEY = "recent_activity"; export const RecentActivityWidget: React.FC = observer((props) => { const { dashboardId, workspaceSlug } = props; // store hooks const { currentUser } = useUser(); // derived values const { fetchWidgetStats, getWidgetStats } = useDashboard(); const widgetStats = getWidgetStats(workspaceSlug, dashboardId, WIDGET_KEY); useEffect(() => { fetchWidgetStats(workspaceSlug, dashboardId, { widget_key: WIDGET_KEY, }); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); if (!widgetStats) return ; return (
Your issue activities {widgetStats.length > 0 ? (
{widgetStats.map((activity) => (
{activity.field ? ( activity.new_value === "restore" ? ( ) : (
) ) : activity.actor_detail.avatar && activity.actor_detail.avatar !== "" ? ( ) : (
{activity.actor_detail.is_bot ? activity.actor_detail.first_name.charAt(0) : 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)}

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