Skip to content

Commit fda7fb6

Browse files
committed
openMarket from sim4life
1 parent c8ac2bc commit fda7fb6

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

services/static-webserver/client/source/class/osparc/widget/PersistentIframe.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,28 @@ qx.Class.define("osparc.widget.PersistentIframe", {
292292

293293
__handleIframeMessage: function(data) {
294294
if (data["type"] && data["message"]) {
295-
if (data["type"] === "theme") {
296-
// switch theme driven by the iframe
297-
const message = data["message"];
298-
if (message.includes("osparc;theme=")) {
299-
const themeName = message.replace("osparc;theme=", "");
300-
const validThemes = osparc.ui.switch.ThemeSwitcher.getValidThemes();
301-
const themeFound = validThemes.find(theme => theme.basename === themeName);
302-
const themeManager = qx.theme.manager.Meta.getInstance();
303-
if (themeFound !== themeManager.getTheme()) {
304-
themeManager.setTheme(themeFound);
295+
switch (data["type"]) {
296+
case "theme": {
297+
// switch theme driven by the iframe
298+
const message = data["message"];
299+
if (message.includes("osparc;theme=")) {
300+
const themeName = message.replace("osparc;theme=", "");
301+
const validThemes = osparc.ui.switch.ThemeSwitcher.getValidThemes();
302+
const themeFound = validThemes.find(theme => theme.basename === themeName);
303+
const themeManager = qx.theme.manager.Meta.getInstance();
304+
if (themeFound !== themeManager.getTheme()) {
305+
themeManager.setTheme(themeFound);
306+
}
307+
}
308+
break;
309+
}
310+
case "openMarket": {
311+
const marketWindow = osparc.vipMarket.MarketWindow.openWindow();
312+
const category = data["message"] && data["message"]["category"];
313+
if (category) {
314+
marketWindow.openCategory(category);
305315
}
316+
break;
306317
}
307318
}
308319
}

0 commit comments

Comments
 (0)