Skip to content

Commit 789d99d

Browse files
committed
tap on conversation
1 parent 450ca4a commit 789d99d

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,22 @@ qx.Class.define("osparc.support.Conversation", {
2727

2828
this.__messages = [];
2929

30-
if (conversationId) {
31-
this.setConversationId(conversationId);
32-
}
33-
3430
this._setLayout(new qx.ui.layout.VBox(5));
3531

3632
this.__buildLayout();
3733

38-
this.__reloadMessages();
34+
if (conversationId) {
35+
this.setConversationId(conversationId);
36+
}
3937
},
4038

4139
properties: {
4240
conversationId: {
4341
check: "String",
4442
init: null,
4543
nullable: true,
46-
event: "changeConversationId"
44+
event: "changeConversationId",
45+
apply: "__applyConversationId",
4746
},
4847
},
4948

@@ -84,6 +83,10 @@ qx.Class.define("osparc.support.Conversation", {
8483
this._add(addMessages);
8584
},
8685

86+
__applyConversationId: function(value) {
87+
this.__reloadMessages(true);
88+
},
89+
8790
__getNextRequest: function() {
8891
const params = {
8992
url: {
@@ -100,7 +103,7 @@ qx.Class.define("osparc.support.Conversation", {
100103
const options = {
101104
resolveWResponse: true
102105
};
103-
return osparc.data.Resources.fetch("conversationsStudies", "getMessagesPage", params, options)
106+
return osparc.data.Resources.fetch("conversationsSupport", "getMessagesPage", params, options)
104107
.catch(err => osparc.FlashMessenger.logError(err));
105108
},
106109

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ qx.Class.define("osparc.support.ConversationListItem", {
2323

2424
const layout = this._getLayout();
2525
layout.setSpacingX(10);
26-
layout.setSpacingY(10);
27-
layout.setColumnFlex(this.self().GRID_POS.ICON, 0);
26+
layout.setSpacingY(4);
27+
28+
this.setMinHeight(32);
2829
},
2930

3031
properties: {
@@ -42,8 +43,8 @@ qx.Class.define("osparc.support.ConversationListItem", {
4243
osparc.store.ConversationsSupport.getInstance().getLastMessage(conversationId)
4344
.then(lastMessages => {
4445
if (lastMessages && lastMessages.length) {
45-
this.getChildControl("thumbnail").set({
46-
decorator: "rounded",
46+
this.getChildControl("thumbnail").getContentElement().setStyles({
47+
"border-radius": "16px"
4748
});
4849
const lastMessage = lastMessages[0];
4950
const date = osparc.utils.Utils.formatDateAndTime(new Date(lastMessage.created));

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ qx.Class.define("osparc.support.Conversations", {
2222
construct: function(openConversationId = null) {
2323
this.base(arguments);
2424

25-
this._setLayout(new qx.ui.layout.VBox(5));
25+
this._setLayout(new qx.ui.layout.VBox(10));
2626

2727
this.__conversationListItems = [];
2828
this.__openConversationId = openConversationId;
@@ -46,6 +46,10 @@ qx.Class.define("osparc.support.Conversations", {
4646
},
4747
},
4848

49+
events: {
50+
"openConversation": "qx.event.type.Data",
51+
},
52+
4953
members: {
5054
__conversationListItems: null,
5155
__openConversationId: null,
@@ -59,7 +63,7 @@ qx.Class.define("osparc.support.Conversations", {
5963
this._add(control);
6064
break;
6165
case "conversations-layout":
62-
control = new qx.ui.container.Composite(new qx.ui.layout.VBox());
66+
control = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
6367
this._add(control, {
6468
flex: 1
6569
});
@@ -167,6 +171,7 @@ qx.Class.define("osparc.support.Conversations", {
167171

168172
const conversationListItem = new osparc.support.ConversationListItem();
169173
conversationListItem.setConversationId(conversationData["conversationId"]);
174+
conversationListItem.addListener("tap", () => this.fireDataEvent("openConversation", conversationData["conversationId"]), this);
170175

171176
const conversationsLayout = this.getChildControl("conversations-layout");
172177
conversationsLayout.add(conversationListItem);

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ qx.Class.define("osparc.support.SupportCenter", {
9797
break;
9898
case "conversations-list": {
9999
control = new osparc.support.Conversations();
100+
control.addListener("openConversation", e => {
101+
const conversationId = e.getData();
102+
this.__openConversation(conversationId);
103+
}, this);
100104
const scroll = new qx.ui.container.Scroll();
101105
scroll.add(control);
102106
this.getChildControl("conversations-layout").add(scroll, {
@@ -150,16 +154,19 @@ qx.Class.define("osparc.support.SupportCenter", {
150154
},
151155

152156
__openConversation: function(conversationId) {
153-
const conversationContent = this.getChildControl("conversation-content");
154-
if (conversationId) {
157+
const openConversation = conversationId => {
158+
this.getChildControl("conversation-back-button");
159+
const conversationContent = this.getChildControl("conversation-content");
155160
conversationContent.setConversationId(conversationId);
156161
this.__showConversation();
162+
}
163+
if (conversationId) {
164+
openConversation(conversationId);
157165
} else {
158166
this.getChildControl("ask-a-question-button").setFetching(true);
159167
osparc.store.ConversationsSupport.getInstance().addConversation()
160168
.then(data => {
161-
conversationContent.setConversationId(data["conversationId"]);
162-
this.__showConversation();
169+
openConversation(data["conversationId"]);
163170
})
164171
.finally(() => {
165172
this.getChildControl("ask-a-question-button").setFetching(false);

0 commit comments

Comments
 (0)