@@ -5,6 +5,7 @@ import { useTranslations } from 'next-intl'
55import { useEffect , useState } from 'react'
66import { createPortal } from 'react-dom'
77import { useRouter } from '@/i18n/navigation'
8+ import { buildManifestPath } from '@/lib/manifest-registry'
89import type { SearchResult } from '@/lib/search'
910import { getAutocompleteSuggestions } from '@/lib/search'
1011
@@ -15,7 +16,8 @@ export interface SearchDialogProps {
1516}
1617
1718export default function SearchDialog ( { isOpen, onClose, locale } : SearchDialogProps ) {
18- const t = useTranslations ( )
19+ const tShared = useTranslations ( 'shared' )
20+ const tComponent = useTranslations ( 'components.controls.searchDialog' )
1921 const router = useRouter ( )
2022 const [ query , setQuery ] = useState ( '' )
2123 const [ suggestions , setSuggestions ] = useState < SearchResult [ ] > ( [ ] )
@@ -48,7 +50,7 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
4850 // Navigate to result
4951 const navigateToResult = ( result : SearchResult ) => {
5052 onClose ( )
51- router . push ( `/ ${ result . category } / ${ result . id } ` )
53+ router . push ( buildManifestPath ( result . category , result . id ) )
5254 }
5355
5456 // Navigate to search page
@@ -102,7 +104,7 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
102104 < Command . Input
103105 value = { query }
104106 onValueChange = { setQuery }
105- placeholder = { t ( 'components.header.searchPlaceholder ') }
107+ placeholder = { tComponent ( 'placeholder ') }
106108 className = "flex-1 bg-transparent text-[var(--color-text)] placeholder:text-[var(--color-text-muted)] focus:outline-none text-base"
107109 autoFocus
108110 />
@@ -116,9 +118,7 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
116118 { /* Empty State */ }
117119 < Command . Empty className = "py-12 text-center" >
118120 { query . trim ( ) === '' ? (
119- < div className = "text-[var(--color-text-muted)] text-sm" >
120- { t ( 'pages.search.placeholder' ) }
121- </ div >
121+ < div className = "text-[var(--color-text-muted)] text-sm" > { tComponent ( 'empty' ) } </ div >
122122 ) : (
123123 < div className = "text-center" >
124124 < svg
@@ -136,7 +136,7 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
136136 />
137137 </ svg >
138138 < p className = "text-sm text-[var(--color-text-muted)]" >
139- { t ( 'pages.search. noResultsFor', { query } ) }
139+ { tComponent ( ' noResultsFor', { query } ) }
140140 </ p >
141141 </ div >
142142 ) }
@@ -163,8 +163,8 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
163163 </ div >
164164 < div className = "flex-shrink-0" >
165165 < span className = "inline-block px-2 py-0.5 text-xs border border-[var(--color-border)] text-[var(--color-text-muted)]" >
166- { t (
167- `shared. categories.plural.${ result . category === 'providers' ? 'modelProviders' : result . category } `
166+ { tShared (
167+ `categories.plural.${ result . category === 'providers' ? 'modelProviders' : result . category } `
168168 ) }
169169 </ span >
170170 </ div >
@@ -180,7 +180,7 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
180180 className = "px-4 py-3 cursor-pointer transition-colors border-t border-[var(--color-border)] data-[selected=true]:bg-[var(--color-hover)] aria-selected:bg-[var(--color-hover)] text-[var(--color-text-secondary)]"
181181 >
182182 < div className = "flex items-center gap-2 text-sm" >
183- < span > View all results for " { query } " </ span >
183+ < span > { tComponent ( 'viewAllResults' , { query } ) } </ span >
184184 < span className = "ml-auto text-[var(--color-text-muted)]" > →</ span >
185185 </ div >
186186 </ Command . Item >
@@ -199,13 +199,13 @@ export default function SearchDialog({ isOpen, onClose, locale }: SearchDialogPr
199199 < kbd className = "px-1.5 py-0.5 border border-[var(--color-border)] bg-[var(--color-bg)]" >
200200 ↓
201201 </ kbd >
202- < span > { t ( 'pages.search. navigate') } </ span >
202+ < span > { tComponent ( ' navigate') } </ span >
203203 </ div >
204204 < div className = "flex items-center gap-1.5" >
205205 < kbd className = "px-1.5 py-0.5 border border-[var(--color-border)] bg-[var(--color-bg)]" >
206206 ↵
207207 </ kbd >
208- < span > { t ( 'pages.search. select') } </ span >
208+ < span > { tComponent ( ' select') } </ span >
209209 </ div >
210210 </ div >
211211 ) }
0 commit comments