;
highlightedItemValue?: string | null;
isActionsOnly: boolean;
keybindings: ResolvedKeybindingsConfig;
onExecuteItem: (item: CommandPaletteActionItem | CommandPaletteSubmenuItem) => void;
}
export function CommandPaletteResults(props: CommandPaletteResultsProps) {
if (props.groups.length === 0) {
return (
{props.emptyStateMessage ??
(props.isActionsOnly
? "No matching actions."
: "No matching commands, projects, or threads.")}
);
}
return (
{props.groups.map((group) => (
{group.label}
{(item) =>
item.disabled ? (
) : (
)
}
))}
);
}
function DisabledCommandPaletteResultRow(props: {
item: CommandPaletteActionItem | CommandPaletteSubmenuItem;
}) {
return (
{props.item.icon}
{props.item.description || props.item.threadContentMatch ? (
{props.item.titleLeadingContent}
{props.item.title}
{props.item.threadContentMatch ? (
) : null}
{props.item.description ? (
{props.item.description}
) : null}
) : (
{props.item.titleLeadingContent}
{props.item.title}
)}
{props.item.titleTrailingContent}
);
}
function CommandPaletteResultRow(props: {
item: CommandPaletteActionItem | CommandPaletteSubmenuItem;
isActive: boolean;
keybindings: ResolvedKeybindingsConfig;
onExecuteItem: (item: CommandPaletteActionItem | CommandPaletteSubmenuItem) => void;
}) {
const shortcutLabel = props.item.shortcutCommand
? shortcutLabelForCommand(props.keybindings, props.item.shortcutCommand)
: null;
return (
{
event.preventDefault();
}}
onClick={() => {
props.onExecuteItem(props.item);
}}
>
{props.item.icon}
{props.item.description || props.item.threadContentMatch ? (
{props.item.titleLeadingContent}
{props.item.title}
{props.item.threadContentMatch ? (
) : null}
{props.item.description ? (
{props.item.description}
) : null}
) : (
{props.item.titleLeadingContent}
{props.item.title}
)}
{props.item.titleTrailingContent}
{props.item.timestamp ? (
{props.item.timestamp}
) : null}
{shortcutLabel ? {shortcutLabel} : null}
{props.item.kind === "submenu" ? (
) : null}
);
}