fix(tui): satisfy strict dialog prompt types
This commit is contained in:
parent
9a72c4e337
commit
5030097b55
2 changed files with 8 additions and 3 deletions
|
|
@ -1528,7 +1528,7 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
|
|||
customBorderChars={SplitBorder.customBorderChars}
|
||||
borderColor={theme.error}
|
||||
>
|
||||
<text fg={theme.textMuted}>{props.message.error?.data.message}</text>
|
||||
<text fg={theme.textMuted}>{String(props.message.error?.data.message ?? "")}</text>
|
||||
</box>
|
||||
</Show>
|
||||
<Switch>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { useBindings, useCommandShortcut } from "../keymap"
|
|||
|
||||
export type DialogPromptProps = {
|
||||
title: string
|
||||
description?: () => JSX.Element
|
||||
description?: JSX.Element | (() => JSX.Element)
|
||||
placeholder?: string
|
||||
value?: string
|
||||
busy?: boolean
|
||||
|
|
@ -25,6 +25,11 @@ export function DialogPrompt(props: DialogPromptProps) {
|
|||
const [textareaTarget, setTextareaTarget] = createSignal<TextareaRenderable>()
|
||||
let textarea: TextareaRenderable
|
||||
|
||||
const description = () => {
|
||||
if (typeof props.description === "function") return props.description()
|
||||
return props.description
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
if (props.busy) return
|
||||
props.onConfirm?.(textarea.plainText)
|
||||
|
|
@ -83,7 +88,7 @@ export function DialogPrompt(props: DialogPromptProps) {
|
|||
</text>
|
||||
</box>
|
||||
<box gap={1}>
|
||||
{props.description}
|
||||
{description()}
|
||||
<textarea
|
||||
height={3}
|
||||
ref={(val: TextareaRenderable) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue