@@ -13,7 +13,7 @@ import {
1313} from "@/components/ui/table"
1414import { PersonaBadge } from '@/components/persona-badge'
1515import { ChannelBadge } from '@/components/channel-badge'
16- import { Search , Calendar , Clock , Tag } from 'lucide-react'
16+ import { Search , Calendar , Clock , Tag , X } from 'lucide-react'
1717import { useRouter } from 'next/navigation'
1818import { personaMap } from '@/data/personas'
1919
@@ -33,6 +33,7 @@ export default function ExplorePage() {
3333 }
3434 } > > ( [ ] )
3535 const [ loading , setLoading ] = useState ( true )
36+ const [ rawQuery , setRawQuery ] = useState ( '' )
3637 const [ searchQuery , setSearchQuery ] = useState ( '' )
3738 const router = useRouter ( )
3839
@@ -111,6 +112,12 @@ export default function ExplorePage() {
111112 fetchArticles ( )
112113 } , [ ] )
113114
115+ // Debounce search input (200ms)
116+ useEffect ( ( ) => {
117+ const id = setTimeout ( ( ) => setSearchQuery ( rawQuery ) , 200 )
118+ return ( ) => clearTimeout ( id )
119+ } , [ rawQuery ] )
120+
114121 // Filtered articles based on search + selected tags
115122 const filteredArticles = useMemo ( ( ) => {
116123 const q = searchQuery . trim ( ) . toLowerCase ( )
@@ -149,10 +156,20 @@ export default function ExplorePage() {
149156 < input
150157 type = "text"
151158 placeholder = "Search by title, author, or tags..."
152- value = { searchQuery }
153- onChange = { ( e ) => setSearchQuery ( e . target . value ) }
159+ value = { rawQuery }
160+ onChange = { ( e ) => setRawQuery ( e . target . value ) }
154161 className = "w-full pl-10 pr-4 py-2 border border-neutral-200 dark:border-neutral-700 rounded-lg bg-white dark:bg-neutral-800 text-neutral-900 dark:text-neutral-100 placeholder-neutral-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent"
155162 />
163+ { rawQuery && (
164+ < button
165+ type = "button"
166+ onClick = { ( ) => setRawQuery ( '' ) }
167+ aria-label = "Clear search"
168+ className = "absolute right-2 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200 p-1 rounded"
169+ >
170+ < X className = "h-4 w-4" />
171+ </ button >
172+ ) }
156173 </ div >
157174 { /* Filters removed per request; tags are ever-expanding */ }
158175 </ div >
@@ -166,7 +183,10 @@ export default function ExplorePage() {
166183 </ div >
167184
168185 { /* Table region fills viewport with inner scrolling */ }
169- < div className = "flex-1 min-h-0 border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden bg-white dark:bg-neutral-800" >
186+ < div
187+ className = "flex-1 min-h-0 border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden bg-white dark:bg-neutral-800"
188+ style = { { contentVisibility : 'auto' } }
189+ >
170190 { loading ? (
171191 < div className = "p-8 text-center" >
172192 < div className = "text-neutral-500" > Loading articles...</ div >
@@ -221,6 +241,7 @@ export default function ExplorePage() {
221241 { authorPersona ? (
222242 < PersonaBadge
223243 imageSrc = { authorPersona . imageSrc }
244+ alt = { author }
224245 size = "sm"
225246 />
226247 ) : (
@@ -236,6 +257,7 @@ export default function ExplorePage() {
236257 { persona ? (
237258 < PersonaBadge
238259 imageSrc = { persona . imageSrc }
260+ alt = { mainAuthor }
239261 size = "sm"
240262 />
241263 ) : (
0 commit comments