11import { useState , useMemo } from "react" ;
2- import { publications , type Tag } from "@/data/publications" ;
2+ import { publications } from "@/data/publications" ;
33import { Search , ExternalLink } from "lucide-react" ;
44import NavBar from "@/components/NavBar" ;
55
6- const ALL_TAGS : Tag [ ] = [ "human" , "ai systems" , "privacy" , "security" , "trust" ] ;
7-
86const Research = ( ) => {
97 const [ query , setQuery ] = useState ( "" ) ;
10- const [ activeTags , setActiveTags ] = useState < Set < Tag > > ( new Set ( ) ) ;
11-
12- const toggleTag = ( tag : Tag ) => {
13- setActiveTags ( ( prev ) => {
14- const next = new Set ( prev ) ;
15- if ( next . has ( tag ) ) next . delete ( tag ) ;
16- else next . add ( tag ) ;
17- return next ;
18- } ) ;
19- } ;
208
219 const filtered = useMemo ( ( ) => {
2210 let result = publications ;
@@ -30,35 +18,15 @@ const Research = () => {
3018 String ( p . year ) . includes ( q )
3119 ) ;
3220 }
33- if ( activeTags . size > 0 ) {
34- result = result . filter (
35- ( p ) => p . tags && p . tags . some ( ( t ) => activeTags . has ( t ) )
36- ) ;
37- }
3821 return result ;
39- } , [ query , activeTags ] ) ;
22+ } , [ query ] ) ;
4023
4124 return (
4225 < div className = "light-research min-h-screen bg-background text-foreground" >
4326 { /* header */ }
4427 < header className = "sticky top-0 z-20 bg-background/95 backdrop-blur-sm" >
45- < div className = "mx-auto max-w-[1200px] px-8 py-5 flex items-center justify-between " >
28+ < div className = "mx-auto max-w-[1200px] px-8 py-5 flex items-center justify-end " >
4629 < NavBar variant = "light" />
47- < nav className = "flex items-center gap-6" >
48- { ALL_TAGS . map ( ( tag ) => (
49- < button
50- key = { tag }
51- onClick = { ( ) => toggleTag ( tag ) }
52- className = { `text-sm capitalize transition-colors ${
53- activeTags . has ( tag )
54- ? "text-foreground font-medium underline underline-offset-4 decoration-2"
55- : "text-muted-foreground hover:text-foreground"
56- } `}
57- >
58- { tag }
59- </ button >
60- ) ) }
61- </ nav >
6230 </ div >
6331 </ header >
6432
0 commit comments