@@ -3,6 +3,7 @@ import { config } from "../../stores/config";
33import { viewState , setSortPreference , setTabFilter , resetTabFilter , resetAllTabFilters , ignoreItem , unignoreItem , toggleExpandedRepo , setAllExpanded , pruneExpandedRepos , type IssueFilterField } from "../../stores/view" ;
44import type { Issue } from "../../services/api" ;
55import ItemRow from "./ItemRow" ;
6+ import UserAvatarBadge from "../shared/UserAvatarBadge" ;
67import IgnoreBadge from "./IgnoreBadge" ;
78import SortDropdown from "../shared/SortDropdown" ;
89import type { SortOption } from "../shared/SortDropdown" ;
@@ -20,6 +21,8 @@ export interface IssuesTabProps {
2021 issues : Issue [ ] ;
2122 loading ?: boolean ;
2223 userLogin : string ;
24+ allUsers ?: { login : string ; label : string } [ ] ;
25+ trackedUsers ?: { login : string ; avatarUrl : string ; name : string | null } [ ] ;
2326}
2427
2528type SortField = "repo" | "title" | "author" | "createdAt" | "updatedAt" | "comments" ;
@@ -55,6 +58,19 @@ const sortOptions: SortOption[] = [
5558export default function IssuesTab ( props : IssuesTabProps ) {
5659 const [ page , setPage ] = createSignal ( 0 ) ;
5760
61+ const filterGroups = createMemo < FilterChipGroupDef [ ] > ( ( ) => {
62+ const users = props . allUsers ;
63+ if ( ! users || users . length <= 1 ) return issueFilterGroups ;
64+ return [
65+ ...issueFilterGroups ,
66+ {
67+ label : "User" ,
68+ field : "user" ,
69+ options : users . map ( ( u ) => ( { value : u . login , label : u . label } ) ) ,
70+ } ,
71+ ] ;
72+ } ) ;
73+
5874 const sortPref = createMemo ( ( ) => {
5975 const pref = viewState . sortPreferences [ "issues" ] ;
6076 return pref ?? { field : "updatedAt" , direction : "desc" as const } ;
@@ -87,6 +103,11 @@ export default function IssuesTab(props: IssuesTabProps) {
87103 if ( tabFilter . comments === "none" && issue . comments > 0 ) return false ;
88104 }
89105
106+ if ( tabFilter . user !== "all" ) {
107+ const surfacedBy = issue . surfacedBy ?? [ props . userLogin ] ;
108+ if ( ! surfacedBy . includes ( tabFilter . user ) ) return false ;
109+ }
110+
90111 meta . set ( issue . id , { roles } ) ;
91112 return true ;
92113 } ) ;
@@ -172,7 +193,7 @@ export default function IssuesTab(props: IssuesTabProps) {
172193 onChange = { handleSort }
173194 />
174195 < FilterChips
175- groups = { issueFilterGroups }
196+ groups = { filterGroups ( ) }
176197 values = { viewState . tabFilters . issues }
177198 onChange = { ( field , value ) => {
178199 setTabFilter ( "issues" , field as IssueFilterField , value ) ;
@@ -291,6 +312,17 @@ export default function IssuesTab(props: IssuesTabProps) {
291312 onIgnore = { ( ) => handleIgnore ( issue ) }
292313 density = { config . viewDensity }
293314 commentCount = { issue . comments }
315+ surfacedByBadge = {
316+ props . trackedUsers && props . trackedUsers . length > 0
317+ ? < UserAvatarBadge
318+ users = { ( issue . surfacedBy ?? [ ] ) . flatMap ( ( login ) => {
319+ const u = props . trackedUsers ! . find ( ( t ) => t . login === login ) ;
320+ return u ? [ { login : u . login , avatarUrl : u . avatarUrl } ] : [ ] ;
321+ } ) }
322+ currentUserLogin = { props . userLogin }
323+ />
324+ : undefined
325+ }
294326 >
295327 < RoleBadge roles = { issueMeta ( ) . get ( issue . id ) ?. roles ?? [ ] } />
296328 </ ItemRow >
0 commit comments