import { SectionEmpty, SkeletonLine, Table, Text } from "@cloudhal/ui"; import { ClockCounterClockwise } from "@phosphor-icons/react"; import { useQuery } from "@tanstack/react-query"; import { useT } from "../i18n/index.tsx"; import { api, isNotEnabled } from "../lib/api.ts"; import { apiErrorText } from "../lib/api-errors.ts"; import { DecisionCell, useToolLabel } from "./Audit.tsx"; import { RelativeTime } from "./RelativeTime.tsx"; /** Compact "Recent activity" table for the site overview: the five newest audit events. */ export function RecentActivity({ siteId, limit = 5 }: { siteId: string; limit?: number }) { const t = useT(); const label = useToolLabel(); const recent = useQuery({ queryKey: ["activity", siteId, "recent", limit], queryFn: () => api.activity.list(siteId, { limit }), retry: (count, error) => !isNotEnabled(error) && count < 1, }); if (recent.isPending) { return (