Skip to content

Commit 296e40b

Browse files
committed
aesthetics
1 parent e95c9b9 commit 296e40b

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

services/static-webserver/client/source/class/osparc/conversation/NotificationUI.js

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ qx.Class.define("osparc.conversation.NotificationUI", {
2828
this.__message = message;
2929

3030
const isMyMessage = osparc.conversation.MessageUI.isMyMessage(this.__message);
31-
const layout = new qx.ui.layout.Grid(12, 4);
32-
layout.setColumnFlex(1, 1); // content
31+
const layout = new qx.ui.layout.Grid(4, 4);
3332
layout.setColumnFlex(isMyMessage ? 0 : 3, 3); // spacer
33+
layout.setRowAlign(0, "center", "middle");
3434
this._setLayout(layout);
3535
this.setPadding(5);
3636

@@ -40,7 +40,7 @@ qx.Class.define("osparc.conversation.NotificationUI", {
4040
members: {
4141
__message: null,
4242

43-
// spacer - content - date - (thumbnail-spacer)
43+
// spacer - date - content - (thumbnail-spacer)
4444
// (thumbnail-spacer) - content - date - spacer
4545
_createChildControlImpl: function(id) {
4646
const isMyMessage = osparc.conversation.MessageUI.isMyMessage(this.__message);
@@ -56,20 +56,14 @@ qx.Class.define("osparc.conversation.NotificationUI", {
5656
});
5757
break;
5858
case "message-content":
59-
control = new osparc.ui.markdown.Markdown().set({
60-
decorator: "rounded",
61-
noMargin: true,
62-
paddingLeft: 8,
63-
paddingRight: 8,
64-
minWidth: 200,
65-
width: 200,
59+
control = new qx.ui.basic.Label().set({
6660
});
6761
control.getContentElement().setStyles({
6862
"text-align": isMyMessage ? "right" : "left",
6963
});
7064
this._add(control, {
7165
row: 0,
72-
column: 1,
66+
column: isMyMessage ? 2 : 1,
7367
});
7468
break;
7569
case "last-updated":
@@ -78,7 +72,7 @@ qx.Class.define("osparc.conversation.NotificationUI", {
7872
});
7973
this._add(control, {
8074
row: 0,
81-
column: 2,
75+
column: isMyMessage ? 1 : 2,
8276
});
8377
break;
8478
case "spacer":
@@ -96,28 +90,37 @@ qx.Class.define("osparc.conversation.NotificationUI", {
9690
__buildLayout: function() {
9791
this.getChildControl("thumbnail-spacer");
9892

99-
const date = new Date(this.__message["modified"]);
100-
const date2 = osparc.utils.Utils.formatDateAndTime(date);
93+
const isMyMessage = osparc.conversation.MessageUI.isMyMessage(this.__message);
94+
95+
const modifiedDate = new Date(this.__message["modified"]);
96+
const date = osparc.utils.Utils.formatDateAndTime(modifiedDate);
10197
const lastUpdate = this.getChildControl("last-updated");
102-
lastUpdate.setValue(date2);
98+
lastUpdate.setValue(isMyMessage ? date + " -" : " - " + date);
10399

104100
const messageContent = this.getChildControl("message-content");
101+
const notifierUserGroupId = parseInt(this.__message["userGroupId"]);
105102
const notifiedUserGroupId = parseInt(this.__message["content"]);
106103
let msgContent = "🔔 ";
107104
Promise.all([
108-
osparc.store.Users.getInstance().getUser(this.__message["userGroupId"]),
105+
osparc.store.Users.getInstance().getUser(notifierUserGroupId),
109106
osparc.store.Users.getInstance().getUser(notifiedUserGroupId),
110107
])
111108
.then(values => {
112109
const notifierUser = values[0];
113-
const notifiedUser = values[1];
114-
if (notifierUser) {
110+
if (isMyMessage) {
111+
msgContent += "You";
112+
} else if (notifierUser) {
115113
msgContent += notifierUser.getLabel();
116114
} else {
117115
msgContent += "unknown user";
118116
}
117+
119118
msgContent += " notified ";
120-
if (notifiedUser) {
119+
120+
const notifiedUser = values[1];
121+
if (osparc.auth.Data.getInstance().getGroupId() === notifiedUserGroupId) {
122+
msgContent += "You";
123+
} else if (notifiedUser) {
121124
msgContent += notifiedUser.getLabel();
122125
} else {
123126
msgContent += "unknown user";

0 commit comments

Comments
 (0)