Skip to content

Commit d20ef56

Browse files
committed
tui: replace text shimmer with animated progress bar during model processing
1 parent ca2b871 commit d20ef56

2 files changed

Lines changed: 36 additions & 16 deletions

File tree

packages/opencode/src/cli/cmd/tui/component/dialog-model.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,8 @@ import { useSync } from "@tui/context/sync"
44
import { map, pipe, flatMap, entries, filter, isDeepEqual, sortBy, take } from "remeda"
55
import { DialogSelect, type DialogSelectRef } from "@tui/ui/dialog-select"
66
import { useDialog } from "@tui/ui/dialog"
7-
import { useTheme } from "../context/theme"
87
import { createDialogProviderOptions, DialogProvider } from "./dialog-provider"
98

10-
function Free() {
11-
const { theme } = useTheme()
12-
return <span style={{ fg: theme.text }}>Free</span>
13-
}
14-
const PROVIDER_PRIORITY: Record<string, number> = {
15-
opencode: 0,
16-
anthropic: 1,
17-
"github-copilot": 2,
18-
openai: 3,
19-
google: 4,
20-
openrouter: 5,
21-
vercel: 6,
22-
}
23-
249
export function DialogModel() {
2510
const local = useLocal()
2611
const sync = useSync()

packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ export function Prompt(props: PromptProps) {
806806
justifyContent={status().type === "retry" ? "space-between" : "flex-start"}
807807
>
808808
<box flexShrink={0} flexDirection="row" gap={1}>
809-
<Shimmer text="Working" color={theme.text} />
809+
<Loader />
810810
<box flexDirection="row" gap={1} flexShrink={0}>
811811
{(() => {
812812
const retry = createMemo(() => {
@@ -876,3 +876,38 @@ export function Prompt(props: PromptProps) {
876876
</>
877877
)
878878
}
879+
880+
function Loader() {
881+
const FRAMES = [
882+
"▱▱▱▱▱▱▱",
883+
"▱▱▱▱▱▱▱",
884+
"▱▱▱▱▱▱▱",
885+
"▱▱▱▱▱▱▱",
886+
"▰▱▱▱▱▱▱",
887+
"▰▰▱▱▱▱▱",
888+
"▰▰▰▱▱▱▱",
889+
"▱▰▰▰▱▱▱",
890+
"▱▱▰▰▰▱▱",
891+
"▱▱▱▰▰▰▱",
892+
"▱▱▱▱▰▰▰",
893+
"▱▱▱▱▱▰▰",
894+
"▱▱▱▱▱▱▰",
895+
"▱▱▱▱▱▱▱",
896+
"▱▱▱▱▱▱▱",
897+
"▱▱▱▱▱▱▱",
898+
"▱▱▱▱▱▱▱",
899+
]
900+
const [frame, setFrame] = createSignal(0)
901+
902+
onMount(() => {
903+
const timer = setInterval(() => {
904+
setFrame((frame() + 1) % FRAMES.length)
905+
}, 100)
906+
onCleanup(() => {
907+
clearInterval(timer)
908+
})
909+
})
910+
911+
const { theme } = useTheme()
912+
return <text fg={theme.diffAdded}>{FRAMES[frame()]}</text>
913+
}

0 commit comments

Comments
 (0)