@@ -46,16 +46,18 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
4646 } ,
4747
4848 statics : {
49- createMiniProfileView : function ( withSpacer = true ) {
49+ createMiniProfileView : function ( userData ) {
5050 const layout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 6 ) ) . set ( {
5151 alignX : "center" ,
5252 minWidth : 120 ,
5353 maxWidth : 150
5454 } ) ;
5555
56- const authData = osparc . auth . Data . getInstance ( ) ;
57- const username = authData . getUsername ( ) ;
58- const email = authData . getEmail ( ) ;
56+ if ( ! userData ) {
57+ userData = osparc . auth . Data . getInstance ( ) ;
58+ }
59+ const username = userData . getUsername ( ) ;
60+ const email = userData . getEmail ( ) ;
5961 const avatarSize = 80 ;
6062 const img = new qx . ui . basic . Image ( ) . set ( {
6163 source : osparc . utils . Avatar . emailToThumbnail ( email , username , avatarSize ) ,
@@ -73,33 +75,31 @@ qx.Class.define("osparc.desktop.account.MyAccount", {
7375 font : "text-14" ,
7476 alignX : "center"
7577 } ) ;
76- authData . bind ( "username" , usernameLabel , "value" ) ;
78+ userData . bind ( "username" , usernameLabel , "value" ) ;
7779 layout . add ( usernameLabel ) ;
7880
7981 const fullNameLabel = new qx . ui . basic . Label ( ) . set ( {
8082 font : "text-13" ,
8183 alignX : "center"
8284 } ) ;
8385 layout . add ( fullNameLabel ) ;
84- authData . bind ( "firstName" , fullNameLabel , "value" , {
85- converter : ( ) => authData . getFullName ( )
86+ userData . bind ( "firstName" , fullNameLabel , "value" , {
87+ converter : ( ) => userData . getFullName ( )
8688 } ) ;
87- authData . bind ( "lastName" , fullNameLabel , "value" , {
88- converter : ( ) => authData . getFullName ( )
89+ userData . bind ( "lastName" , fullNameLabel , "value" , {
90+ converter : ( ) => userData . getFullName ( )
8991 } ) ;
9092
91- if ( authData . getRole ( ) !== "user" ) {
92- const role = authData . getFriendlyRole ( ) ;
93+ if ( userData . getRole ( ) !== "user" ) {
94+ const role = userData . getFriendlyRole ( ) ;
9395 const roleLabel = new qx . ui . basic . Label ( role ) . set ( {
9496 font : "text-13" ,
9597 alignX : "center"
9698 } ) ;
9799 layout . add ( roleLabel ) ;
98100 }
99101
100- if ( withSpacer ) {
101- layout . add ( new qx . ui . core . Spacer ( 15 , 15 ) ) ;
102- }
102+ layout . add ( new qx . ui . core . Spacer ( 15 , 15 ) ) ;
103103
104104 return layout ;
105105 }
0 commit comments