The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | /** |
| 2 | * Where the permissions chip shows, whether the mode block overflows, and which control answers |
| 3 | * the composer.mode shortcut. The model picker's footer always holds Permissions, so the chip |
| 4 | * only shows while the mode differs from the default. The rule: composer.mode has one target. |
| 5 | */ |
| 6 | export function resolveComposerControlsOwnership(input: { |
| 7 | /** Permissions hide while the mode is the default, or while the new-thread strip names it. */ |
| 8 | readonly matchesDefault: boolean; |
| 9 | readonly collapsed: boolean; |
| 10 | /** How many trailing blocks the width measurement moved into the overflow menu. */ |
| 11 | readonly measuredHiddenBlockCount: number; |
| 12 | }) { |
| 13 | const accessDisplay = input.matchesDefault |
| 14 | ? ("hidden" as const) |
| 15 | : input.collapsed |
| 16 | ? ("icon" as const) |
| 17 | : ("label" as const); |
| 18 | const showModeBlock = accessDisplay !== "hidden"; |
| 19 | const modeHidden = showModeBlock && input.measuredHiddenBlockCount > 0; |
| 20 | const hiddenBlockIds = modeHidden ? (["mode"] as const) : ([] as const); |
| 21 | const overflowShowsPermissions = modeHidden; |
| 22 | return { |
| 23 | accessDisplay, |
| 24 | showModeBlock, |
| 25 | hiddenBlockCount: hiddenBlockIds.length, |
| 26 | hiddenBlockIds, |
| 27 | overflowShowsPermissions, |
| 28 | /** Without a visible chip or an overflow menu holding it, the model picker answers composer.mode. */ |
| 29 | pickerOwnsModeShortcut: !overflowShowsPermissions && (accessDisplay === "hidden" || modeHidden), |
| 30 | }; |
| 31 | } |