diff --git a/src/branding/branding.js b/src/branding/branding.js index 0a05483..cf7f16b 100644 --- a/src/branding/branding.js +++ b/src/branding/branding.js @@ -28,188 +28,187 @@ import { template_welcome, template_home, template_footer } from './template/tem import template_values from './template/template-values'; class Branding { - constructor(chosenbrand) { - this.brand = chosenbrand; - this.setValues(); - this.checkValues(); - this.applyStyle(); + constructor(brand) { + this.brand = brand; - Branding.branding = this; + this.setValues(); + this.checkValues(); + this.applyStyle(); + + Branding.branding = this; + } + + setValues() { + switch (this.brand) { + case 'villasweb': + this.values = villasweb_values; + break; + case 'slew': + this.values = slew_values; + break; + case 'opalrt': + this.values = opalrt_values; + break; + case 'template': + this.values = template_values; + break; + default: + console.error("Branding '" + this.brand + "' not available, will use 'villasweb' branding"); + this.brand = 'villasweb'; + this.values = villasweb_values; + break; + } + } + + getHome(username = '', userid = '', role = '') { + var homepage = ''; + switch (this.brand) { + case 'villasweb': + homepage = villasweb_home(this.getTitle(), username, userid, role); + break; + case 'slew': + homepage = slew_home(); + break; + case 'opalrt': + homepage = opalrt_home(); + break; + case 'template': + homepage = template_home(); + break; + default: + homepage = villasweb_home(this.getTitle(), username, userid, role); + break; + } + return homepage; + } + + getFooter() { + var footer = ''; + switch (this.brand) { + case 'template': + footer = template_footer(); + break; + default: + footer = villasweb_footer(); + break; + } + return footer; + } + + getWelcome() { + var welcome = ''; + switch (this.brand) { + case 'villasweb': + welcome = villasweb_welcome(); + break; + case 'slew': + welcome = slew_welcome(); + break; + case 'opalrt': + welcome = opalrt_welcome(); + break; + case 'template': + welcome = template_welcome(); + break; + default: + welcome = this.defaultWelcome(); + break; + } + return welcome; + } + + defaultWelcome() { + return (

Welcome!

This is the welcome page and you are very welcome here.

); + } + + // if icon cannot be found, the default favicon will be used + changeHead() { + // set title of document + let title = this.getTitle(); + if (this.getSubtitle()) { + title += " " + this.getSubtitle(); + } + document.title = title; + + // set document icon + if (!this.values.icon) { + return; + } + var oldlink = document.getElementById('dynamic-favicon'); + + var link = document.createElement('link'); + link.id = 'dynamic-favicon'; + link.rel = 'shortcut icon' + link.href = '/' + this.values.icon; + + if (oldlink) { + document.head.removeChild(oldlink); + } + document.head.appendChild(link); + } + + checkValues() { + if (!this.values.hasOwnProperty('pages')) { + let pages = {}; + pages.home = true; + pages.scenarios = true; + pages.infrastructure = true; + pages.users = true; + pages.account = true; + pages.api = true; + + this.values.pages = pages; + } else { + if (!this.values.pages.hasOwnProperty('home')) { + this.values.pages['home'] = false; + } + if (!this.values.pages.hasOwnProperty('scenarios')) { + this.values.pages['scenarios'] = false; + } + if (!this.values.pages.hasOwnProperty('infrastructure')) { + this.values.pages['infrastructure'] = false; + } + if (!this.values.pages.hasOwnProperty('users')) { + this.values.pages['users'] = false; + } + if (!this.values.pages.hasOwnProperty('account')) { + this.values.pages['account'] = false; + } + if (!this.values.pages.hasOwnProperty('api')) { + this.values.pages['api'] = false; + } + } + } + + applyStyle() { + this.changeHead(); + + const rootEl = document.querySelector(':root'); + + for (const [key, value] of Object.entries(this.values.style)) { + rootEl.style.setProperty('--' + key, value); + } + } + + getLogo(style) { + let image = null; + + try { + image = {'Logo + } catch (err) { + console.error("cannot find './" + this.brand + '/img/' + this.values.logo + "'"); } - setValues() { - switch (this.brand) { - case 'villasweb': - this.values = villasweb_values; - break; - case 'slew': - this.values = slew_values; - break; - case 'opalrt': - this.values = opalrt_values; - break; - case 'template': - this.values = template_values; - break; - default: - console.error("Branding '" + this.brand + "' not available, will use 'villasweb' branding"); - this.brand = 'villasweb'; - this.values = villasweb_values; - break; - } - } + return image; + } - getHome(username = '', userid = '', role = '') { - var homepage = ''; - switch (this.brand) { - case 'villasweb': - homepage = villasweb_home(this.getTitle(), username, userid, role); - break; - case 'slew': - homepage = slew_home(); - break; - case 'opalrt': - homepage = opalrt_home(); - break; - case 'template': - homepage = template_home(); - break; - default: - homepage = villasweb_home(this.getTitle(), username, userid, role); - break; - } - return homepage; - } + getTitle() { + return this.values.title ? this.values.title : "No Title!"; + } - getFooter() { - var footer = ''; - switch(this.brand) { - case 'template': - footer = template_footer(); - break; - default: - footer = villasweb_footer(); - break; - } - return footer; - } - - getWelcome() { - var welcome = ''; - switch (this.brand) { - case 'villasweb': - welcome = villasweb_welcome(); - break; - case 'slew': - welcome = slew_welcome(); - break; - case 'opalrt': - welcome = opalrt_welcome(); - break; - case 'template': - welcome = template_welcome(); - break; - default: - welcome = this.defaultWelcome(); - break; - } - return welcome; - } - - defaultWelcome() { - return (

