import { useEffect } from "react"; import { observer } from "mobx-react"; import Link from "next/link"; import { History } from "lucide-react"; // types import { TRecentActivityWidgetResponse } from "@plane/types"; // UI import { Avatar, getButtonStyling } from "@plane/ui"; // components import { ActivityIcon, ActivityMessage, IssueLink } from "@/components/core"; import { RecentActivityEmptyState, WidgetLoader, WidgetProps } from "@/components/dashboard/widgets"; // helpers import { cn } from "@/helpers/common.helper"; import { calculateTimeAgo } from "@/helpers/date-time.helper"; // hooks import { useDashboard, useUser } from "@/hooks/store"; const WIDGET_KEY = "recent_activity"; export const RecentActivityWidget: React.FC = observer((props) => { const { dashboardId, workspaceSlug } = props; // store hooks const { data: currentUser } = useUser(); // derived values const { fetchWidgetStats, getWidgetStats } = useDashboard(); const widgetStats = getWidgetStats(workspaceSlug, dashboardId, WIDGET_KEY); const redirectionLink = `/${workspaceSlug}/profile/${currentUser?.id}/activity`; 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)}

))} View all
) : (
)}
); });