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
|
/**
* WorkingIndicator shows that the agent is busy: a spinner next to a whimsical
* phrase that rotates every few seconds, in the spirit of Claude's own
* "Pondering…" status line.
*
* @example
* {turnActive && <WorkingIndicator />}
*/
import { useEffect, useState } from "react";
/** The rotating status phrases; exported so tests can assert against them. */
export const workingPhrases = [
"Pondering…",
"Connecting the dots…",
"Brewing ideas…",
"Reading between the lines…",
"Sketching a plan…",
"Turning gears…",
"Chasing a thought…",
"Polishing the answer…",
];
/** How long each phrase stays on screen, in milliseconds. */
export const phraseIntervalMs = 2500;
export function WorkingIndicator() {
const [index, setIndex] = useState(0);
useEffect(() => {
const timer = setInterval(
() => setIndex((current) => (current + 1) % workingPhrases.length),
phraseIntervalMs,
);
return () => clearInterval(timer);
}, []);
return (
<output className="working">
<span className="spinner" aria-hidden />
<span className="working-phrase">{workingPhrases[index]}</span>
</output>
);
}
|