@@ -15,6 +15,9 @@ import { LoggingElement } from './Logging.js';
15
15
import { Plugin , PluggingElement , pluginIcons } from './Plugging.js' ;
16
16
import { SettingElement } from './Setting.js' ;
17
17
18
+ import { UserInfoEvent } from './foundation.js' ;
19
+ import { string } from 'fast-check' ;
20
+
18
21
interface MenuItem {
19
22
icon : string ;
20
23
name : string ;
@@ -49,6 +52,9 @@ export function Hosting<
49
52
@property ( { attribute : false } )
50
53
validated : Promise < unknown > = Promise . resolve ( ) ;
51
54
55
+ @property ( { type : string } )
56
+ username : string | undefined ;
57
+
52
58
@internalProperty ( )
53
59
statusNumber = 0 ;
54
60
@@ -200,6 +206,10 @@ export function Hosting<
200
206
] ;
201
207
}
202
208
209
+ private onUserInfo ( event : UserInfoEvent ) {
210
+ this . username = event . detail . name ;
211
+ }
212
+
203
213
constructor ( ...args : any [ ] ) {
204
214
super ( ...args ) ;
205
215
@@ -216,6 +226,8 @@ export function Hosting<
216
226
} )
217
227
) ;
218
228
} ) ;
229
+
230
+ this . addEventListener ( 'userinfo' , this . onUserInfo ) ;
219
231
}
220
232
221
233
renderMenuItem ( me : MenuItem | 'divider' ) : TemplateResult {
@@ -288,6 +300,9 @@ export function Hosting<
288
300
@click =${ ( ) => ( this . menuUI . open = true ) }
289
301
> </ mwc-icon-button >
290
302
< div slot ="title " id ="title "> ${ this . docName } </ div >
303
+ ${ this . username != undefined
304
+ ? html `< span id ="userField " slot ="actionItems "> ${ translate ( 'userinfo.loggedInAs' , { name : this . username } ) } </ span > `
305
+ : `` }
291
306
${ this . menu . map ( this . renderActionItem ) }
292
307
${ this . doc
293
308
? html `< mwc-tab-bar
0 commit comments