/** * SearchResultsView Component * Displays a list of filtered settings matching the search query. * Works with the schema-based search system for iOS-like settings discovery. */ import type { RequiresToggle } from "../settingsSchema"; export interface SearchableFieldData { id: string; label: string; description?: string; tabId: string; tabLabel: string; section?: string; /** Sub-tab within the main tab (for tabs with nested navigation) */ subTab?: string; /** Keywords for search matching (not displayed, used for discovery) */ keywords?: string[]; /** If this field requires a toggle to be enabled, contains redirect info */ requiresToggle?: RequiresToggle; } export interface SearchResultsViewProps { query: string; results: SearchableFieldData[]; onSelectResult: (result: SearchableFieldData) => void; onClearSearch: () => void; /** Function to check if a field's required toggle is enabled */ isToggleEnabled?: (result: SearchableFieldData) => boolean; } export function SearchResultsView({ query, results, onSelectResult, onClearSearch, isToggleEnabled, }: SearchResultsViewProps) { return (
{/* Header */}

Search Results

Showing {results.length}{" "} {results.length === 1 ? "match" : "matches"} for{" "} “{query}”

{/* Results List */} {results.length === 0 ? (

No settings found

Try adjusting your search terms or browse settings by category.

) : (
{results.map((result) => { // Check if this field requires a toggle that's currently disabled const requiresDisabledToggle = result.requiresToggle && isToggleEnabled && !isToggleEnabled(result); return ( ); })}
)}
); }