| 1 | import { IndexingProgressUpdate } from "core"; |
| 2 | import { AnimatedEllipsis } from "../../../components"; |
| 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 | indexing: "Indexing in-progress", |
| 12 | paused: "Indexing paused", |
| 13 | failed: "Indexing failed", |
| 14 | disabled: "Indexing disabled", |
| 15 | cancelled: "Indexing cancelled", |
| 16 | }; |
| 17 | |
| 18 | function IndexingProgressTitleText({ update }: IndexingProgressTitleTextProps) { |
| 19 | const showEllipsis = update.status === "loading"; |
| 20 | |
| 21 | return ( |
| 22 | <span> |
| 23 | {STATUS_TO_TEXT[update.status]} |
| 24 | {showEllipsis && <AnimatedEllipsis />} |
| 25 | </span> |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | export default IndexingProgressTitleText; |