feat: improve search command results rendering with conditional display

This commit is contained in:
poyrazavsever
2026-03-11 00:09:28 +03:00
parent 4ac6c518c6
commit 6e29f0fbf9
+21 -18
View File
@@ -92,24 +92,27 @@ export function SearchCommand({ open, onOpenChange }: SearchCommandProps) {
onValueChange={setQuery} onValueChange={setQuery}
/> />
<CommandPaletteList> <CommandPaletteList>
<CommandPaletteEmpty>Sonuç bulunamadı.</CommandPaletteEmpty> {filteredGroups.length === 0 ? (
{filteredGroups.map((group, index) => ( <CommandPaletteEmpty>Sonuç bulunamadı.</CommandPaletteEmpty>
<div key={group.id}> ) : (
{index > 0 && <CommandPaletteSeparator />} filteredGroups.map((group, index) => (
<CommandPaletteGroup heading={group.heading}> <div key={group.id}>
{group.items.map((item) => ( {index > 0 && <CommandPaletteSeparator />}
<CommandPaletteItem <CommandPaletteGroup heading={group.heading}>
key={item.id} {group.items.map((item) => (
icon={<Icon icon={item.icon} width={16} height={16} />} <CommandPaletteItem
onClick={() => handleCommandSelect(item)} key={item.id}
className="cursor-pointer" icon={<Icon icon={item.icon} width={16} height={16} />}
> onClick={() => handleCommandSelect(item)}
{item.label} className="cursor-pointer"
</CommandPaletteItem> >
))} {item.label}
</CommandPaletteGroup> </CommandPaletteItem>
</div> ))}
))} </CommandPaletteGroup>
</div>
))
)}
</CommandPaletteList> </CommandPaletteList>
<CommandPaletteFooter className="text-xs text-muted-foreground"> <CommandPaletteFooter className="text-xs text-muted-foreground">
Hızlıca açmak için {shortcut} kullan Hızlıca açmak için {shortcut} kullan