import { forwardRef } from "react"; import { useTranslation } from "react-i18next"; import { HoverHint } from "@/components/ui/hover-hint"; import { cn } from "@/lib/utils"; interface ThreadHistoryStatusProps { loading: boolean; error: string | null; exhausted?: boolean; preview?: boolean; onRetry: () => void; className?: string; } export const ThreadHistoryStatus = forwardRef(function ThreadHistoryStatus({ loading, error, exhausted = false, preview = false, onRetry, className }, ref) { const { t } = useTranslation(); const state = loading ? "loading" : error ? "error" : exhausted ? "exhausted" : "ready"; const hidden = state === "ready" && !preview; const label = state === "ready" ? undefined : t(state === "error" ? "thread.history.retryLabel" : `thread.history.${state}`); // Blocks adapted from loading.dev (MIT); see THIRD_PARTY_NOTICES.md. const blocks =