Welcome!

This is the welcome page and you are very welcome here.

); - } - - // if icon cannot be found, the default favicon will be used - changeHead() { - // set title of document - let title = this.getTitle(); - if (this.getSubtitle()) { - title += " " + this.getSubtitle(); - } - document.title = title; - - // set document icon - if (!this.values.icon) { - return; - } - var oldlink = document.getElementById('dynamic-favicon'); - - var link = document.createElement('link'); - link.id = 'dynamic-favicon'; - link.rel = 'shortcut icon' - link.href = '/' + this.values.icon; - - if (oldlink) { - document.head.removeChild(oldlink); - } - document.head.appendChild(link); - } - - checkValues() { - if (!this.values.hasOwnProperty('pages')) { - let pages = {}; - pages.home = true; - pages.scenarios = true; - pages.infrastructure = true; - pages.users = true; - pages.account = true; - pages.api = true; - - this.values.pages = pages; - } else { - if (!this.values.pages.hasOwnProperty('home')) { - this.values.pages['home'] = false; - } - if (!this.values.pages.hasOwnProperty('scenarios')) { - this.values.pages['scenarios'] = false; - } - if (!this.values.pages.hasOwnProperty('infrastructure')) { - this.values.pages['infrastructure'] = false; - } - if (!this.values.pages.hasOwnProperty('users')) { - this.values.pages['users'] = false; - } - if (!this.values.pages.hasOwnProperty('account')) { - this.values.pages['account'] = false; - } - if (!this.values.pages.hasOwnProperty('api')) { - this.values.pages['api'] = false; - } - } - } - - applyStyle() { - this.changeHead(); - - const rootEl = document.querySelector(':root'); - - for (const [key, value] of Object.entries(this.values.style)) { - rootEl.style.setProperty('--' + key, value); - } - } - - getLogo(style) { - let image = null; - - try { - image = {'Logo - } catch (err) { - console.error("cannot find './" + this.brand + '/img/' + this.values.logo + "'"); - } - - return image; - } - - - - getTitle() { - return this.values.title ? this.values.title : "No Title!"; - } - - getSubtitle() { - return this.values.subtitle ? this.values.subtitle : null; - } + getSubtitle() { + return this.values.subtitle ? this.values.subtitle : null; + } }; var branding = new Branding(process.env.REACT_APP_BRAND); diff --git a/src/branding/slew/slew-functions.js b/src/branding/slew/slew-functions.js index 05bd8d2..b584a36 100644 --- a/src/branding/slew/slew-functions.js +++ b/src/branding/slew/slew-functions.js @@ -19,48 +19,48 @@ import './slew.css' export function slew_home() { - return ( -
-

Home

-

- Welcome to SLEW! -

-

SLEW is a learning platform for running experiments in a virtual power engineering world. - The platform enables interaction with the experiments in real time and performing analysis on the experimental results.

