| 1 | import { IndexingProgressUpdate } from "core"; |
| 2 | import { AnimatedEllipsis } from "../../../../components/AnimatedEllipsis"; |
| 3 | |
| 4 | export interface IndexingProgressTitleTextProps { |
| 5 | update: IndexingProgressUpdate; |
| 6 | } |
| 7 | |
| 8 | const STATUS_TO_TEXT: Record<IndexingProgressUpdate["status"], string> = { |
| 9 | done: "Indexing complete", |
| 10 | loading: "Initializing", |
| 11 | waiting: "Indexing other workspace", |
| 12 | indexing: "Indexing in-progress", |
| 13 | paused: "Indexing paused", |
| 14 | failed: "Indexing failed", |
| 15 | disabled: "Indexing disabled", |
| 16 | cancelled: "Indexing cancelled", |
| 17 | }; |
| 18 | |
| 19 | function IndexingProgressTitleText({ update }: IndexingProgressTitleTextProps) { |
| 20 | const showEllipsis = update.status === "loading"; |
| 21 | |
| 22 | return ( |
| 23 | <span> |
| 24 | {STATUS_TO_TEXT[update.status]} |
| 25 | {showEllipsis && <AnimatedEllipsis />} |
| 26 | </span> |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | export default IndexingProgressTitleText; |