@@ -15,7 +15,7 @@ import { useProfile } from 'hooks/api/getters/useProfile/useProfile';
15
15
import { useLocationSettings } from 'hooks/useLocationSettings' ;
16
16
import type { IUser } from 'interfaces/user' ;
17
17
import TopicOutlinedIcon from '@mui/icons-material/TopicOutlined' ;
18
- import { useNavigate } from 'react-router-dom' ;
18
+ import { Link , useNavigate } from 'react-router-dom' ;
19
19
import { PageContent } from 'component/common/PageContent/PageContent' ;
20
20
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender' ;
21
21
import { RoleBadge } from 'component/common/RoleBadge/RoleBadge' ;
@@ -56,14 +56,19 @@ const StyledSectionLabel = styled(Typography)(({ theme }) => ({
56
56
const StyledAccess = styled ( 'div' ) ( ( { theme } ) => ( {
57
57
display : 'flex' ,
58
58
flexDirection : 'row' ,
59
+ gap : theme . spacing ( 2 ) ,
59
60
'& > div > p' : {
60
61
marginBottom : theme . spacing ( 1.5 ) ,
61
62
} ,
62
63
} ) ) ;
63
64
64
- const StyledBadge = styled ( Badge ) ( ( { theme } ) => ( {
65
- cursor : 'pointer' ,
66
- marginRight : theme . spacing ( 1 ) ,
65
+ const StyledBadgeLink = styled ( Link ) ( ( { theme } ) => ( {
66
+ ':hover,:focus-visible' : {
67
+ outline : 'none' ,
68
+ '> *' : {
69
+ outline : `2px solid ${ theme . palette . primary . main } ` ,
70
+ } ,
71
+ } ,
67
72
} ) ) ;
68
73
69
74
const StyledDivider = styled ( 'div' ) ( ( { theme } ) => ( {
@@ -86,6 +91,14 @@ interface IProfileTabProps {
86
91
user : IUser ;
87
92
}
88
93
94
+ const ProjectList = styled ( 'ul' ) ( ( { theme } ) => ( {
95
+ listStyle : 'none' ,
96
+ padding : 0 ,
97
+ display : 'flex' ,
98
+ flexFlow : 'row wrap' ,
99
+ gap : theme . spacing ( 1 ) ,
100
+ } ) ) ;
101
+
89
102
export const ProfileTab = ( { user } : IProfileTabProps ) => {
90
103
const { profile, refetchProfile } = useProfile ( ) ;
91
104
const navigate = useNavigate ( ) ;
@@ -158,33 +171,40 @@ export const ProfileTab = ({ user }: IProfileTabProps) => {
158
171
< Typography variant = 'body2' > Projects</ Typography >
159
172
< ConditionallyRender
160
173
condition = { Boolean ( profile ?. projects . length ) }
161
- show = { profile ?. projects . map ( ( project ) => (
162
- < Tooltip
163
- key = { project }
164
- title = 'View project'
165
- arrow
166
- placement = 'bottom-end'
167
- describeChild
168
- >
169
- < StyledBadge
170
- onClick = { ( e ) => {
171
- e . preventDefault ( ) ;
172
- navigate ( `/projects/${ project } ` ) ;
173
- } }
174
- color = 'secondary'
175
- icon = { < TopicOutlinedIcon /> }
176
- >
177
- { project }
178
- </ StyledBadge >
179
- </ Tooltip >
180
- ) ) }
174
+ show = {
175
+ < ProjectList >
176
+ { profile ?. projects . map ( ( project ) => (
177
+ < li key = { project } >
178
+ < Tooltip
179
+ title = 'View project'
180
+ arrow
181
+ placement = 'bottom-end'
182
+ describeChild
183
+ >
184
+ < StyledBadgeLink
185
+ to = { `/projects/${ project } ` }
186
+ >
187
+ < Badge
188
+ color = 'secondary'
189
+ icon = {
190
+ < TopicOutlinedIcon />
191
+ }
192
+ >
193
+ { project }
194
+ </ Badge >
195
+ </ StyledBadgeLink >
196
+ </ Tooltip >
197
+ </ li >
198
+ ) ) }
199
+ </ ProjectList >
200
+ }
181
201
elseShow = {
182
202
< Tooltip
183
203
title = 'You are not assigned to any projects'
184
204
arrow
185
205
describeChild
186
206
>
187
- < Badge > No projects</ Badge >
207
+ < Badge tabIndex = { 0 } > No projects</ Badge >
188
208
</ Tooltip >
189
209
}
190
210
/>
0 commit comments