diff --git a/packages/tui/src/routes/session/permission.tsx b/packages/tui/src/routes/session/permission.tsx index 434a25aef86..a80b03ad5e0 100644 --- a/packages/tui/src/routes/session/permission.tsx +++ b/packages/tui/src/routes/session/permission.tsx @@ -17,7 +17,7 @@ import { SimulationSemantics } from "../../simulation/semantics" import { PatchDiff } from "../../component/patch-diff" import { useToast } from "../../ui/toast" -type PermissionStage = "permission" | "always" | "reject" +type PermissionStage = "permission" | "reject" function EditBody(props: { file?: string; diff?: string; patch?: string }) { const theme = useTheme() @@ -141,27 +141,6 @@ export function PermissionPrompt(props: { request: PermissionRequest; directory? return ( - - - - {(line, index) => {line}} - - - } - options={{ confirm: permissionOptionLabel("confirm"), cancel: permissionOptionLabel("cancel") }} - escapeKey="cancel" - onSelect={(option) => { - setStore("stage", "permission") - if (option === "cancel") return - reply("always") - }} - /> - props.request.action === "edit" ? ( ) : props.request.action === "external_directory" ? ( @@ -241,7 +220,15 @@ export function PermissionPrompt(props: { request: PermissionRequest; directory? semanticLabel={permissionSemanticLabel(props.request.action, current.title)} instance={props.request.id} header={header()} - body={presentationBody} + body={(option) => ( + + + + {(line, index) => {line}} + + + + )} options={ props.request.save?.length ? { @@ -255,7 +242,7 @@ export function PermissionPrompt(props: { request: PermissionRequest; directory? fullscreen onSelect={(option) => { if (option === "always") { - setStore("stage", "always") + reply("always") return } if (option === "reject") { @@ -425,7 +412,7 @@ export function SessionQuestion>(props: { group?: string choicesLabel?: string header?: JSX.Element - body: JSX.Element + body: JSX.Element | ((option: keyof T) => JSX.Element) options: T escapeKey?: keyof T fullscreen?: boolean @@ -549,7 +536,7 @@ export function SessionQuestion>(props: { {props.header} - {props.body} + {typeof props.body === "function" ? props.body(store.selected) : props.body}