Skip to content

Commit 9f2822c

Browse files
committed
positionWindow
1 parent c49669e commit 9f2822c

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

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

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

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

2624
this.set({
2725
layout: new qx.ui.layout.VBox(10),
28-
contentPadding: 0,
29-
modal: true,
30-
clickAwayClose: true,
26+
width: osparc.support.SupportCenter.WINDOW_WIDTH,
27+
height: osparc.support.SupportCenter.getMaxHeight(),
28+
modal: false,
29+
showMaximize: false,
30+
showMinimize: false,
31+
showClose: true,
3132
});
3233

3334
this.getChildControl("intro-text");
3435
this.getChildControl("conversations-list");
3536
},
3637

3738
statics: {
39+
WINDOW_WIDTH: 400,
40+
41+
getMaxHeight: function() {
42+
// height: max 80% of screen, min 600
43+
const clientHeight = document.documentElement.clientHeight;
44+
return Math.max(600, parseInt(clientHeight * 0.8));
45+
},
46+
3847
openWindow: function() {
3948
const supportCenterWindow = new osparc.support.SupportCenter();
40-
supportCenterWindow.center();
49+
50+
const positionWindow = () => {
51+
supportCenterWindow.set({
52+
height: osparc.support.SupportCenter.getMaxHeight(),
53+
});
54+
// bottom right
55+
const clientWidth = document.documentElement.clientWidth;
56+
const clientHeight = document.documentElement.clientHeight;
57+
const posX = clientWidth - osparc.support.SupportCenter.WINDOW_WIDTH;
58+
const posY = clientHeight - supportCenterWindow.getHeight();
59+
supportCenterWindow.moveTo(posX, posY);
60+
};
4161
supportCenterWindow.open();
62+
63+
positionWindow();
64+
window.addEventListener("resize", positionWindow);
65+
4266
return supportCenterWindow;
4367
}
4468
},
@@ -48,10 +72,10 @@ qx.Class.define("osparc.support.SupportCenter", {
4872
let control;
4973
switch (id) {
5074
case "stack-layout":
51-
control = new qx.ui.container.Stack().set({
52-
padding: 10,
75+
control = new qx.ui.container.Stack();
76+
this._add(control, {
77+
flex: 1
5378
});
54-
this._add(control);
5579
break;
5680
case "conversations-layout":
5781
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
@@ -67,7 +91,9 @@ qx.Class.define("osparc.support.SupportCenter", {
6791
});
6892
const scroll = new qx.ui.container.Scroll();
6993
scroll.add(control);
70-
this.getChildControl("conversations-layout").add(scroll);
94+
this.getChildControl("conversations-layout").add(scroll, {
95+
flex: 1,
96+
});
7197
break;
7298
}
7399
}

0 commit comments

Comments
 (0)