Skip to content

Commit

Permalink
🎨 [Frontend] Show support email in About window (ITISFoundation#6890)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Dec 3, 2024
1 parent 59aeb99 commit f9f2148
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,15 @@ qx.Class.define("osparc.CookiePolicy", {
control = new qx.ui.basic.Label(text).set({
rich : true
});
osparc.store.Support.getLicenseURL()
.then(licenseLink => {
const lbl = control.getValue();
if (licenseLink) {
const color = qx.theme.manager.Color.getInstance().resolve("text");
const textLink = `<a href=${licenseLink} style='color: ${color}' target='_blank'>Licensing.</a>`;
control.setValue(lbl + textLink);
} else {
control.setValue(lbl + this.tr("Licensing."));
}
});
const licenseLink = osparc.store.Support.getLicenseURL();
const lbl = control.getValue();
if (licenseLink) {
const color = qx.theme.manager.Color.getInstance().resolve("text");
const textLink = `<a href=${licenseLink} style='color: ${color}' target='_blank'>Licensing.</a>`;
control.setValue(lbl + textLink);
} else {
control.setValue(lbl + this.tr("Licensing."));
}
this._add(control, {
column: 0,
row: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ qx.Class.define("osparc.navigation.UserMenu", {
case "license":
control = new qx.ui.menu.Button(this.tr("License"));
osparc.utils.Utils.setIdToWidget(control, "userMenuLicenseBtn");
osparc.store.Support.getLicenseURL()
.then(licenseURL => control.addListener("execute", () => window.open(licenseURL)));
const licenseURL = osparc.store.Support.getLicenseURL();
control.addListener("execute", () => window.open(licenseURL));
this.add(control);
break;
case "tip-lite-button":
Expand Down Expand Up @@ -257,7 +257,7 @@ qx.Class.define("osparc.navigation.UserMenu", {
}

this.getChildControl("about");
if (!osparc.product.Utils.isProduct("osparc")) {
if (osparc.product.Utils.showAboutProduct()) {
this.getChildControl("about-product");
}
this.getChildControl("license");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ qx.Class.define("osparc.product.AboutProduct", {
case "s4llite":
this.__buildS4LLiteLayout();
break;
case "tis":
case "tiplite":
this.__buildTIPLayout();
break;
default: {
const noInfoText = this.tr("Information not available");
const noInfoLabel = osparc.product.quickStart.Utils.createLabel(noInfoText);
Expand All @@ -67,43 +71,43 @@ qx.Class.define("osparc.product.AboutProduct", {
},

__buildS4LLayout: function() {
osparc.store.Support.getLicenseURL()
.then(licenseUrl => {
const text = this.tr(`
sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
<br><br>
sim4life.io makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
<br><br>
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}.
<br><br>
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
`);

const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
});
const licenseUrl = osparc.store.Support.getLicenseURL();
const text = this.tr(`
sim4life.io is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
<br><br>
sim4life.io makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
<br><br>
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "https://sim4life.swiss/")}.
<br><br>
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
<br><br>
Send us an email ${this.__getMailTo()}
`);

const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
},

__buildS4LAcademicLayout: function() {
osparc.store.Support.getLicenseURL()
.then(licenseUrl => {
const text = this.tr(`
sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
<br><br>
sim4life.science makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
<br><br>
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}.
<br><br>
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
`);

const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
});
const licenseUrl = osparc.store.Support.getLicenseURL();
const text = this.tr(`
sim4life.science is a native implementation of the most advanced simulation platform, Sim4Life, in the cloud. \
The platform empowers users to simulate, analyze, and predict complex, multifaceted, and dynamic biological interactions within the full anatomical complexity of the human body. \
It provides the ability to set up and run complex simulations directly within any browser, utilizing cloud technology.
<br><br>
sim4life.science makes use of technologies developed by our research partner for the o<sup>2</sup>S<sup>2</sup>PARC platform, the IT’IS Foundation, and co-funded by the U.S. National Institutes of Health’s SPARC initiative.\
<br><br>
For more information about Sim4Life, please visit ${osparc.utils.Utils.createHTMLLink("sim4life.swiss", "href='https://sim4life.swiss/")}.
<br><br>
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
<br><br>
Send us an email ${this.__getMailTo()}
`);

const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
},

__buildS4LLiteLayout: function() {
Expand All @@ -117,10 +121,13 @@ qx.Class.define("osparc.product.AboutProduct", {
const moreInfoUrl = "https://zmt.swiss/";
const moreInfoText = `For more information about Sim4Life.lite, visit ${osparc.utils.Utils.createHTMLLink("our website", moreInfoUrl)}.`;

const emailText = `Send us an email ${this.__getMailTo()}`;

[
introText,
licenseText,
moreInfoText
moreInfoText,
emailText,
].forEach(text => {
const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
Expand All @@ -129,6 +136,35 @@ qx.Class.define("osparc.product.AboutProduct", {
this.__addCopyright();
},

__buildTIPLayout: function() {
const licenseUrl = osparc.store.Support.getLicenseURL();
const text = this.tr(`
TIP (TI Planning Tool) is an innovative online platform designed to optimize targeted neurostimulation protocols using \
temporal interference (TI) stimulation. Developed by IT'IS Foundation, TIP simplifies the complex process of planning deep \
brain stimulation.
<br><br>
Powered by o<sup>2</sup>S<sup>2</sup>PARC technology, TIP utilizes sophisticated electromagnetic simulations, detailed anatomical head models, \
and automated optimization to generate comprehensive reports with quantitative and visual information. This tool is \
invaluable for neuroscientists and brain stimulation experts, especially those with limited computational modeling experience, \
enabling them to create effective and safe stimulation protocols for their research. \
<br><br>
For more information about TIP, please visit ${osparc.utils.Utils.createHTMLLink("itis.swiss", "https://itis.swiss/tools-and-systems/ti-planning/overview")}.
<br><br>
To review license agreements, click ${osparc.utils.Utils.createHTMLLink("here", licenseUrl)}.
<br><br>
Send us an email ${this.__getMailTo()}
`);

const label = osparc.product.quickStart.Utils.createLabel(text);
this.add(label);
},

__getMailTo: function() {
const supportEmail = osparc.store.VendorInfo.getInstance().getSupportEmail();
const productName = osparc.store.StaticInfo.getInstance().getDisplayName();
return osparc.store.Support.mailToText(supportEmail, "Support " + productName, false);
},

__addCopyright: function() {
const copyrightLink = new osparc.ui.basic.LinkLabel().set({
font: "link-label-14"
Expand All @@ -141,6 +177,6 @@ qx.Class.define("osparc.product.AboutProduct", {
});
}
this.add(copyrightLink);
}
},
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ qx.Class.define("osparc.product.Utils", {
},

showAboutProduct: function() {
return (this.isS4LProduct() || this.isProduct("s4llite"));
return (
this.isS4LProduct() ||
this.isProduct("s4llite") ||
this.isProduct("tis") ||
this.isProduct("tiplite")
);
},

showPreferencesTokens: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4l.Welcome", {
textAlign: "center",
rich : true
});
osparc.store.Support.getLicenseURL()
.then(licenseUrl => {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
});
const licenseUrl = osparc.store.Support.getLicenseURL();
if (licenseUrl) {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
}
footerItems.push(licenseLink);

const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ qx.Class.define("osparc.product.quickStart.s4lacad.Welcome", {
textAlign: "center",
rich : true
});
osparc.store.Support.getLicenseURL()
.then(licenseUrl => {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
});
const licenseUrl = osparc.store.Support.getLicenseURL();
if (licenseUrl) {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
}
footerItems.push(licenseLink);

const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lDontShowQuickStart");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ qx.Class.define("osparc.product.quickStart.s4llite.Slides", {
textAlign: "center",
rich : true
});
osparc.store.Support.getLicenseURL()
.then(licenseUrl => {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
});
const licenseUrl = osparc.store.Support.getLicenseURL();
if (licenseUrl) {
const link = osparc.utils.Utils.createHTMLLink("Licensing", licenseUrl);
licenseLink.setValue(link);
licenseLink.show();
}
footerItems.push(licenseLink);

const dontShowCB = osparc.product.quickStart.Utils.createDontShowAgain("s4lliteDontShowQuickStart");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ qx.Class.define("osparc.store.Support", {

statics: {
getLicenseURL: function() {
return new Promise(resolve => {
const vendor = osparc.store.VendorInfo.getInstance().getVendor();
if (vendor) {
if ("license_url" in vendor) {
resolve(vendor["license_url"]);
} else if ("url" in vendor) {
resolve(vendor["url"]);
} else {
resolve("");
}
const vendor = osparc.store.VendorInfo.getInstance().getVendor();
if (vendor) {
if ("license_url" in vendor) {
return vendor["license_url"];
} else if ("url" in vendor) {
return vendor["url"];
}
});
}
return "";
},

getManuals: function() {
Expand Down Expand Up @@ -135,9 +132,12 @@ qx.Class.define("osparc.store.Support", {
});
},

mailToText: function(email, subject) {
mailToText: function(email, subject, centered = true) {
const color = qx.theme.manager.Color.getInstance().resolve("text");
const textLink = `<center><a href="mailto:${email}?subject=${subject}" style='color: ${color}' target='_blank'>${email}</a>&nbsp&nbsp<center>`;
let textLink = `<a href="mailto:${email}?subject=${subject}" style='color: ${color}' target='_blank'>${email}</a>&nbsp&nbsp`;
if (centered) {
textLink = `<center>${textLink}</center>`
}
return textLink;
},

Expand Down

0 comments on commit f9f2148

Please sign in to comment.