Elffuss BraidHub

kikocis/continue public

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