1- // @ts -nocheck
21
32
43/**
109 */
1110import { useState , useEffect } from 'react' ;
1211import { BookOpen , Landmark , Building2 , Mountain , Globe , AlertTriangle , MapPin } from 'lucide-react' ;
12+ import type { LucideIcon } from 'lucide-react' ;
13+
14+ interface Story {
15+ id : number ;
16+ name : string ;
17+ category : string ;
18+ location : string ;
19+ title : string ;
20+ summary : string ;
21+ fullStory : string ;
22+ quote : string ;
23+ year : number ;
24+ verified : boolean ;
25+ sources : string [ ] ;
26+ }
27+
28+ interface Category {
29+ id : string ;
30+ name : string ;
31+ Icon ?: LucideIcon ;
32+ icon ?: string ;
33+ }
1334
1435const VictimStories = ( ) => {
15- const [ selectedStory , setSelectedStory ] = useState ( null ) ;
36+ const [ selectedStory , setSelectedStory ] = useState < Story | null > ( null ) ;
1637 const [ selectedCategory , setSelectedCategory ] = useState ( 'all' ) ;
1738
1839 useEffect ( ( ) => {
19- const handleEscape = ( e ) => { if ( e . key === 'Escape' ) setSelectedStory ( null ) ; } ;
40+ const handleEscape = ( e : KeyboardEvent ) => { if ( e . key === 'Escape' ) setSelectedStory ( null ) ; } ;
2041 if ( selectedStory ) document . addEventListener ( 'keydown' , handleEscape ) ;
2142 return ( ) => document . removeEventListener ( 'keydown' , handleEscape ) ;
2243 } , [ selectedStory ] ) ;
2344
24- const stories = [
45+ const stories : Story [ ] = [
2546 {
2647 id : 1 ,
2748 name : 'Mihrigul Tursun' ,
@@ -176,7 +197,7 @@ He has taught at universities in Taiwan and continues to advocate for democracy
176197 }
177198 ] ;
178199
179- const categories = [
200+ const categories : Category [ ] = [
180201 { id : 'all' , name : 'All Stories' , Icon : BookOpen } ,
181202 { id : 'uyghur' , name : 'Uyghur' , Icon : Landmark } ,
182203 { id : 'hongkong' , name : 'Hong Kong' , Icon : Building2 } ,
@@ -189,7 +210,7 @@ He has taught at universities in Taiwan and continues to advocate for democracy
189210 ? stories
190211 : stories . filter ( s => s . category === selectedCategory ) ;
191212
192- const getCategoryInfo = ( category ) => {
213+ const getCategoryInfo = ( category : string ) : Category => {
193214 const cat = categories . find ( c => c . id === category ) ;
194215 return cat || categories [ 0 ] ;
195216 } ;
@@ -304,7 +325,7 @@ He has taught at universities in Taiwan and continues to advocate for democracy
304325
305326 { /* Full Story */ }
306327 < div className = "prose prose-invert max-w-none mb-6" >
307- { selectedStory . fullStory . split ( '\n\n' ) . map ( ( paragraph , i ) => (
328+ { selectedStory . fullStory . split ( '\n\n' ) . map ( ( paragraph : string , i : number ) => (
308329 < p key = { i } className = "text-slate-300 mb-4" > { paragraph } </ p >
309330 ) ) }
310331 </ div >
@@ -313,7 +334,7 @@ He has taught at universities in Taiwan and continues to advocate for democracy
313334 < div className = "bg-[#0a0e14]/50 p-4" >
314335 < h4 className = "text-sm font-semibold text-slate-400 mb-2" > Sources</ h4 >
315336 < div className = "flex flex-wrap gap-2" >
316- { selectedStory . sources . map ( ( source , i ) => (
337+ { selectedStory . sources . map ( ( source : string , i : number ) => (
317338 < span key = { i } className = "bg-[#111820] text-slate-300 text-xs px-2 py-1 rounded" >
318339 { source }
319340 </ span >
0 commit comments