Files
t3code/apps/web/src/components/chat/composerMenuHighlight.ts
T
58e5f714b0 Add provider skill discovery (#1905)
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: codex <[email protected]>
Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
2026-04-10 17:19:23 -07:00

21 lines
536 B
TypeScript

export function resolveComposerMenuActiveItemId(input: {
items: ReadonlyArray<{ id: string }>;
highlightedItemId: string | null;
currentSearchKey: string | null;
highlightedSearchKey: string | null;
}): string | null {
if (input.items.length === 0) {
return null;
}
if (
input.currentSearchKey === input.highlightedSearchKey &&
input.highlightedItemId &&
input.items.some((item) => item.id === input.highlightedItemId)
) {
return input.highlightedItemId;
}
return input.items[0]?.id ?? null;
}