mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-04 22:29:54 +00:00
fix(tui): animate pending inline tools
This commit is contained in:
parent
672b8c4762
commit
b3cafd7bdb
2 changed files with 9 additions and 3 deletions
|
|
@ -587,6 +587,7 @@ function InlineTool(props: {
|
|||
const [showError, setShowError] = createSignal(false)
|
||||
const error = createMemo(() => (props.part.state.status === "error" ? props.part.state.error.message : undefined))
|
||||
const complete = createMemo(() => !!props.complete)
|
||||
const active = createMemo(() => props.part.state.status === "pending" || props.part.state.status === "running")
|
||||
const denied = createMemo(() => {
|
||||
const message = error()
|
||||
if (!message) return false
|
||||
|
|
@ -632,7 +633,7 @@ function InlineTool(props: {
|
|||
>
|
||||
<box flexShrink={0}>
|
||||
<Switch>
|
||||
<Match when={props.spinner}>
|
||||
<Match when={props.spinner || (!complete() && active())}>
|
||||
<Spinner color={theme.text} />
|
||||
</Match>
|
||||
<Match when={complete()}>
|
||||
|
|
|
|||
|
|
@ -1795,6 +1795,7 @@ function InlineTool(props: {
|
|||
const sync = useSync()
|
||||
const renderer = useRenderer()
|
||||
const [hover, setHover] = createSignal(false)
|
||||
const active = createMemo(() => props.part.state.status === "pending" || props.part.state.status === "running")
|
||||
|
||||
const permission = createMemo(() => {
|
||||
const callID = sync.data.permission[ctx.sessionID]?.at(0)?.tool?.callID
|
||||
|
|
@ -1854,8 +1855,12 @@ function InlineTool(props: {
|
|||
}}
|
||||
>
|
||||
<Switch>
|
||||
<Match when={props.spinner}>
|
||||
<Spinner color={fg()} children={props.children} />
|
||||
<Match when={props.spinner || (!props.complete && active())}>
|
||||
<Spinner color={fg()}>
|
||||
<Show when={props.complete} fallback={props.pending}>
|
||||
{props.children}
|
||||
</Show>
|
||||
</Spinner>
|
||||
</Match>
|
||||
<Match when={true}>
|
||||
<text paddingLeft={3} fg={fg()} attributes={denied() ? TextAttributes.STRIKETHROUGH : undefined}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue