import { useEffect } from "react"; import { observer } from "mobx-react-lite"; import Link from "next/link"; import { History } from "lucide-react"; // hooks // components import { Avatar, getButtonStyling } from "@plane/ui"; import { ActivityIcon, ActivityMessage, IssueLink } from "components/core"; import { RecentActivityEmptyState, WidgetLoader, WidgetProps } from "components/dashboard/widgets"; // ui // helpers import { cn } from "helpers/common.helper"; import { calculateTimeAgo } from "helpers/date-time.helper"; import { useDashboard, useUser } from "hooks/store"; // 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); 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
) : (
)}
); });