From 85093a52acf18f65fe2a04fe48e2ded033a3fd0e Mon Sep 17 00:00:00 2001 From: "Andrew J. McGehee" Date: Tue, 27 Jan 2026 09:56:41 -0800 Subject: [PATCH 1/2] change sorting of allow options in twig --- .../components/InlinePermissionSelector.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx b/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx index fc8c4ecbf..0cbc01dab 100644 --- a/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx +++ b/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx @@ -2,11 +2,17 @@ import { Box, Flex, Text } from "@radix-ui/themes"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useHotkeys } from "react-hotkeys-hook"; +export type PermissionOptionKind = + | "allow_once" + | "allow_always" + | "custom" + | "reject_once"; + export interface PermissionOption { optionId: string; name: string; description?: string; - kind: string; + kind: PermissionOptionKind; } interface InlinePermissionSelectorProps { @@ -29,6 +35,12 @@ export function InlinePermissionSelector({ const [customInput, setCustomInput] = useState(""); const inputRef = useRef(null); const containerRef = useRef(null); + const sortPriority: Record = { + allow_once: 500, + reject_once: 400, + allow_always: 300, + custom: 100, + }; // Auto-focus the container when component mounts to capture keyboard events useEffect(() => { @@ -57,7 +69,10 @@ export function InlinePermissionSelector({ { optionId: "_custom", name: "Other", description: "", kind: "custom" }, ]; } - return filteredOptions; + // sorts so that higher priority comes first (ie descending order) + return filteredOptions.sort( + (a, b) => sortPriority[b.kind] - sortPriority[a.kind], + ); }, [options]); const numOptions = allOptions.length; From 08cfebe875b6ee77a3a2304b630b49161128e502 Mon Sep 17 00:00:00 2001 From: "Andrew J. McGehee" Date: Tue, 27 Jan 2026 10:34:36 -0800 Subject: [PATCH 2/2] reorder --- .../features/sessions/components/InlinePermissionSelector.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx b/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx index 0cbc01dab..58074ccce 100644 --- a/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx +++ b/apps/twig/src/renderer/features/sessions/components/InlinePermissionSelector.tsx @@ -37,8 +37,8 @@ export function InlinePermissionSelector({ const containerRef = useRef(null); const sortPriority: Record = { allow_once: 500, - reject_once: 400, - allow_always: 300, + allow_always: 400, + reject_once: 300, custom: 100, };