Skip to content

Commit c49669e

Browse files
committed
isClickAwayClose
1 parent 932ed74 commit c49669e

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

services/static-webserver/client/source/class/osparc/store/Support.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ qx.Class.define("osparc.store.Support", {
2222
addSupportConversationsToMenu: function(menu) {
2323
if (osparc.product.Utils.isSupportEnabled()) {
2424
const supportCenterButton = new qx.ui.menu.Button().set({
25-
label: qx.locale.Manager.tr("Ask a Question"),
2625
icon: "@FontAwesome5Regular/question-circle/16",
2726
});
2827
const amISupporter = () => {
29-
if (osparc.store.Products.getInstance().amIASupportUser()) {
30-
supportCenterButton.set({
31-
label: qx.locale.Manager.tr("Support Center"),
32-
});
33-
}
34-
}
28+
const isSupportUser = osparc.store.Products.getInstance().amIASupportUser();
29+
supportCenterButton.set({
30+
label: isSupportUser ? qx.locale.Manager.tr("Support Center") : qx.locale.Manager.tr("Ask a Question"),
31+
});
32+
};
3533
amISupporter();
3634
osparc.store.Groups.getInstance().addListener("organizationsChanged", () => amISupporter());
35+
supportCenterButton.addListener("execute", () => {
36+
osparc.support.SupportCenter.openWindow();
37+
});
3738
menu.add(supportCenterButton);
3839
}
3940
},

services/static-webserver/client/source/class/osparc/support/SupportCenter.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,57 @@ qx.Class.define("osparc.support.SupportCenter", {
1919
extend: osparc.ui.window.SingletonWindow,
2020

2121
construct: function() {
22-
this.base(arguments);
22+
this.base(arguments, "support-center");
23+
24+
this.getChildControl("captionbar").exclude();
2325

2426
this.set({
25-
layout: qx.ui.container.Stack,
27+
layout: new qx.ui.layout.VBox(10),
28+
contentPadding: 0,
29+
modal: true,
30+
clickAwayClose: true,
2631
});
2732

2833
this.getChildControl("intro-text");
2934
this.getChildControl("conversations-list");
3035
},
3136

3237
statics: {
38+
openWindow: function() {
39+
const supportCenterWindow = new osparc.support.SupportCenter();
40+
supportCenterWindow.center();
41+
supportCenterWindow.open();
42+
return supportCenterWindow;
43+
}
3344
},
3445

3546
members: {
3647
_createChildControlImpl: function(id) {
3748
let control;
3849
switch (id) {
50+
case "stack-layout":
51+
control = new qx.ui.container.Stack().set({
52+
padding: 10,
53+
});
54+
this._add(control);
55+
break;
3956
case "conversations-layout":
40-
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(10));
41-
this.add(control);
57+
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
58+
this.getChildControl("stack-layout").add(control);
59+
break;
4260
case "intro-text":
4361
control = new qx.ui.basic.Label(this.tr("Welcome to the Support Center"));
4462
this.getChildControl("conversations-layout").add(control);
4563
break;
46-
case "conversations-list":
47-
const control = new osparc.support.Conversations();
64+
case "conversations-list": {
65+
control = new osparc.support.Conversations().set({
66+
minHeight: 300,
67+
});
4868
const scroll = new qx.ui.container.Scroll();
4969
scroll.add(control);
5070
this.getChildControl("conversations-layout").add(scroll);
5171
break;
72+
}
5273
}
5374
return control || this.base(arguments, id);
5475
},

services/static-webserver/client/source/class/osparc/ui/window/Window.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ qx.Class.define("osparc.ui.window.Window", {
3636
);
3737
if (modalFrame) {
3838
modalFrame.addEventListener("click", () => {
39-
if (this.isModal() && this.isClickAwayClose() &&
40-
parseInt(modalFrame.style.zIndex) === parseInt(thisDom.style.zIndex) - 1) {
39+
if (
40+
// this.isModal() && // OM?
41+
this.isClickAwayClose() &&
42+
parseInt(modalFrame.style.zIndex) === parseInt(thisDom.style.zIndex) - 1
43+
) {
4144
this.close();
4245
}
4346
});

0 commit comments

Comments
 (0)