Skip to content

Commit

Permalink
INIT hiding theme switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
lencodes committed Nov 21, 2023
1 parent 9738d7a commit 55b6232
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pwa/src/hooks/useEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const useEnvironment = () => {
}, []);

const initiateFromEnv = () => {
window.sessionStorage.setItem("SHOW_THEME_SWITCHER", process.env.GATSBY_SHOW_THEME_SWITCHER ?? "");
window.sessionStorage.setItem("API_BASE_URL", process.env.GATSBY_API_BASE_URL ?? "");
window.sessionStorage.setItem("NL_DESIGN_THEME_CLASSNAME", process.env.GATSBY_NL_DESIGN_THEME_CLASSNAME ?? "");
window.sessionStorage.setItem("FAVICON_URL", process.env.GATSBY_FAVICON_URL ?? "");
Expand All @@ -40,6 +41,7 @@ export const useEnvironment = () => {

if (!config) return; // no config found, nothing else to do

window.sessionStorage.setItem("SHOW_THEME_SWITCHER", config.GATSBY_SHOW_THEME_SWITCHER ?? "");
window.sessionStorage.setItem("API_BASE_URL", config.GATSBY_API_BASE_URL ?? "");
window.sessionStorage.setItem("NL_DESIGN_THEME_CLASSNAME", config.GATSBY_NL_DESIGN_THEME_CLASSNAME ?? "");
window.sessionStorage.setItem("FAVICON_URL", config.GATSBY_FAVICON_URL ?? "");
Expand Down
1 change: 1 addition & 0 deletions pwa/src/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const getConfig = (themeOrDomainName: string): Record<string, any> | unde
return Xxllnc;
case "koophulpje.nl":
case "open-webconcept-theme":
case "localhost":
return OpenWebconcept;
default:
return Conduction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const ThemeSwitcherTopBar: React.FC = () => {
initiateFromJSON(watchTheme.value);
}, [watchTheme]);

if (window.sessionStorage.getItem("SHOW_THEME_SWITCHER") === "false") {
return <></>;
}

return (
<section className={clsx(styles.container, "open-webconcept-theme")}>
<div>
Expand All @@ -47,7 +51,7 @@ export const ThemeSwitcherTopBar: React.FC = () => {
</div>

<div>
<Paragraph className={styles.label}>Huidige gemeente</Paragraph>
<Paragraph className={styles.label}>Selecteer een gemeente</Paragraph>

<SelectSingle
options={availableThemes}
Expand Down
5 changes: 4 additions & 1 deletion pwa/static/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ GATSBY_FOOTER_CONTENT_HEADER=""
#OIDN
GATSBY_OIDN_NUMBER=""

#Theme switcher
GATSBY_SHOW_THEME_SWITCHER="false"

# Deployment option, if you're using this .env file DO NOT REMOVE OR EDIT THIS
GATSBY_ENV_VARS_SET="true"
# GATSBY_ENV_VARS_SET="true"
1 change: 1 addition & 0 deletions pwa/static/configFiles/conduction.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "conduction-theme",
"GATSBY_FAVICON_URL": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICAgICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgd2lkdGg9IjcxLjAwMDAwMHB0IiBoZWlnaHQ9IjcwLjAwMDAwMHB0IiB2aWV3Qm94PSIwIDAgNzEuMDAwMDAwIDcwLjAwMDAwMCIKICAgICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0Ij4KCiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCw3MC4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiCiAgICAgICBmaWxsPSIjNDM3NkZDIiBzdHJva2U9Im5vbmUiPgogICAgICAgIDxwYXRoIGQ9Ik0yMTggNTkyIGwtMTM3IC03NyAwIC0xNjUgMCAtMTY1IDEzMSAtNzQgYzcyIC00MSAxMzcgLTc0IDE0MyAtNzQgNgowIDcwIDMzIDE0MyA3NCBsMTMxIDc0IDEgMTY1IDAgMTY1IC02OCAzNyBjLTM3IDIxIC05OSA1NiAtMTM3IDc3IGwtNzEgNDAKLTEzNiAtNzd6IG0yOTUgLTg1IGw1NyAtMzIgMCAtMTI1IDAgLTEyNSAtMTA2IC02MCBjLTU4IC0zMyAtMTA4IC02MCAtMTExCi01OSAtMyAwIC01MiAyNyAtMTA5IDYwIGwtMTAzIDU5IDAgMTI1IDAgMTI1IDEwNyA2MSAxMDcgNjIgNTAgLTI5IGMyNyAtMTYKNzYgLTQ0IDEwOCAtNjJ6Ii8+CiAgICAgICAgPHBhdGggZD0iTTI3OCA0NzIgbC02OCAtMzcgMCAtODUgMCAtODUgNzMgLTM5IDczIC0zOSA2MiAzNCBjMzQgMTggNjIgMzcgNjIKNDEgMCA0IC0xNCAxNSAtMzEgMjMgLTI4IDE1IC0zMyAxNSAtNTQgMSAtMzEgLTIwIC00NiAtMjAgLTg0IDIgLTI3IDE1IC0zMQoyMiAtMzEgNjIgMCA0MCA0IDQ3IDMxIDYzIDM4IDIxIDUzIDIxIDg0IDEgMjEgLTE0IDI2IC0xNCA1NCAxIDE3IDggMzEgMTkgMzEKMjMgMCA4IC0xMTMgNzIgLTEyNiA3MiAtNSAwIC0zOSAtMTcgLTc2IC0zOHoiLz4KICAgIDwvZz4KPC9zdmc+Cg==",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/dinkelland.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "dinkelland-theme",
"GATSBY_FAVICON_URL": "https://www.tubbergen.nl/sites/all/themes/tubbergen/favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/epe.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "epe-theme",
"GATSBY_FAVICON_URL": "https://www.epe.nl/sites/default/themes/custom/toptasks_sub_theme/favicon/favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/noaberkracht.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "noaberkracht-theme",
"GATSBY_FAVICON_URL": "https://werkenbijnoaberkracht.nl/favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/noordwijk.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "noordwijk-theme",
"GATSBY_FAVICON_URL": "https://www.noordwijk.nl/wp-content/uploads/2023/02/cropped-favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/open-webconcept.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "true",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "open-webconcept-theme",
"GATSBY_FAVICON_URL": "https://openwebconcept.nl/wp-content/uploads/2019/07/cropped-Favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/rotterdam.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "rotterdam-theme",
"GATSBY_FAVICON_URL": "https://www.rotterdam.nl/favicon.ico?v=2",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/tubbergen.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "tubbergen-theme",
"GATSBY_FAVICON_URL": "https://www.tubbergen.nl/sites/all/themes/tubbergen/favicon-32x32.png",
Expand Down
1 change: 1 addition & 0 deletions pwa/static/configFiles/xxllnc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "xxllnc-theme",
"GATSBY_FAVICON_URL": "https://xxllnc.nl/wp-content/uploads/2021/07/cropped-fav-xxllnc-32x32.png",
Expand Down

0 comments on commit 55b6232

Please sign in to comment.