+ return ( +
+

Home

+

+ Welcome to SLEW! +

+

SLEW is a learning platform for running experiments in a virtual power engineering world. + The platform enables interaction with the experiments in real time and performing analysis on the experimental results.

-

The motivation behind SLEW is the ongoing transformation of the energy system, which is making the system more and more complex. - Hence, understanding new phenomena and underlying interactions is getting more challenging, also because real experimental - activities for obtaining a better understanding are not possible for obvious reasons of security and safety.

+

The motivation behind SLEW is the ongoing transformation of the energy system, which is making the system more and more complex. + Hence, understanding new phenomena and underlying interactions is getting more challenging, also because real experimental + activities for obtaining a better understanding are not possible for obvious reasons of security and safety.

-

The SLEW platform gives the possibility to perform experiments in a virtual infrastructure and to learn from the execution - of complex models. It provides a virtual power engineering world where complex phenomena take place while users can interact - with the system in real time.

+

The SLEW platform gives the possibility to perform experiments in a virtual infrastructure and to learn from the execution + of complex models. It provides a virtual power engineering world where complex phenomena take place while users can interact + with the system in real time.

-

The platform is based on the real-time simulation tool DPsim developed in RWTH, - which is available as open-source software project to the power engineering community. Besides, it integrates the interactive - computing environment Jupyter for further analysis of experimental results.

+

The platform is based on the real-time simulation tool DPsim developed in RWTH, + which is available as open-source software project to the power engineering community. Besides, it integrates the interactive + computing environment Jupyter for further analysis of experimental results.

-

Contacts

- +

Contacts

+ -

Credits

-
- Logo EONERC - Logo Erigrid - Logo EU -
-
) +

Credits

