Skip to content

Commit fdb588a

Browse files
fix(app): size the agent menu to its options (#60026)
Co-authored-by: iamdavidhill <1879069+iamdavidhill@users.noreply.github.com>
1 parent 1dddb81 commit fdb588a

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

‎packages/app/src/composer/editor/editor.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ export function ComposerEditor(props: ComposerEditorProps) {
423423
<Show when={view.agent} keyed>
424424
{(control) => (
425425
<ComposerEditorConfiguredSelect
426+
fitMenuToOptions
426427
title={i18n.t("ui.promptInput.chooseAgent")}
427428
keybind={["Mod", "."]}
428429
control={control}
@@ -995,6 +996,7 @@ function pointerFocusReturn() {
995996

996997
function ComposerEditorConfiguredSelect(props: {
997998
mobileDrawer?: boolean
999+
fitMenuToOptions?: boolean
9981000
title: string
9991001
keybind?: string[]
10001002
control: ComposerSelectControl
@@ -1007,6 +1009,7 @@ function ComposerEditorConfiguredSelect(props: {
10071009
return (
10081010
<ComposerEditorSelect
10091011
mobileDrawer={props.mobileDrawer}
1012+
fitMenuToOptions={props.fitMenuToOptions}
10101013
title={props.title}
10111014
class={props.class}
10121015
keybind={props.control.keybind?.() ?? props.keybind}
@@ -1024,6 +1027,8 @@ function ComposerEditorConfiguredSelect(props: {
10241027

10251028
function ComposerEditorSelect(props: {
10261029
mobileDrawer?: boolean
1030+
/** Size the menu to its longest option instead of the shared 160px minimum, with room before the check. */
1031+
fitMenuToOptions?: boolean
10271032
title: string
10281033
keybind?: string[]
10291034
options: ComposerOption[]
@@ -1087,11 +1092,18 @@ function ComposerEditorSelect(props: {
10871092
{content()}
10881093
</Menu.Trigger>
10891094
<Menu.Portal>
1090-
<Menu.Content onCloseAutoFocus={focus.onCloseAutoFocus}>
1095+
<Menu.Content
1096+
onCloseAutoFocus={focus.onCloseAutoFocus}
1097+
class={props.fitMenuToOptions ? "!min-w-0" : undefined}
1098+
>
10911099
<Menu.RadioGroup value={props.current} onChange={props.onSelect}>
10921100
<For each={props.options}>
10931101
{(option) => (
1094-
<Menu.RadioItem value={option.id} class="capitalize" closeOnSelect>
1102+
<Menu.RadioItem
1103+
value={option.id}
1104+
class={props.fitMenuToOptions ? "capitalize !gap-6" : "capitalize"}
1105+
closeOnSelect
1106+
>
10951107
{option.label}
10961108
</Menu.RadioItem>
10971109
)}

0 commit comments

Comments
 (0)