11import { BoxRenderable , TextareaRenderable , MouseEvent , PasteEvent , t , dim , fg , type KeyBinding } from "@opentui/core"
22import { createEffect , createMemo , type JSX , onMount , createSignal , onCleanup , Show , Switch , Match } from "solid-js"
3+ import "opentui-spinner/solid" ;
34import { useLocal } from "@tui/context/local"
45import { useTheme } from "@tui/context/theme"
56import { EmptyBorder } from "@tui/component/border"
@@ -20,7 +21,7 @@ import type { FilePart } from "@opencode-ai/sdk"
2021import { TuiEvent } from "../../event"
2122import { iife } from "@/util/iife"
2223import { Locale } from "@/util/locale"
23- import { Shimmer } from "../../ui/shimmer "
24+ import { createColors , createFrames } from "../../ui/spinner.ts "
2425
2526export type PromptProps = {
2627 sessionID ?: string
@@ -545,6 +546,22 @@ export function Prompt(props: PromptProps) {
545546 return local . agent . color ( local . agent . current ( ) . name )
546547 } )
547548
549+ const spinnerDef = createMemo ( ( ) => {
550+ const color = local . agent . color ( local . agent . current ( ) . name )
551+ return {
552+ frames : createFrames ( {
553+ color,
554+ style : "blocks" ,
555+ inactiveFactor : 0.25 ,
556+ } ) ,
557+ color : createColors ( {
558+ color,
559+ style : "blocks" ,
560+ inactiveFactor : 0.25 ,
561+ } ) ,
562+ }
563+ } )
564+
548565 createEffect ( ( ) => {
549566 renderer . setCursorColor ( highlight ( ) )
550567 } )
@@ -813,7 +830,11 @@ export function Prompt(props: PromptProps) {
813830 justifyContent = { status ( ) . type === "retry" ? "space-between" : "flex-start" }
814831 >
815832 < box flexShrink = { 0 } flexDirection = "row" gap = { 1 } >
816- < Loader />
833+ < spinner
834+ color = { spinnerDef ( ) . color }
835+ frames = { spinnerDef ( ) . frames }
836+ interval = { 40 }
837+ />
817838 < box flexDirection = "row" gap = { 1 } flexShrink = { 0 } >
818839 { ( ( ) => {
819840 const retry = createMemo ( ( ) => {
@@ -884,37 +905,3 @@ export function Prompt(props: PromptProps) {
884905 )
885906}
886907
887- function Loader ( ) {
888- const FRAMES = [
889- "▱▱▱▱▱▱▱" ,
890- "▱▱▱▱▱▱▱" ,
891- "▱▱▱▱▱▱▱" ,
892- "▱▱▱▱▱▱▱" ,
893- "▰▱▱▱▱▱▱" ,
894- "▰▰▱▱▱▱▱" ,
895- "▰▰▰▱▱▱▱" ,
896- "▱▰▰▰▱▱▱" ,
897- "▱▱▰▰▰▱▱" ,
898- "▱▱▱▰▰▰▱" ,
899- "▱▱▱▱▰▰▰" ,
900- "▱▱▱▱▱▰▰" ,
901- "▱▱▱▱▱▱▰" ,
902- "▱▱▱▱▱▱▱" ,
903- "▱▱▱▱▱▱▱" ,
904- "▱▱▱▱▱▱▱" ,
905- "▱▱▱▱▱▱▱" ,
906- ]
907- const [ frame , setFrame ] = createSignal ( 0 )
908-
909- onMount ( ( ) => {
910- const timer = setInterval ( ( ) => {
911- setFrame ( ( frame ( ) + 1 ) % FRAMES . length )
912- } , 100 )
913- onCleanup ( ( ) => {
914- clearInterval ( timer )
915- } )
916- } )
917-
918- const { theme } = useTheme ( )
919- return < text fg = { theme . diffAdded } > { FRAMES [ frame ( ) ] } </ text >
920- }
0 commit comments