"use client" import * as React from "react" import { Link } from "@/lib/router-compat" import { useRouter } from "@/lib/router-compat" import { useAskLeo } from "@/components/ask-leo-sidebar" import { PrimaryPageTemplate, type PrimaryPageTemplateProps } from "@/components/templates/primary-page-template" import { Button } from "@/components/ui/button" import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "@/components/ui/command" import { Shortcut } from "@/components/ui/dropdown-menu" import { Kbd, KbdGroup } from "@/components/ui/kbd" import { Tip } from "@/components/ui/tip" import { useAltKeyLabel, useModKeyLabel } from "@/hooks/use-mod-key-label" import type { DiscoveryHubSearchGroup, DiscoveryHubSearchItem } from "@/lib/discovery-hub" export interface DiscoveryHubPrimaryAction { label: string onClick: () => void shortcutKeys?: string } export interface DiscoveryHubAskLeoPromo { title: string description: string prompts: readonly string[] } export interface DiscoveryHubTemplateProps extends Pick { title: string description: string inputPlaceholder: string inputAriaLabel: string emptyMessage: string groups: DiscoveryHubSearchGroup[] primaryAction: DiscoveryHubPrimaryAction askLeoPromo: DiscoveryHubAskLeoPromo browseLibraryHref: string browseLibraryLabel?: string } const DiscoveryHubSearchRow = React.memo(function DiscoveryHubSearchRow({ item, onLink, onLeo, }: { item: DiscoveryHubSearchItem onLink: (href: string) => void onLeo: (prompt: string) => void }) { const isLeo = Boolean(item.askLeoPrompt) const iconClass = isLeo ? "fa-duotone fa-solid fa-star-christmas w-5 shrink-0 text-center text-brand" : `${item.icon ?? "fa-light fa-arrow-right"} w-5 shrink-0 text-center` return ( { if (item.askLeoPrompt) onLeo(item.askLeoPrompt) else if (item.href) onLink(item.href) }} >