diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 8a88cec..5a00609 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -32,6 +32,7 @@ import { useQuestion } from "./useQuestion.ts"; import { useThreadMenu } from "./useThreadMenu.ts"; import { editInEditor } from "./editor.ts"; import { Palette } from "./Palette.tsx"; +import { ApprovalPanel } from "./ApprovalPanel.tsx"; import { QuestionPanel } from "./QuestionPanel.tsx"; import { QueuePanel } from "./QueuePanel.tsx"; import { SecretPanel } from "./SecretPanel.tsx"; @@ -910,7 +911,6 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C // The mouse in the conversation: stable callbacks, since its rows are memoized. const conversationMouse: ConversationMouse = { - respond: useEvent((decision: ProviderApprovalDecision) => respond(decision)), selectTurn: useEvent((messageId: string) => turns.select(messageId)), toggleFold: useEvent((id: string) => setExpandedIds((previous) => { @@ -1173,6 +1173,10 @@ export function App(props: { readonly session: T3Session; readonly config: Tui3C ) : null} {threadId || draft ? ( + {pendingApproval && !draft ? ( + + ) : ( + <> + + )} ) : null} diff --git a/src/ui/ApprovalPanel.tsx b/src/ui/ApprovalPanel.tsx new file mode 100644 index 0000000..32fbf02 --- /dev/null +++ b/src/ui/ApprovalPanel.tsx @@ -0,0 +1,46 @@ +import type { ThreadPendingApproval } from "@t3tools/client-runtime/state/thread-requests"; +import type { ProviderApprovalDecision } from "@t3tools/contracts"; + +import { Button, Buttons } from "./Button.tsx"; +import { BAR, NO_BORDER } from "./edges.ts"; +import { colors } from "./theme.ts"; + +/** + * A pending approval in the composer's place, as the web swaps it into the + * composer: the composer's own block and bar, the bar turned to the warning + * colour, with the same keys the hint bar names. + */ +export function ApprovalPanel(props: { readonly approval: ThreadPendingApproval; readonly onRespond: (decision: ProviderApprovalDecision) => void }) { + const { approval } = props; + return ( + <> + + + {approvalTitle(approval.requestKind)} + + {approval.detail ? {approval.detail} : null} + {approval.appName ? {approval.appName} : null} + {approval.reason ? {approval.reason} : null} + + +