From 925adc9712dd34c47a738c4b79baa4de9ea0aac8 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Sun, 18 Jan 2026 01:26:08 +0000 Subject: [PATCH] Add shared global search types --- .../global-search/RecentSearches.tsx | 20 +------------------ .../global-search/SearchResults.tsx | 11 +--------- src/components/global-search/types.ts | 18 +++++++++++++++++ .../global-search/useGlobalSearchData.tsx | 20 +------------------ 4 files changed, 21 insertions(+), 48 deletions(-) create mode 100644 src/components/global-search/types.ts diff --git a/src/components/global-search/RecentSearches.tsx b/src/components/global-search/RecentSearches.tsx index 99b2728..161b134 100644 --- a/src/components/global-search/RecentSearches.tsx +++ b/src/components/global-search/RecentSearches.tsx @@ -2,25 +2,7 @@ import { ClockCounterClockwise, X } from '@phosphor-icons/react' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { CommandGroup, CommandItem, CommandSeparator } from '@/components/ui/command' - -interface SearchHistoryItem { - id: string - query: string - timestamp: number - resultId?: string - resultTitle?: string - resultCategory?: string -} - -interface SearchResult { - id: string - title: string - subtitle?: string - category: string - icon: React.ReactNode - action: () => void - tags?: string[] -} +import type { SearchHistoryItem, SearchResult } from './types' interface RecentSearchesProps { recentSearches: Array<{ historyItem: SearchHistoryItem; result?: SearchResult }> diff --git a/src/components/global-search/SearchResults.tsx b/src/components/global-search/SearchResults.tsx index 87a8dc1..d5093ba 100644 --- a/src/components/global-search/SearchResults.tsx +++ b/src/components/global-search/SearchResults.tsx @@ -1,15 +1,6 @@ import { Badge } from '@/components/ui/badge' import { CommandGroup, CommandItem, CommandSeparator } from '@/components/ui/command' - -interface SearchResult { - id: string - title: string - subtitle?: string - category: string - icon: React.ReactNode - action: () => void - tags?: string[] -} +import type { SearchResult } from './types' interface SearchResultsProps { groupedResults: Record diff --git a/src/components/global-search/types.ts b/src/components/global-search/types.ts new file mode 100644 index 0000000..8fa320f --- /dev/null +++ b/src/components/global-search/types.ts @@ -0,0 +1,18 @@ +export interface SearchResult { + id: string + title: string + subtitle?: string + category: string + icon: React.ReactNode + action: () => void + tags?: string[] +} + +export interface SearchHistoryItem { + id: string + query: string + timestamp: number + resultId?: string + resultTitle?: string + resultCategory?: string +} diff --git a/src/components/global-search/useGlobalSearchData.tsx b/src/components/global-search/useGlobalSearchData.tsx index cb217b3..26113b4 100644 --- a/src/components/global-search/useGlobalSearchData.tsx +++ b/src/components/global-search/useGlobalSearchData.tsx @@ -33,25 +33,7 @@ import { Workflow, } from '@/types/project' import navigationData from '@/data/global-search.json' - -export interface SearchResult { - id: string - title: string - subtitle?: string - category: string - icon: React.ReactNode - action: () => void - tags?: string[] -} - -export interface SearchHistoryItem { - id: string - query: string - timestamp: number - resultId?: string - resultTitle?: string - resultCategory?: string -} +import type { SearchHistoryItem, SearchResult } from './types' const navigationIconMap = { BookOpen,