"use client"; import Link from "next/link"; import DOMPurify from "dompurify"; import { Card } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { SearchFilters } from "./SearchFilters"; import type { SearchResult, SearchFiltersState, Tag } from "./types"; interface SearchResultsProps { results: SearchResult[]; query: string; totalResults: number; isLoading: boolean; selectedTags?: string[] | undefined; selectedStatus?: string | undefined; availableTags?: Tag[] | undefined; onFilterChange: (filters: SearchFiltersState) => void; } /** * Status indicator icons (PDA-friendly) */ const STATUS_ICONS: Record = { ACTIVE: "🟒", SCHEDULED: "πŸ”΅", PAUSED: "⏸️", DORMANT: "πŸ’€", ARCHIVED: "βšͺ", }; /** * Individual search result item with highlighted snippet */ function SearchResultItem({ result }: { result: SearchResult }): React.JSX.Element { const statusIcon = STATUS_ICONS[result.status] ?? "βšͺ"; return (
{/* Title and status */}

{result.title}

{statusIcon}
{/* Highlighted snippet */} {result.headline && (
)} {/* Tags */} {result.tags.length > 0 && (
{result.tags.map((tag) => ( {tag.name} ))}
)} {/* Metadata */}
Updated {new Date(result.updatedAt).toLocaleDateString()}
); } /** * Loading state */ function LoadingState(): React.JSX.Element { return (

Searching...

); } /** * No results state with PDA-friendly suggestions */ function NoResultsState({ query }: { query: string }): React.JSX.Element { return (
πŸ”

No results found

We couldn't find any entries matching "{query}"

Consider these options:

  • Try different keywords
  • Check your spelling
  • Use more general terms
  • Remove filters to broaden your search
); } /** * Main search results component with filter sidebar */ export function SearchResults({ results, query, totalResults, isLoading, selectedTags = [], selectedStatus, availableTags = [], onFilterChange, }: SearchResultsProps): React.JSX.Element { return (
{/* Main results area */}
{/* Results header */}

Search Results

{!isLoading && (

{totalResults} {totalResults === 1 ? "result" : "results"} for "{query}"

)}
{/* Results content */} {isLoading ? ( ) : results.length === 0 ? ( ) : (
{results.map((result) => ( ))}
)}
{/* Filter sidebar */}
); }