The best way to control Claude Code, Codex and more from any computer or phone
| 1 | export function resolveComposerMenuActiveItemId(input: { |
| 2 | items: ReadonlyArray<{ id: string }>; |
| 3 | highlightedItemId: string | null; |
| 4 | currentSearchKey: string | null; |
| 5 | highlightedSearchKey: string | null; |
| 6 | }): string | null { |
| 7 | if (input.items.length === 0) { |
| 8 | return null; |
| 9 | } |
| 10 | |
| 11 | if ( |
| 12 | input.currentSearchKey === input.highlightedSearchKey && |
| 13 | input.highlightedItemId && |
| 14 | input.items.some((item) => item.id === input.highlightedItemId) |
| 15 | ) { |
| 16 | return input.highlightedItemId; |
| 17 | } |
| 18 | |
| 19 | return input.items[0]?.id ?? null; |
| 20 | } |