@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 20 lines 536 Bytes
Raw
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 }