Elffuss BraidHub

kikocis/continue public

61bef27a1dcd · 1022 BRawPermalink
1import { IndexingStatus } from "core";
2import { ToolTip } from "../../../../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 const indicator = (
29 <div
30 data-tooltip-id={hoverMessage ? "status-tooltip" : undefined}
31 data-tooltip-content={hoverMessage}
32 className={`h-${size} w-${size} rounded-full ${STATUS_TO_COLOR[status]} ${
33 status === "indexing" ? "animate-pulse" : ""
34 } ${className}`}
35 />
36 );
37
38 return (
39 <>
40 {indicator}
41 {hoverMessage && <ToolTip id="status-tooltip" />}
42 </>
43 );
44}