Elffuss BraidHub

kikocis/continue public

2cf8097f3ed4 · 891 BRawPermalink
1import { IndexingStatus } from "core";
2import { ToolTip } from "../../../../components/gui/Tooltip";
3
4interface StatusIndicatorProps {
5 status?: IndexingStatus["status"];
6 className?: string;
7 size?: number;
8 hoverMessage?: string;
9}
10
11const STATUS_TO_COLOR: Record<IndexingStatus["status"], string> = {
12 indexing: "bg-yellow-500",
13 paused: "bg-blue-500",
14 complete: "bg-green-500",
15 aborted: "bg-gray-500",
16 pending: "bg-gray-300",
17 failed: "bg-red-500",
18};
19
20export function StatusIndicator({
21 status,
22 className = "",
23 size = 2,
24 hoverMessage,
25}: StatusIndicatorProps) {
26 if (!status) return null;
27
28 return (
29 <ToolTip hidden={!hoverMessage} content={hoverMessage}>
30 <div
31 className={`h-${size} w-${size} rounded-full ${STATUS_TO_COLOR[status]} ${
32 status === "indexing" ? "animate-pulse" : ""
33 } ${className}`}
34 />
35 </ToolTip>
36 );
37}