@@ -30,7 +30,7 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", {
3030 } ,
3131
3232 statics : {
33- createLoginAnnouncement : function ( title , text ) {
33+ createLoginAnnouncement : function ( title , description ) {
3434 const loginAnnouncement = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) ) . set ( {
3535 backgroundColor : "strong-main" ,
3636 alignX : "center" ,
@@ -46,22 +46,20 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", {
4646 const titleLabel = new qx . ui . basic . Label ( ) . set ( {
4747 value : title ,
4848 font : "text-16" ,
49- textColor : "white" ,
5049 alignX : "center" ,
51- rich : true ,
52- wrap : true
50+ textAlign : "center" ,
51+ rich : true
5352 } ) ;
5453 loginAnnouncement . add ( titleLabel ) ;
5554 }
5655
57- if ( text ) {
56+ if ( description ) {
5857 const descriptionLabel = new qx . ui . basic . Label ( ) . set ( {
59- value : text ,
58+ value : description ,
6059 font : "text-14" ,
61- textColor : "white" ,
6260 alignX : "center" ,
63- rich : true ,
64- wrap : true
61+ textAlign : "center" ,
62+ rich : true
6563 } ) ;
6664 loginAnnouncement . add ( descriptionLabel ) ;
6765 }
@@ -75,16 +73,12 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", {
7573
7674 __isValid : function ( widgetType ) {
7775 const announcement = this . getAnnouncement ( ) ;
78-
79- const now = new Date ( ) ;
80- if (
81- announcement &&
82- announcement . getProducts ( ) . includes ( osparc . product . Utils . getProductName ( ) ) &&
83- announcement . getWidgets ( ) . includes ( widgetType ) &&
84- now > announcement . getStart ( ) &&
85- now < announcement . getEnd ( )
86- ) {
87- return true ;
76+ if ( announcement ) {
77+ const now = new Date ( ) ;
78+ const validPeriod = now > announcement . getStart ( ) && now < announcement . getEnd ( ) ;
79+ const validProduct = announcement . getProducts ( ) . includes ( osparc . product . Utils . getProductName ( ) ) ;
80+ const validWidgetType = widgetType ? announcement . getWidgets ( ) . includes ( widgetType ) : true ;
81+ return validPeriod && validProduct && validWidgetType ;
8882 }
8983 return false ;
9084 } ,
@@ -124,8 +118,10 @@ qx.Class.define("osparc.announcement.AnnouncementUIFactory", {
124118 return ;
125119 }
126120
127- let text = announcement . getTitle ( ) + ": " ;
128- text += announcement . getDescription ( ) ;
121+ let text = announcement . getTitle ( ) ;
122+ if ( announcement . getDescription ( ) ) {
123+ text += ": " + announcement . getDescription ( ) ;
124+ }
129125
130126 const ribbonAnnouncement = this . __ribbonAnnouncement = new osparc . notification . RibbonNotification ( text , "announcement" , true ) ;
131127 ribbonAnnouncement . announcementId = announcement . getId ( ) ;
0 commit comments