-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Copy pathIndexingProgressSubtext.tsx
47 lines (41 loc) · 1.15 KB
/
IndexingProgressSubtext.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { IndexingProgressUpdate } from "core";
export interface IndexingProgressSubtextProps {
update: IndexingProgressUpdate;
onClick: () => void;
}
const STATUS_TO_SUBTITLE_TEXT: Record<
IndexingProgressUpdate["status"],
string | undefined
> = {
done: "Click to re-index",
loading: "",
indexing: "Click to pause",
paused: "Click to resume",
failed: "Click to retry",
disabled: "Click to open assistant configuration",
cancelled: "Click to restart",
};
function IndexingProgressSubtext({
update,
onClick,
}: IndexingProgressSubtextProps) {
const showIndexingDesc = update.status === "indexing";
return (
<div className="flex justify-between">
<span
className={`text-lightgray inline-block cursor-pointer text-xs underline`}
onClick={onClick}
>
{STATUS_TO_SUBTITLE_TEXT[update.status]}
</span>
<div className={`${showIndexingDesc ? "w-2/3" : "flex-1"}`}>
{showIndexingDesc && (
<span className="text-lightgray block truncate text-right text-xs">
{update.desc}
</span>
)}
</div>
</div>
);
}
export default IndexingProgressSubtext;