mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
41 lines
905 B
TypeScript
41 lines
905 B
TypeScript
import { Spinner } from "@inkjs/ui"
|
|
import { memo, useMemo } from "react"
|
|
|
|
const THINKING_PHRASES = [
|
|
"Thinking",
|
|
"Pondering",
|
|
"Contemplating",
|
|
"Reticulating",
|
|
"Marinating",
|
|
"Actualizing",
|
|
"Crunching",
|
|
"Untangling",
|
|
"Summoning",
|
|
"Conjuring",
|
|
"Materializing",
|
|
"Synthesizing",
|
|
"Assembling",
|
|
"Percolating",
|
|
"Brewing",
|
|
"Manifesting",
|
|
"Cogitating",
|
|
]
|
|
|
|
interface LoadingTextProps {
|
|
children?: React.ReactNode
|
|
}
|
|
|
|
function LoadingText({ children }: LoadingTextProps) {
|
|
const randomPhrase = useMemo(() => {
|
|
const randomIndex = Math.floor(Math.random() * THINKING_PHRASES.length)
|
|
return THINKING_PHRASES[randomIndex]
|
|
}, [])
|
|
|
|
const childrenStr = children ? String(children) : ""
|
|
const useRandomPhrase = !children || childrenStr === "Thinking"
|
|
const label = useRandomPhrase ? `${randomPhrase}...` : `${childrenStr}...`
|
|
|
|
return <Spinner label={label} />
|
|
}
|
|
|
|
export default memo(LoadingText)
|