diff --git a/src/app.js b/src/app.js index 00abbc1..8fa96f1 100644 --- a/src/app.js +++ b/src/app.js @@ -50,7 +50,6 @@ class App extends React.Component { type: 'config/load', }); - branding.applyBranding(); this.state = {} } diff --git a/src/branding/branding.js b/src/branding/branding.js index 7a83fdb..92bb583 100644 --- a/src/branding/branding.js +++ b/src/branding/branding.js @@ -23,32 +23,16 @@ import slew_values from './slew/slew-values'; class Branding { constructor(chosenbrand) { - if (!Branding.branding) { - if (chosenbrand === undefined) { - chosenbrand = "villasweb" - } - this.brand = chosenbrand; - - this.setValues(); - this.isSet = true; - - Branding.branding = this; + if (Branding.branding) { + return Branding.branding; } - /* - // TODO: simplify; error only for "wrong" brand, not for missing brand - var brand = _.get(brands, [chosenbrand]); - if (!brand) { - console.error("Branding '" + chosenbrand + "' not available, will use 'villasweb' branding"); - brand = _.get(brands, ['villasweb']); - chosenbrand = 'villasweb'; - this.default = true; - } else if (chosenbrand === 'villasweb') { - this.default = true; - } else { - this.default = false; - } - *****/ - return Branding.branding; + + this.brand = chosenbrand; + this.setValues(); + this.checkValues(); + this.applyStyle(); + + Branding.branding = this; } setValues() { @@ -60,6 +44,8 @@ class Branding { this.values = slew_values; break; default: + console.error("Branding '" + this.brand + "' not available, will use 'villasweb' branding"); + this.brand = 'villasweb'; this.values = villasweb_values; break; } @@ -69,13 +55,13 @@ class Branding { var homepage = ''; switch (this.brand) { case 'villasweb': - homepage = villasweb_home(this.values.title, username, userid, role); + homepage = villasweb_home(this.getTitle(), username, userid, role); break; case 'slew': - homepage = slew_home(this.values.title); + homepage = slew_home(); break; default: - homepage = villasweb_home(); + homepage = villasweb_home(this.getTitle(), username, userid, role); break; } return homepage; @@ -99,15 +85,22 @@ class Branding { } defaultWelcome() { - return (
This is the welcome page and you are very welcome here.
- Welcome to {title}! + Welcome to SLEW!
SLEW is a learning platform for running experiments in a virtual power engineering world. The platform enables to interact with the experiments in real time and perform analyses on the experimental results.
diff --git a/src/branding/slew/slew-values.js b/src/branding/slew/slew-values.js index 0c5b06e..34488da 100644 --- a/src/branding/slew/slew-values.js +++ b/src/branding/slew/slew-values.js @@ -32,10 +32,9 @@ const slew_values = { "VILLASframework": "https://villas.fein-aachen.org/doc" }, style: { - bgcolor: 'rgba(107,29,26, 0.8)', + background: 'rgba(107,29,26, 0.8)', highlights: '#610C04', maincolor: 'rgba(40,0,0,0.8)', - primarytext: '#472120', secondarytext: '#472120', font: "16px Roboto, sans-serif", borderradius: "10px" diff --git a/src/branding/villasweb/villasweb-values.js b/src/branding/villasweb/villasweb-values.js index f4b2dd9..c055a32 100644 --- a/src/branding/villasweb/villasweb-values.js +++ b/src/branding/villasweb/villasweb-values.js @@ -28,9 +28,9 @@ const villasweb_values = { api: true, }, style: { - bgcolor: '#6EA2B0', + background: '#6EA2B0', highlights: '#527984', - primarytext: '#4d4d4d', + maincolor: '#4d4d4d', secondarytext: '#818181', } } diff --git a/src/common/header.js b/src/common/header.js index 97d094b..a01575e 100644 --- a/src/common/header.js +++ b/src/common/header.js @@ -20,10 +20,19 @@ import branding from '../branding/branding'; class Header extends React.Component { render() { + let hasSubtitle = branding.getSubtitle(); return ( -