@@ -42,13 +42,15 @@ function LoadMoreTrigger({
42
42
43
43
interface ContextItemProps {
44
44
context : Context
45
+ currentUserUsername : string | null
45
46
defaultOrgUsername : string | null
46
47
setToggle : ( arg : boolean ) => void
47
48
owner ?: string | null
48
49
}
49
50
50
51
function ContextItem ( {
51
52
context,
53
+ currentUserUsername,
52
54
defaultOrgUsername,
53
55
setToggle,
54
56
owner,
@@ -76,7 +78,9 @@ function ContextItem({
76
78
>
77
79
< Avatar user = { contextOwner } />
78
80
< div className = { cs ( 'mx-1' , { 'font-semibold' : owner === orgUsername } ) } >
79
- { orgUsername }
81
+ { ! ! orgUsername && orgUsername === currentUserUsername
82
+ ? `${ orgUsername } 's personal organization`
83
+ : orgUsername || '' }
80
84
</ div >
81
85
</ Button >
82
86
</ li >
@@ -141,6 +145,8 @@ export interface Props {
141
145
contexts : Context [ ]
142
146
currentUser : {
143
147
defaultOrgUsername : string | null
148
+ username : string | null
149
+ avatarUrl : string
144
150
}
145
151
activeContext : ReturnType < typeof useOwner > [ 'data' ]
146
152
onLoadMore ?: ( ) => void
@@ -165,6 +171,7 @@ function ContextSwitcher({
165
171
const wrapperRef = useCloseOnLooseFocus ( { setToggle } )
166
172
const intersectionRef = useLoadMore ( { onLoadMore } )
167
173
const defaultOrgUsername = currentUser ?. defaultOrgUsername
174
+ const currentUserUsername = currentUser ?. username
168
175
169
176
const isGh = providerToName ( provider ) === 'GitHub'
170
177
const isSelfHosted = config . IS_SELF_HOSTED
@@ -173,6 +180,7 @@ function ContextSwitcher({
173
180
// self-hosted cannot use default "codecov" app (must set up custom one)
174
181
const shouldShowGitHubInstallLink =
175
182
isGh && ( isSelfHosted ? isCustomGitHubApp : true )
183
+ const displayUsername = activeContext ?. username ?? owner
176
184
177
185
return (
178
186
< div id = "context-switcher" className = "relative text-sm" ref = { wrapperRef } >
@@ -189,7 +197,12 @@ function ContextSwitcher({
189
197
onClick = { ( ) => setToggle ( ( toggle ) => ! toggle ) }
190
198
>
191
199
< Avatar user = { activeContext } />
192
- < p className = "ml-1" > { activeContext ?. username ?? owner } </ p >
200
+ < p className = "ml-1" >
201
+ { displayUsername }
202
+ { displayUsername === currentUserUsername
203
+ ? "'s personal organization"
204
+ : '' }
205
+ </ p >
193
206
< span
194
207
aria-hidden = "true"
195
208
className = { cs ( 'transition-transform' , {
@@ -226,12 +239,13 @@ function ContextSwitcher({
226
239
hook = "context-switcher-gh-install-link"
227
240
>
228
241
< Icon name = "plusCircle" />
229
- Install Codecov GitHub app
242
+ To add another organization, install Codecov GitHub App
230
243
</ A >
231
244
</ li >
232
245
) : null }
233
246
{ contexts . map ( ( context ) => (
234
247
< ContextItem
248
+ currentUserUsername = { currentUserUsername }
235
249
defaultOrgUsername = { defaultOrgUsername }
236
250
context = { context }
237
251
key = { context ?. owner ?. username }
0 commit comments