Files
DeepTutor/web/components/knowledge/KbStatusDot.tsx
Bingxi Zhao (Frank) 7fce54d98a chore: prepare v1.3.0 release
Made-with: Cursor
2026-04-27 21:09:25 +08:00

37 lines
868 B
TypeScript

"use client";
import {
kbHasLiveProgress,
kbNeedsReindex,
resolveKbStatus,
type KnowledgeBase,
} from "@/lib/knowledge-helpers";
interface KbStatusDotProps {
kb: KnowledgeBase;
isReindexingLocally?: boolean;
}
export default function KbStatusDot({
kb,
isReindexingLocally = false,
}: KbStatusDotProps) {
const status = resolveKbStatus(kb);
const needsReindex = kbNeedsReindex(kb);
const isLive = kbHasLiveProgress(kb) || isReindexingLocally;
const isError = status === "error";
const isReady = status === "ready" && !needsReindex;
const color = needsReindex
? "bg-amber-500"
: isError
? "bg-red-500"
: isLive
? "bg-sky-500 animate-pulse"
: isReady
? "bg-emerald-500"
: "bg-[var(--muted-foreground)]";
return <span className={`inline-block h-2 w-2 rounded-full ${color}`} />;
}