@@ -21,6 +21,7 @@ import {
2121 SidebarToggle ,
2222} from "@/components/layout/SidebarSearch" ;
2323import { useSearchStore , useSidebarState } from "@/stores" ;
24+ import { usePreferencesStore } from "@/stores/preferences" ;
2425import { SearchModal } from "@/components/search/SearchModal" ;
2526import { githubAPIClient } from "@/lib/api/github-api-client" ;
2627import {
@@ -86,6 +87,8 @@ function SearchContent() {
8687 const repoParam = searchParams ?. get ( "repo" ) ;
8788 const { setCurrentQuery, setCurrentSearchType, setSearchModalOpen } =
8889 useSearchStore ( ) ;
90+ const { pinnedRepos, favoriteUsers, togglePinnedRepo, toggleFavoriteUser } =
91+ usePreferencesStore ( ) ;
8992
9093 const [ searchResults , setSearchResults ] = useState < {
9194 repos : TrendingRepo [ ] ;
@@ -378,16 +381,40 @@ function SearchContent() {
378381 </ p >
379382 ) }
380383 </ div >
381- < Button asChild >
382- < a
383- href = { userAnalytics . profile . html_url }
384- target = "_blank"
385- rel = "noopener noreferrer"
384+ < div className = "flex gap-2" >
385+ < Button
386+ variant = {
387+ favoriteUsers . includes ( userAnalytics . profile ! . login )
388+ ? "default"
389+ : "outline"
390+ }
391+ size = "sm"
392+ onClick = { ( ) =>
393+ toggleFavoriteUser ( userAnalytics . profile ! . login )
394+ }
386395 >
387- < ExternalLink className = "w-4 h-4 mr-2" />
388- View Profile
389- </ a >
390- </ Button >
396+ < Star
397+ className = { `w-4 h-4 mr-2 ${
398+ favoriteUsers . includes ( userAnalytics . profile ! . login )
399+ ? "fill-current"
400+ : ""
401+ } `}
402+ />
403+ { favoriteUsers . includes ( userAnalytics . profile ! . login )
404+ ? "Favorited"
405+ : "Add Favorite" }
406+ </ Button >
407+ < Button asChild >
408+ < a
409+ href = { userAnalytics . profile . html_url }
410+ target = "_blank"
411+ rel = "noopener noreferrer"
412+ >
413+ < ExternalLink className = "w-4 h-4 mr-2" />
414+ View Profile
415+ </ a >
416+ </ Button >
417+ </ div >
391418 </ div >
392419 </ CardContent >
393420 </ Card >
@@ -424,16 +451,38 @@ function SearchContent() {
424451 < span > Followers: { user . followers_count } </ span >
425452 </ div >
426453 </ div >
427- < Button asChild >
428- < a
429- href = { user . html_url }
430- target = "_blank"
431- rel = "noopener noreferrer"
454+ < div className = "flex gap-2" >
455+ < Button
456+ variant = {
457+ favoriteUsers . includes ( user . login )
458+ ? "default"
459+ : "outline"
460+ }
461+ size = "sm"
462+ onClick = { ( ) => toggleFavoriteUser ( user . login ) }
432463 >
433- < ExternalLink className = "w-4 h-4 mr-2" />
434- View Profile
435- </ a >
436- </ Button >
464+ < Star
465+ className = { `w-4 h-4 mr-2 ${
466+ favoriteUsers . includes ( user . login )
467+ ? "fill-current"
468+ : ""
469+ } `}
470+ />
471+ { favoriteUsers . includes ( user . login )
472+ ? "Favorited"
473+ : "Add Favorite" }
474+ </ Button >
475+ < Button asChild >
476+ < a
477+ href = { user . html_url }
478+ target = "_blank"
479+ rel = "noopener noreferrer"
480+ >
481+ < ExternalLink className = "w-4 h-4 mr-2" />
482+ View Profile
483+ </ a >
484+ </ Button >
485+ </ div >
437486 </ div >
438487 </ CardContent >
439488 </ Card >
@@ -927,16 +976,38 @@ function SearchContent() {
927976 </ span >
928977 </ div >
929978 </ div >
930- < Button asChild >
931- < a
932- href = { repo . html_url }
933- target = "_blank"
934- rel = "noopener noreferrer"
979+ < div className = "flex gap-2" >
980+ < Button
981+ variant = {
982+ pinnedRepos . includes ( repo . full_name )
983+ ? "default"
984+ : "outline"
985+ }
986+ size = "sm"
987+ onClick = { ( ) => togglePinnedRepo ( repo . full_name ) }
935988 >
936- < ExternalLink className = "w-4 h-4 mr-2" />
937- View Repo
938- </ a >
939- </ Button >
989+ < Star
990+ className = { `w-4 h-4 mr-2 ${
991+ pinnedRepos . includes ( repo . full_name )
992+ ? "fill-current"
993+ : ""
994+ } `}
995+ />
996+ { pinnedRepos . includes ( repo . full_name )
997+ ? "Pinned"
998+ : "Pin Repo" }
999+ </ Button >
1000+ < Button asChild >
1001+ < a
1002+ href = { repo . html_url }
1003+ target = "_blank"
1004+ rel = "noopener noreferrer"
1005+ >
1006+ < ExternalLink className = "w-4 h-4 mr-2" />
1007+ View Repo
1008+ </ a >
1009+ </ Button >
1010+ </ div >
9401011 </ div >
9411012 </ CardContent >
9421013 </ Card >
0 commit comments