nandi/oripublic Fork 0
3d1f70c3b1e0d8c9a0b27adcc1bd1a9f053c050e
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

WorkingIndicator.tsx · 44 lines · 1.1 KBTypeScript Blame HistoryRaw
 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>
	);
}