Skip to content

Commit 4438f29

Browse files
committed
comment layout
1 parent 030dfde commit 4438f29

File tree

1 file changed

+38
-28
lines changed
  • services/static-webserver/client/source/class/osparc/info

1 file changed

+38
-28
lines changed

services/static-webserver/client/source/class/osparc/info/CommentUI.js

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ qx.Class.define("osparc.info.CommentUI", {
2828
this.__comment = comment;
2929

3030
const isMyComment = this.__isMyComment();
31-
const layout = new qx.ui.layout.Grid(12, 5);
32-
layout.setColumnFlex(isMyComment ? 0 : 1, 1); // message content
31+
const layout = new qx.ui.layout.Grid(12, 4);
32+
layout.setColumnFlex(1, 1); // comment
33+
layout.setColumnFlex(isMyComment ? 0 : 2, 2); // spacer
3334
this._setLayout(layout);
3435
this.setPadding(5);
3536

@@ -46,56 +47,63 @@ qx.Class.define("osparc.info.CommentUI", {
4647
_createChildControlImpl: function(id) {
4748
let control;
4849
switch (id) {
49-
case "meta-data-grid": {
50-
const layout = new qx.ui.layout.Grid(12, 5)
51-
layout.setColumnWidth(this.__isMyComment() ? 1 : 0, 32); // thumbnail
52-
control = new qx.ui.container.Composite(layout);
53-
this._add(control, {
54-
row: 0,
55-
column: this.__isMyComment() ? 1 : 0
56-
});
57-
break;
58-
}
5950
case "thumbnail":
6051
control = new qx.ui.basic.Image().set({
6152
scale: true,
6253
maxWidth: 32,
6354
maxHeight: 32,
6455
decorator: "rounded",
65-
marginTop: 4,
56+
marginTop: 2,
6657
});
67-
this.getChildControl("meta-data-grid").add(control, {
58+
this._add(control, {
6859
row: 0,
69-
column: this.__isMyComment() ? 1 : 0,
70-
rowSpan: 2
60+
column: this.__isMyComment() ? 2 : 0,
61+
rowSpan: 2,
62+
});
63+
break;
64+
case "header-layout":
65+
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5).set({
66+
alignX: this.__isMyComment() ? "right" : "left"
67+
}));
68+
this._add(control, {
69+
row: 0,
70+
column: 1
7171
});
7272
break;
7373
case "user-name":
7474
control = new qx.ui.basic.Label().set({
7575
font: "text-12"
7676
});
77-
this.getChildControl("meta-data-grid").add(control, {
78-
row: 0,
79-
column: this.__isMyComment() ? 0 : 1
80-
});
77+
this.getChildControl("header-layout").addAt(control, 0);
8178
break;
8279
case "last-updated":
8380
control = new qx.ui.basic.Label().set({
8481
font: "text-12"
8582
});
86-
this.getChildControl("meta-data-grid").add(control, {
87-
row: 1,
88-
column: this.__isMyComment() ? 0 : 1
89-
});
83+
this.getChildControl("header-layout").addAt(control, 1);
9084
break;
9185
case "comment-content":
92-
control = new osparc.ui.markdown.Markdown();
86+
control = new osparc.ui.markdown.Markdown().set({
87+
backgroundColor: "background-main-2",
88+
decorator: "rounded",
89+
noMargin: true,
90+
paddingLeft: 8,
91+
paddingRight: 8,
92+
allowGrowX: true,
93+
});
9394
control.getContentElement().setStyles({
94-
"text-align": this.__isMyComment() ? "right" : "left"
95+
"text-align": this.__isMyComment() ? "right" : "left",
9596
});
9697
this._add(control, {
97-
row: 0,
98-
column: this.__isMyComment() ? 0 : 1,
98+
row: 1,
99+
column: 1,
100+
});
101+
break;
102+
case "spacer":
103+
control = new qx.ui.core.Spacer();
104+
this._add(control, {
105+
row: 1,
106+
column: this.__isMyComment() ? 0 : 2,
99107
});
100108
break;
101109
}
@@ -123,6 +131,8 @@ qx.Class.define("osparc.info.CommentUI", {
123131
thumbnail.setSource(user.getThumbnail());
124132
userName.setValue(user.getLabel());
125133
}
134+
135+
this.getChildControl("spacer");
126136
}
127137
}
128138
});

0 commit comments

Comments
 (0)