Skip to content

Commit 12d862d

Browse files
committed
tui: expose auto-accept as a permissions select
Lets people explicitly choose between normal permission prompts and auto-accept while composing, without relying on an ambiguous icon state.
1 parent 9813537 commit 12d862d

1 file changed

Lines changed: 29 additions & 30 deletions

File tree

packages/app/src/components/prompt-input.tsx

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,14 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
957957
return permission.isAutoAccepting(id, sdk.directory)
958958
})
959959

960+
const flip = () => {
961+
if (!params.id) {
962+
permission.toggleAutoAcceptDirectory(sdk.directory)
963+
return
964+
}
965+
permission.toggleAutoAccept(params.id, sdk.directory)
966+
}
967+
960968
const { abort, handleSubmit } = createPromptSubmit({
961969
info,
962970
imageAttachments,
@@ -1467,41 +1475,32 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
14671475
)}
14681476
keybind={command.keybind("permissions.autoaccept")}
14691477
>
1470-
<Button
1471-
data-action="prompt-permissions"
1472-
type="button"
1473-
variant="ghost"
1474-
class="size-7 p-0 flex items-center justify-center"
1475-
style={{
1478+
<Select
1479+
size="normal"
1480+
options={["default", "autoaccept"] as const}
1481+
current={accepting() ? "autoaccept" : "default"}
1482+
label={(x) =>
1483+
x === "autoaccept"
1484+
? language.t("command.permissions.autoaccept.enable")
1485+
: `${language.t("common.default")} ${language.t("command.category.permissions")}`
1486+
}
1487+
onSelect={(x) => {
1488+
if (!x) return
1489+
if (x === "autoaccept" && accepting()) return
1490+
if (x === "default" && !accepting()) return
1491+
flip()
1492+
}}
1493+
class="max-w-[220px]"
1494+
valueClass="truncate text-13-regular"
1495+
triggerStyle={{
1496+
height: "28px",
14761497
opacity: buttonsSpring(),
14771498
transform: `scale(${0.95 + buttonsSpring() * 0.05})`,
14781499
filter: `blur(${(1 - buttonsSpring()) * 2}px)`,
14791500
"pointer-events": buttonsSpring() > 0.5 ? "auto" : "none",
14801501
}}
1481-
onClick={() => {
1482-
if (!params.id) {
1483-
permission.toggleAutoAcceptDirectory(sdk.directory)
1484-
return
1485-
}
1486-
permission.toggleAutoAccept(params.id, sdk.directory)
1487-
}}
1488-
classList={{
1489-
"text-text-base": !accepting(),
1490-
"hover:bg-surface-success-base": accepting(),
1491-
}}
1492-
aria-label={
1493-
accepting()
1494-
? language.t("command.permissions.autoaccept.disable")
1495-
: language.t("command.permissions.autoaccept.enable")
1496-
}
1497-
aria-pressed={accepting()}
1498-
>
1499-
<Icon
1500-
name="chevron-double-right"
1501-
size="small"
1502-
classList={{ "text-icon-success-base": accepting() }}
1503-
/>
1504-
</Button>
1502+
variant="ghost"
1503+
/>
15051504
</TooltipKeybind>
15061505
</div>
15071506
</div>

0 commit comments

Comments
 (0)