@@ -12,15 +12,20 @@ import Stack from '@mui/material/Stack';
1212import List from '@mui/material/List' ;
1313import Link from '@mui/material/Link' ;
1414import IconButton from '@mui/material/IconButton' ;
15+ import { UserEntity } from '@backstage/catalog-model' ;
1516
16- import style from './securityCard.module.css' ;
17-
18- const KVSecurityChampionItem = ( { champion } : { champion : SecurityChamp } ) => {
17+ const KVSecurityChampionItem = ( {
18+ champion,
19+ selectedUser,
20+ } : {
21+ champion : SecurityChamp ;
22+ selectedUser ?: UserEntity | null ;
23+ } ) => {
1924 const { user, loading, error } = useUserProfile (
2025 champion . securityChampionEmail ! ,
2126 ) ;
2227
23- if ( loading && ! user )
28+ if ( loading && ! selectedUser )
2429 return (
2530 < Box sx = { { display : 'flex' } } >
2631 < CircularProgress />
@@ -32,13 +37,23 @@ const KVSecurityChampionItem = ({ champion }: { champion: SecurityChamp }) => {
3237 return (
3338 < ListItem >
3439 < ListItemAvatar >
35- < Avatar src = { user ?. spec . profile ?. picture } />
40+ < Avatar
41+ src = {
42+ user ?. spec . profile ?. picture || selectedUser ?. spec . profile ?. picture
43+ }
44+ />
3645 </ ListItemAvatar >
3746 < ListItemText
3847 primary = {
39- user ?. spec ?. profile ?. displayName || champion . securityChampionEmail
48+ user ?. spec ?. profile ?. displayName ||
49+ selectedUser ?. spec ?. profile ?. displayName ||
50+ champion . securityChampionEmail
51+ }
52+ secondary = {
53+ user ?. spec . profile ?. email ||
54+ selectedUser ?. spec . profile ?. email ||
55+ 'User not in catalog'
4056 }
41- secondary = { user ?. spec . profile ?. email || 'User not in catalog' }
4257 />
4358 </ ListItem >
4459 ) ;
@@ -61,15 +76,20 @@ const UnknownSecurityChampionItem = ({
6176export const SecurityChampionItem = ( {
6277 champion,
6378 repositories,
79+ selectedUser,
6480} : {
6581 champion : SecurityChamp ;
6682 repositories ?: string [ ] ;
83+ selectedUser ?: UserEntity | null ;
6784} ) => {
6885 return (
6986 < ListItem >
7087 < Stack className = { style . item } >
7188 { champion . securityChampionEmail && (
72- < KVSecurityChampionItem champion = { champion } />
89+ < KVSecurityChampionItem
90+ champion = { champion }
91+ selectedUser = { selectedUser }
92+ />
7393 ) }
7494 { ! champion . securityChampionEmail && (
7595 < UnknownSecurityChampionItem champion = { champion } />
0 commit comments