Skip to content

Commit 038d560

Browse files
committed
refactor
1 parent edb096e commit 038d560

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ qx.Class.define("osparc.support.ConversationsPage", {
3131

3232
events: {
3333
"openConversation": "qx.event.type.Data",
34-
"createConversationBookCall": "qx.event.type.Event",
34+
"createConversation": "qx.event.type.Data",
3535
},
3636

3737
members: {
@@ -63,7 +63,7 @@ qx.Class.define("osparc.support.ConversationsPage", {
6363
allowGrowX: false,
6464
center: true,
6565
});
66-
control.addListener("execute", () => this.fireDataEvent("openConversation", null), this);
66+
control.addListener("execute", () => this.fireDataEvent("createConversation", "askAQuestion"), this);
6767
this.getChildControl("buttons-layout").add(control);
6868
break;
6969
case "book-a-call-button":
@@ -72,7 +72,7 @@ qx.Class.define("osparc.support.ConversationsPage", {
7272
allowGrowX: false,
7373
center: true,
7474
});
75-
control.addListener("execute", () => this.fireEvent("createConversationBookCall"), this);
75+
control.addListener("execute", () => this.fireDataEvent("createConversation", "bookACall"), this);
7676
this.getChildControl("buttons-layout").add(control);
7777
break;
7878
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ qx.Class.define("osparc.support.HomePage", {
3636
},
3737

3838
events: {
39-
"openConversation": "qx.event.type.Event",
40-
"createConversationBookCall": "qx.event.type.Event",
39+
"createConversation": "qx.event.type.Data",
4140
},
4241

4342
statics: {
@@ -83,7 +82,7 @@ qx.Class.define("osparc.support.HomePage", {
8382
center: true,
8483
width: 183,
8584
});
86-
control.addListener("execute", () => this.fireEvent("openConversation"));
85+
control.addListener("execute", () => this.fireDataEvent("createConversation", "askAQuestion"));
8786
this.getChildControl("conversation-buttons-layout").add(control, { flex: 1 });
8887
break;
8988
case "book-a-call-button":
@@ -93,7 +92,7 @@ qx.Class.define("osparc.support.HomePage", {
9392
center: true,
9493
width: 183,
9594
});
96-
control.addListener("execute", () => this.fireEvent("createConversationBookCall"));
95+
control.addListener("execute", () => this.fireDataEvent("createConversation", "bookACall"));
9796
this.getChildControl("conversation-buttons-layout").add(control, { flex: 1 });
9897
break;
9998
case "learning-box":

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ qx.Class.define("osparc.support.SupportCenter", {
129129
break;
130130
case "home-page":
131131
control = new osparc.support.HomePage();
132-
control.addListener("openConversation", () => this.openConversation(), this);
133-
control.addListener("openBookACall", () => this.createConversationBookCall(), this);
132+
control.addListener("createConversation", e => this.createConversation(e.getData()), this);
134133
this.getChildControl("main-stack").add(control);
135134
break;
136135
case "conversations-stack":
@@ -139,11 +138,8 @@ qx.Class.define("osparc.support.SupportCenter", {
139138
break;
140139
case "conversations-page":
141140
control = new osparc.support.ConversationsPage();
142-
control.addListener("openConversation", e => {
143-
const conversationId = e.getData();
144-
this.openConversation(conversationId);
145-
}, this);
146-
control.addListener("createConversationBookCall", () => this.createConversationBookCall(), this);
141+
control.addListener("openConversation", e => this.openConversation(e.getData()), this);
142+
control.addListener("createConversation", e => this.createConversation(e.getData()), this);
147143
this.getChildControl("conversations-stack").add(control);
148144
break;
149145
case "conversation-page":
@@ -203,6 +199,13 @@ qx.Class.define("osparc.support.SupportCenter", {
203199
}
204200
},
205201

202+
createConversation: function(type) {
203+
type = type || "askAQuestion";
204+
const conversationPage = this.getChildControl("conversation-page");
205+
conversationPage.setConversation(null);
206+
this.__showConversation();
207+
},
208+
206209
createConversationBookCall: function() {
207210
const conversationPage = this.getChildControl("conversation-page");
208211
conversationPage.setConversation(null);

0 commit comments

Comments
 (0)