+
+ Logo EONERC + Logo Erigrid + Logo EU +
+
) } export function slew_welcome() { return ( -
-

Welcome!

-

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.

-
) +
+

Welcome!

+

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 102079b..4327656 100644 --- a/src/branding/slew/slew-values.js +++ b/src/branding/slew/slew-values.js @@ -16,29 +16,29 @@ ******************************************************************************/ const slew_values = { - title: 'SLEW', - subtitle: 'Second Life for Energiewende', - icon: "slew_blue.png", - logo: "slew_logo.png", - pages: { - home: true, - scenarios: true, - infrastructure: false, - account: false, - api: false - }, - links: { - "DPsim Simulator": "https://dpsim.fein-aachen.org", - "VILLASframework": "https://villas.fein-aachen.org/doc" - }, - style: { - background: 'rgba(207,209,210, 1)', - highlights: 'rgba(0,84,159, 0.75)', - main: 'rgba(80,80,80, 1)', - secondaryText: 'rgba(80,80,80, 0.9)', - fontFamily: "Roboto, sans-serif", - borderRadius: "10px" - } + title: 'SLEW', + subtitle: 'Second Life for Energiewende', + icon: "slew_blue.png", + logo: "slew_logo.png", + pages: { + home: true, + scenarios: true, + infrastructure: false, + account: false, + api: false + }, + links: { + "DPsim Simulator": "https://dpsim.fein-aachen.org", + "VILLASframework": "https://villas.fein-aachen.org/doc" + }, + style: { + background: 'rgba(207,209,210, 1)', + highlights: 'rgba(0,84,159, 0.75)', + main: 'rgba(80,80,80, 1)', + secondaryText: 'rgba(80,80,80, 0.9)', + fontFamily: "Roboto, sans-serif", + borderRadius: "10px" + } } export default slew_values; diff --git a/src/branding/slew/slew.css b/src/branding/slew/slew.css index c8f2ddf..a91c54b 100644 --- a/src/branding/slew/slew.css +++ b/src/branding/slew/slew.css @@ -1,4 +1,4 @@ #images { margin-left: 2em; margin-right: 2em -} \ No newline at end of file +} diff --git a/src/branding/template/template-functions.js b/src/branding/template/template-functions.js index d6b8d58..7ddf98d 100644 --- a/src/branding/template/template-functions.js +++ b/src/branding/template/template-functions.js @@ -14,39 +14,39 @@ * You should have received a copy of the GNU General Public License * along with VILLASweb. If not, see . ******************************************************************************/ - import React from 'react'; +import React from 'react'; - - export function template_home() { - return ( -
- Template Logo -

Home

-

- Welcome to BRAND! -

-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut - labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. - Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

- -

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore - et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. - Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

-
) - } - - export function template_welcome() { - return ( -
-

Welcome!

-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut - labore et dolore magna aliquyam erat, sed diam voluptua.

-
) - } - export function template_footer() { - return ( - ) - } \ No newline at end of file +export function template_home() { + return ( +
+ Template Logo +

Home

+

+ Welcome to BRAND! +

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut + labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. + Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

+ +

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore + et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. + Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

+
) +} + +export function template_welcome() { + return ( +
+

Welcome!

+

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut + labore et dolore magna aliquyam erat, sed diam voluptua.

+
) +} + +export function template_footer() { + return ( + ) +} diff --git a/src/branding/template/template-values.js b/src/branding/template/template-values.js index d74304c..4b1bb0c 100644 --- a/src/branding/template/template-values.js +++ b/src/branding/template/template-values.js @@ -15,30 +15,30 @@ * along with VILLASweb. If not, see . ******************************************************************************/ - const template_values = { - title: 'Template', - subtitle: 'change me!', - icon: "template_logo.svg", - pages: { - home: true, - scenarios: true, - infrastructure: true, - users: true, - account: true, - api: true - }, - links: { - "Google": "https://www.google.com/", - "StackOverFlow": "https://stackoverflow.com/" - }, - style: { - background: 'rgba(50,30,90, 0.6)', - highlights: 'rgba(0,230,5, 0.75)', - main: 'rgba(255,0,0, 1)', - secondaryText: 'rgba(0,0,100, 0.8)', - fontFamily: "Comic Sans, sans-serif", - borderRadius: "60px" - } - } +const template_values = { + title: 'Template', + subtitle: 'change me!', + icon: "template_logo.svg", + pages: { + home: true, + scenarios: true, + infrastructure: true, + users: true, + account: true, + api: true + }, + links: { + "Google": "https://www.google.com/", + "StackOverFlow": "https://stackoverflow.com/" + }, + style: { + background: 'rgba(50,30,90, 0.6)', + highlights: 'rgba(0,230,5, 0.75)', + main: 'rgba(255,0,0, 1)', + secondaryText: 'rgba(0,0,100, 0.8)', + fontFamily: "Comic Sans, sans-serif", + borderRadius: "60px" + } +} - export default template_values; +export default template_values; diff --git a/src/branding/villasweb/villasweb-functions.js b/src/branding/villasweb/villasweb-functions.js index 21f52f3..035da0b 100644 --- a/src/branding/villasweb/villasweb-functions.js +++ b/src/branding/villasweb/villasweb-functions.js @@ -22,14 +22,14 @@ import { NavLink } from 'react-router-dom'; export function villasweb_welcome() { let url = 'https://villas.fein-aachen.org/doc/web.html'; return ( -
-

Welcome!

-

VILLASweb is a tool to configure real-time co-simulations and display simulation real-time data. - It enables the management and monitoring of simulators, models and simulations.

- - - -
) +
+

Welcome!

+

VILLASweb is a tool to configure real-time co-simulations and display simulation real-time data. + It enables the management and monitoring of simulators, models and simulations.

+ + + +
) } export function villasweb_home(title, username, userid, role) { diff --git a/src/branding/villasweb/villasweb-values.js b/src/branding/villasweb/villasweb-values.js index 0a73c7f..3d23530 100644 --- a/src/branding/villasweb/villasweb-values.js +++ b/src/branding/villasweb/villasweb-values.js @@ -16,22 +16,22 @@ ******************************************************************************/ const villasweb_values = { - title: 'VILLASweb', - subtitle: 'ACS', - logo: 'villas_web.svg', - pages: { - home: true, - scenarios: true, - infrastructure: true, - account: true, - api: true, - }, - style: { - background: '#6EA2B0', - highlights: '#527984', - main: '#4d4d4d', - secondaryText: '#818181', - } + title: 'VILLASweb', + subtitle: 'ACS', + logo: 'villas_web.svg', + pages: { + home: true, + scenarios: true, + infrastructure: true, + account: true, + api: true, + }, + style: { + background: '#6EA2B0', + highlights: '#527984', + main: '#4d4d4d', + secondaryText: '#818181', + } } export default villasweb_values;