diff --git a/pwa/gatsby-config.js b/pwa/gatsby-config.js index 80e8e9da..e2400e18 100644 --- a/pwa/gatsby-config.js +++ b/pwa/gatsby-config.js @@ -3,10 +3,14 @@ require("dotenv").config({ }); module.exports = { + /** + * We do NOT want to set the pathPrefix when we're using a DNS; it's only needed on gh-pages + * We CAN NOT set the pathPrefix when we're using the JSON-config files (due to needing access to window) + */ pathPrefix: process.env.USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX === "true" ? `/${process.env.GITHUB_REPOSITORY_NAME}` - : "", // we do NOT want to set the prefix if we're using an DNS + : "", plugins: [ { resolve: `gatsby-plugin-layout`, diff --git a/pwa/package-lock.json b/pwa/package-lock.json index 27147d57..8dec85b3 100644 --- a/pwa/package-lock.json +++ b/pwa/package-lock.json @@ -2125,8 +2125,12 @@ } }, "node_modules/@conduction/theme": { - "resolved": "../../conduction-theme", - "link": true + "version": "1.0.55", + "resolved": "https://registry.npmjs.org/@conduction/theme/-/theme-1.0.55.tgz", + "integrity": "sha512-GCk9v3HyAy/3exE2G7VpJF8g8m8g5l0do9i0AaWz4u12I5UMoY581tXmX3YUkh1wawS+TCgL7jvB/t2C6tl+1g==", + "dependencies": { + "@nl-design-system-unstable/rotterdam-design-tokens": "^1.0.0-alpha.100" + } }, "node_modules/@emotion/babel-plugin": { "version": "11.11.0", diff --git a/pwa/src/apiService/apiService.ts b/pwa/src/apiService/apiService.ts index be928434..7f929140 100644 --- a/pwa/src/apiService/apiService.ts +++ b/pwa/src/apiService/apiService.ts @@ -7,7 +7,7 @@ import { DEFAULT_FOOTER_CONTENT_URL } from "../templates/templateParts/footer/Fo import OpenWoo from "./resources/openWoo"; import FooterContent from "./resources/footerContent"; import Markdown from "./resources/markdown"; -import FilterCount from "./resources/filterCount"; +import AvailableFilters from "./resources/availableFilters"; interface PromiseMessage { loading?: string; @@ -25,7 +25,7 @@ export type TSendFunction = ( export default class APIService { public get BaseClient(): AxiosInstance { return axios.create({ - baseURL: process.env.GATSBY_API_BASE_URL, + baseURL: window.sessionStorage.getItem("API_BASE_URL") ?? "", headers: { Accept: "application/json", "Content-Type": "application/json", @@ -33,9 +33,9 @@ export default class APIService { }); } - public get FilterCountClient(): AxiosInstance { + public get AvailableFiltersClient(): AxiosInstance { return axios.create({ - baseURL: process.env.GATSBY_API_BASE_URL, + baseURL: window.sessionStorage.getItem("API_BASE_URL") ?? "", headers: { Accept: "application/json+aggregations", "Content-Type": "application/json", @@ -45,17 +45,13 @@ export default class APIService { public get FooterContentClient(): AxiosInstance { return axios.create({ - baseURL: removeFileNameFromUrl( - process.env.GATSBY_FOOTER_CONTENT !== undefined && process.env.GATSBY_FOOTER_CONTENT.length !== 0 - ? process.env.GATSBY_FOOTER_CONTENT - : DEFAULT_FOOTER_CONTENT_URL, - ), + baseURL: removeFileNameFromUrl(window.sessionStorage.getItem("FOOTER_CONTENT") ?? DEFAULT_FOOTER_CONTENT_URL), }); } public get MarkdownClient(): AxiosInstance { return axios.create({ - baseURL: process.env.GATSBY_BASE_URL ?? undefined, + baseURL: window.sessionStorage.getItem("BASE_URL") ?? undefined, headers: { Accept: "application/vnd.github.html", }, @@ -66,8 +62,8 @@ export default class APIService { return new OpenWoo(this.BaseClient, this.Send); } - public get FilterCount(): FilterCount { - return new FilterCount(this.FilterCountClient, this.Send); + public get AvailableFilters(): AvailableFilters { + return new AvailableFilters(this.AvailableFiltersClient, this.Send); } public get FooterContent(): FooterContent { diff --git a/pwa/src/apiService/resources/filterCount.ts b/pwa/src/apiService/resources/availableFilters.ts similarity index 63% rename from pwa/src/apiService/resources/filterCount.ts rename to pwa/src/apiService/resources/availableFilters.ts index 30211a44..05b33510 100644 --- a/pwa/src/apiService/resources/filterCount.ts +++ b/pwa/src/apiService/resources/availableFilters.ts @@ -1,7 +1,7 @@ import { TSendFunction } from "../apiService"; import { AxiosInstance } from "axios"; -export default class FilterCount { +export default class AvailableFilters { private _instance: AxiosInstance; private _send: TSendFunction; @@ -10,11 +10,11 @@ export default class FilterCount { this._send = send; } - public getCategoryCount = async (): Promise => { + public getCategories = async (): Promise => { let endpoint = "/openWOO?_queries[]=Categorie"; - if (process.env.GATSBY_OIDN_NUMBER) { - endpoint += `&oidn=${process.env.GATSBY_OIDN_NUMBER}`; + if (window.sessionStorage.getItem("OIDN_NUMBER")) { + endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; } const { data } = await this._send(this._instance, "GET", endpoint); diff --git a/pwa/src/apiService/resources/openWoo.ts b/pwa/src/apiService/resources/openWoo.ts index 4a2f178f..277bc315 100644 --- a/pwa/src/apiService/resources/openWoo.ts +++ b/pwa/src/apiService/resources/openWoo.ts @@ -19,8 +19,8 @@ export default class OpenWoo { filters, )}&_order[Publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`; - if (process.env.GATSBY_OIDN_NUMBER) { - endpoint += `&oidn=${process.env.GATSBY_OIDN_NUMBER}`; + if (window.sessionStorage.getItem("OIDN_NUMBER")) { + endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; } const { data } = await this._send(this._instance, "GET", endpoint); diff --git a/pwa/src/data/PublicationType.ts b/pwa/src/data/PublicationType.ts deleted file mode 100644 index c7fc79ef..00000000 --- a/pwa/src/data/PublicationType.ts +++ /dev/null @@ -1,71 +0,0 @@ -export const TEMP_PUBLICATION_TYPES = [ - { - label: "Wetten en algemeen verbindende voorschriften", - value: "wetten en algemeen verbindende voorschriften", - }, - { - label: "Overige besluiten van algemene strekking", - value: "overige besluiten van algemene strekking", - }, - { - label: "Ontwerpen van wet- en regelgeving met adviesaanvraag", - value: "ontwerpen van wet- en regelgeving met adviesaanvraag", - }, - { - label: "Organisatie en werkwijze", - value: "organisatie en werkwijze", - }, - { - label: "Bereikbaarheidsgegevens", - value: "bereikbaarheidsgegevens", - }, - - { - label: "Bij vertegenwoordigende organen ingekomen stukken", - value: "bij vertegenwoordigende organen ingekomen stukken", - }, - { - label: "Vergaderstukken Staten-Generaal", - value: "vergaderstukken Staten-Generaal", - }, - { - label: "Vergaderstukken decentrale overheden", - value: "vergaderstukken decentrale overheden", - }, - { - label: "Agenda's en besluitenlijsten bestuurscolleges", - value: "agenda's en besluitenlijsten bestuurscolleges", - }, - { - label: "Adviezen", - value: "adviezen", - }, - { - label: "Convenanten", - value: "convenanten", - }, - { - label: "Jaarplannen en jaarverslagen", - value: "jaarplannen en jaarverslagen", - }, - { - label: "Subsidieverplichtingen anders dan met beschikking", - value: "subsidieverplichtingen anders dan met beschikking", - }, - { - label: "Woo-verzoeken en -besluiten", - value: "woo-verzoeken en -besluiten", - }, - { - label: "Onderzoeksrapporten", - value: "onderzoeksrapporten", - }, - { - label: "Beschikkingen", - value: "beschikkingen", - }, - { - label: "Klachtoordelen", - value: "klachtoordelen", - }, -]; diff --git a/pwa/src/data/features.ts b/pwa/src/data/features.ts deleted file mode 100644 index 3cd4e724..00000000 --- a/pwa/src/data/features.ts +++ /dev/null @@ -1,98 +0,0 @@ -export const features = [ - { - href: "API", - name: "API", - }, - { - href: "Action_handlers", - name: "Action handlers", - }, - { - href: "Architecture", - name: "Architecture", - }, - { - href: "Authentication", - name: "Authentication", - }, - { - href: "Authorization", - name: "Authorization", - }, - { - href: "Code_quality", - name: "Code quality", - }, - { - href: "Commands", - name: "Commands", - }, - { - href: "Cronjobs", - name: "Cronjobs", - }, - { - href: "Datalayer", - name: "Datalayer", - }, - { - href: "Design_decisions", - name: "Design decisions", - }, - { - href: "Endpoints", - name: "Endpoints", - }, - { - href: "Events", - name: "Events", - }, - { - href: "Features", - name: "Features", - }, - { - href: "Federalization", - name: "Federalization", - }, - { - href: "Logging", - name: "Logging", - }, - { - href: "Mappings", - name: "Mappings", - }, - { - href: "Monitoring", - name: "Monitoring", - }, - { - href: "Notifications", - name: "Notifications", - }, - { - href: "Plugins", - name: "Plugins", - }, - { - href: "Schemas", - name: "Schemas", - }, - { - href: "Security", - name: "Security", - }, - { - href: "Sources", - name: "Sources", - }, - { - href: "Synchronizations", - name: "Synchronizations", - }, - { - href: "Twig", - name: "Twig", - }, -]; diff --git a/pwa/src/hooks/filterCount.ts b/pwa/src/hooks/availableFilters.ts similarity index 60% rename from pwa/src/hooks/filterCount.ts rename to pwa/src/hooks/availableFilters.ts index 43144376..9314da73 100644 --- a/pwa/src/hooks/filterCount.ts +++ b/pwa/src/hooks/availableFilters.ts @@ -3,15 +3,15 @@ import { useQuery } from "react-query"; import APIService from "../apiService/apiService"; import APIContext from "../apiService/apiContext"; -export const useFilterCount = () => { +export const useAvailableFilters = () => { const API: APIService | null = React.useContext(APIContext); - const getCategoryCount = () => - useQuery(["CategoryCount"], () => API?.FilterCount.getCategoryCount(), { + const getCategories = () => + useQuery(["available_catagories"], () => API?.AvailableFilters.getCategories(), { onError: (error) => { console.warn(error.message); }, }); - return { getCategoryCount }; + return { getCategories }; }; diff --git a/pwa/src/hooks/footerContent.ts b/pwa/src/hooks/footerContent.ts index 71a92ef0..e395c4a9 100644 --- a/pwa/src/hooks/footerContent.ts +++ b/pwa/src/hooks/footerContent.ts @@ -8,11 +8,7 @@ import { DEFAULT_FOOTER_CONTENT_URL } from "../templates/templateParts/footer/Fo export const useFooterContent = () => { const API: APIService | null = React.useContext(APIContext); - const fileName = getFileNameFromUrl( - process.env.GATSBY_FOOTER_CONTENT !== undefined && process.env.GATSBY_FOOTER_CONTENT.length !== 0 - ? process.env.GATSBY_FOOTER_CONTENT - : DEFAULT_FOOTER_CONTENT_URL, - ); + const fileName = getFileNameFromUrl(window.sessionStorage.getItem("FOOTER_CONTENT") ?? DEFAULT_FOOTER_CONTENT_URL); const getContent = () => useQuery(["contents", fileName], () => API?.FooterContent.getContent(fileName), { diff --git a/pwa/src/hooks/htmlParser/anchor/getAnchor.tsx b/pwa/src/hooks/htmlParser/anchor/getAnchor.tsx index 86de8fc5..8c72c060 100644 --- a/pwa/src/hooks/htmlParser/anchor/getAnchor.tsx +++ b/pwa/src/hooks/htmlParser/anchor/getAnchor.tsx @@ -89,7 +89,7 @@ const handleInternalLinks = (props: any, targetFile: string, location: string, d if (!directoryFound) { const hrefWithLeadingSlash = !props.href.startsWith("/") ? `/${props.href}` : props.href; - open(`${process.env.GATSBY_GITHUB_REPOSITORY_URL}/blob/master${hrefWithLeadingSlash}`); + open(`${window.sessionStorage.getItem("GITHUB_REPOSITORY_URL") ?? ""}/blob/master${hrefWithLeadingSlash}`); } return; // ensure no other flow is triggered diff --git a/pwa/src/hooks/htmlParser/image/getImage.tsx b/pwa/src/hooks/htmlParser/image/getImage.tsx index 979ac26f..f3c0ba31 100644 --- a/pwa/src/hooks/htmlParser/image/getImage.tsx +++ b/pwa/src/hooks/htmlParser/image/getImage.tsx @@ -4,7 +4,7 @@ export const getImage = (props: any) => { let src = props.src; if (!props.src.includes("https://" || "http://")) { - const sessionUrl = process.env.GATSBY_GITHUB_REPOSITORY_URL; + const sessionUrl = window.sessionStorage.getItem("GITHUB_REPOSITORY_URL"); const url = sessionUrl?.replace("https://github.com/", ""); src = `https://raw.githubusercontent.com/${url}/master/docs/features/${props.src}`; diff --git a/pwa/src/hooks/useMarkdownDirectories.ts b/pwa/src/hooks/useMarkdownDirectories.ts index 107afcf6..d70a44f5 100644 --- a/pwa/src/hooks/useMarkdownDirectories.ts +++ b/pwa/src/hooks/useMarkdownDirectories.ts @@ -9,7 +9,7 @@ export const useMarkdownDirectories = () => { const [directories, setDirectories] = React.useState([]); React.useEffect(() => { - const markdownDirectoryPathsString: string | undefined = process.env.GATSBY_GITHUB_DOCS_DIRECTORY_PATHS; + const markdownDirectoryPathsString: string | null = window.sessionStorage.getItem("GITHUB_DOCS_DIRECTORY_PATHS"); if (!markdownDirectoryPathsString) return; diff --git a/pwa/src/layout/Head.tsx b/pwa/src/layout/Head.tsx index 1495f44d..5ab8c01a 100644 --- a/pwa/src/layout/Head.tsx +++ b/pwa/src/layout/Head.tsx @@ -26,13 +26,13 @@ export const Head: React.FC = () => { lang: currentLanguage, }} bodyAttributes={{ - class: process.env.GATSBY_NL_DESIGN_THEME_CLASSNAME, + class: window.sessionStorage.getItem("NL_DESIGN_THEME_CLASSNAME"), }} > - {`Woo | ${process.env.GATSBY_ORGANISATION_NAME} | ${ + <title>{`Woo | ${window.sessionStorage.getItem("ORGANISATION_NAME")} | ${ getPageTitle(translatedCrumbs, gatsbyContext.location) ?? "Error" }`} - + ); }; diff --git a/pwa/src/layout/Layout.tsx b/pwa/src/layout/Layout.tsx index 2298702d..1c52427f 100644 --- a/pwa/src/layout/Layout.tsx +++ b/pwa/src/layout/Layout.tsx @@ -12,6 +12,7 @@ import { fas } from "@fortawesome/free-solid-svg-icons"; import { fab } from "@fortawesome/free-brands-svg-icons"; import { far } from "@fortawesome/free-regular-svg-icons"; import { IconPack, library } from "@fortawesome/fontawesome-svg-core"; +import { initiateEnvironment } from "../services/initiateEnvironment"; import { ToolTip } from "@conduction/components"; export const TOOLTIP_ID = "cb8f47c3-7151-4a46-954d-784a531b01e6"; @@ -28,6 +29,10 @@ const Layout: React.FC = ({ children, pageContext, location }) => { library.add(fas, fab as IconPack, far as IconPack); + React.useEffect(() => { + initiateEnvironment(); + }, []); + React.useEffect(() => { setAPI(new APIService()); }, [pageContext]); diff --git a/pwa/src/services/getConfig.ts b/pwa/src/services/getConfig.ts new file mode 100644 index 00000000..71805827 --- /dev/null +++ b/pwa/src/services/getConfig.ts @@ -0,0 +1,14 @@ +import Conduction from "./../../static/configFiles/conduction.json"; +import Epe from "./../../static/configFiles/epe.json"; +import Noordwijk from "./../../static/configFiles/noordwijk.json"; + +export const getConfig = (domain: string): Record | undefined => { + switch (domain) { + case "open.epe.nl": + return Epe as Record; + case "open.noordwijk.nl": + return Noordwijk as Record; + default: + return Conduction as Record; + } +}; diff --git a/pwa/src/services/initiateEnvironment.ts b/pwa/src/services/initiateEnvironment.ts new file mode 100644 index 00000000..6ffa76dc --- /dev/null +++ b/pwa/src/services/initiateEnvironment.ts @@ -0,0 +1,33 @@ +import { getConfig } from "./getConfig"; + +export const initiateEnvironment = () => { + const varsAvailable = process.env.GATSBY_ENV_VARS_SET === "true"; + + if (varsAvailable) { + 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 ?? ""); + window.sessionStorage.setItem("ORGANISATION_NAME", process.env.GATSBY_ORGANISATION_NAME ?? ""); + window.sessionStorage.setItem("JUMBOTRON_IMAGE_URL", process.env.GATSBY_JUMBOTRON_IMAGE_URL ?? ""); + window.sessionStorage.setItem("FOOTER_LOGO_HREF", process.env.GATSBY_FOOTER_LOGO_HREF ?? ""); + window.sessionStorage.setItem("FOOTER_CONTENT", process.env.FOOTER_CONTENT ?? ""); + window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", process.env.GATSBY_FOOTER_CONTENT_HEADER ?? ""); + window.sessionStorage.setItem("OIDN_NUMBER", process.env.GATSBY_OIDN_NUMBER ?? ""); + + return; // all vars are set in sessionStorage, nothing else to do + } + + const config = getConfig(window.location.hostname); + + if (!config) return; // no config found, nothing else to do + + 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 ?? ""); + window.sessionStorage.setItem("ORGANISATION_NAME", config.GATSBY_ORGANISATION_NAME ?? ""); + window.sessionStorage.setItem("JUMBOTRON_IMAGE_URL", config.GATSBY_JUMBOTRON_IMAGE_URL ?? ""); + window.sessionStorage.setItem("FOOTER_LOGO_HREF", config.GATSBY_FOOTER_LOGO_HREF ?? ""); + window.sessionStorage.setItem("FOOTER_CONTENT", config.GATSBY_FOOTER_CONTENT ?? ""); + window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", config.GATSBY_FOOTER_CONTENT_HEADER ?? ""); + window.sessionStorage.setItem("OIDN_NUMBER", config.GATSBY_OIDN_NUMBER ?? ""); +}; diff --git a/pwa/src/templates/jumbotronTemplate/JumbotronTemplate.tsx b/pwa/src/templates/jumbotronTemplate/JumbotronTemplate.tsx index a265b6ba..a5096d67 100644 --- a/pwa/src/templates/jumbotronTemplate/JumbotronTemplate.tsx +++ b/pwa/src/templates/jumbotronTemplate/JumbotronTemplate.tsx @@ -11,18 +11,19 @@ export const JumbotronTemplate: React.FC = () => {
- {t("Woo-publications of")} {process.env.GATSBY_ORGANISATION_NAME} + {t("Woo-publications of")} {window.sessionStorage.getItem("ORGANISATION_NAME")} - {t("On this page you will find the Woo-publications of")} {process.env.GATSBY_ORGANISATION_NAME} + {t("On this page you will find the Woo-publications of")}{" "} + {window.sessionStorage.getItem("ORGANISATION_NAME")} diff --git a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx index f84fac1a..60c62f53 100644 --- a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx +++ b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx @@ -11,12 +11,11 @@ import { Button } from "@utrecht/component-library-react/dist/css-module"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faMagnifyingGlass, faSpinner } from "@fortawesome/free-solid-svg-icons"; import { generateYearsArray } from "../../../data/years"; -import { TEMP_PUBLICATION_TYPES } from "../../../data/PublicationType"; import { useTranslation } from "react-i18next"; import { filtersToUrlQueryParams } from "../../../services/filtersToQueryParams"; import { navigate } from "gatsby"; import { useGatsbyContext } from "../../../context/gatsby"; -import { useFilterCount } from "../../../hooks/filterCount"; +import { useAvailableFilters } from "../../../hooks/availableFilters"; interface FiltersTemplateProps { isLoading: boolean; @@ -62,7 +61,7 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = }; const handleSetSelectFormValues = (params: any): void => { - getItems.isSuccess && + getCategories.isSuccess && setValue( "category", categoryOptions.find((option: any) => option.value === params.Categorie?.replace(/_/g, " ")), @@ -105,19 +104,18 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = navigate(`/${filtersToUrlQueryParams(filters)}`); }, [filters]); - const getItems = useFilterCount().getCategoryCount(); + const getCategories = useAvailableFilters().getCategories(); React.useEffect(() => { - if (!getItems.isSuccess) return; + if (!getCategories.isSuccess) return; - const categoriesWithData = getItems.data.Categorie.map((test: any) => { - return TEMP_PUBLICATION_TYPES?.find((option) => { - return option.value === test._id.toLowerCase(); - }); - }); + const categoriesWithData = getCategories.data.Categorie.map((category: any) => ({ + label: _.upperFirst(category._id.toLowerCase()), + value: category._id.toLowerCase(), + })); - setCategoryOptions(Array.from(new Set(categoriesWithData))); - }, [getItems.isSuccess]); + setCategoryOptions(_.orderBy(_.uniqBy(categoriesWithData, "value"), "label", "asc")); + }, [getCategories.isSuccess]); return (
@@ -144,15 +142,15 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = ariaLabel={t("Select year")} /> - {getItems.isLoading && } - {getItems.isSuccess && ( + {getCategories.isLoading && } + {getCategories.isSuccess && ( option.value === filters.Categorie)} + defaultValue={categoryOptions && categoryOptions.find((option: any) => option.value === filters.Categorie)} isClearable - disabled={getItems.isLoading} + disabled={getCategories.isLoading} {...{ register, errors, control }} ariaLabel={t("Select category")} /> diff --git a/pwa/src/templates/templateParts/footer/FooterTemplate.tsx b/pwa/src/templates/templateParts/footer/FooterTemplate.tsx index 5f511489..bf17e007 100644 --- a/pwa/src/templates/templateParts/footer/FooterTemplate.tsx +++ b/pwa/src/templates/templateParts/footer/FooterTemplate.tsx @@ -59,16 +59,6 @@ export const FooterTemplate: React.FC = () => { // setFooterContent(data); // }, []); - React.useEffect(() => { - if (!process.env.GATSBY_FOOTER_CONTENT) return; - - try { - setFooterContent(JSON.parse(process.env.GATSBY_FOOTER_CONTENT)); - } catch { - console.warn("Could not parse footer content."); - } - }, [process.env.GATSBY_FOOTER_CONTENT]); - return (
@@ -79,11 +69,13 @@ export const FooterTemplate: React.FC = () => {
- {process.env.GATSBY_FOOTER_LOGO_URL !== "false" && ( + {window.sessionStorage.getItem("FOOTER_LOGO_URL") !== "false" && ( - process.env.GATSBY_FOOTER_LOGO_HREF ? open(process.env.GATSBY_FOOTER_LOGO_HREF) : navigate("/") + window.sessionStorage.getItem("FOOTER_LOGO_HREF") + ? open(window.sessionStorage.getItem("FOOTER_LOGO_HREF") ?? "") + : navigate("/") } /> )} @@ -100,7 +92,7 @@ const DynamicSection: React.FC<{ content: TDynamicContentItem }> = ({ content }) return (
- + {content.items.map((item, idx) => (
diff --git a/pwa/static/.env.development b/pwa/static/.env.development index e2d36e44..0796d9df 100644 --- a/pwa/static/.env.development +++ b/pwa/static/.env.development @@ -23,3 +23,6 @@ GATSBY_FOOTER_CONTENT_HEADER="" #OIDN GATSBY_OIDN_NUMBER="" + +# Deployment option, if you're using this .env file DO NOT REMOVE OR EDIT THIS +GATSBY_ENV_VARS_SET="true" diff --git a/pwa/static/configFiles/conduction.json b/pwa/static/configFiles/conduction.json new file mode 100644 index 00000000..d0940ff4 --- /dev/null +++ b/pwa/static/configFiles/conduction.json @@ -0,0 +1,11 @@ +{ + "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==", + "GATSBY_ORGANISATION_NAME": "Conduction", + "GATSBY_JUMBOTRON_IMAGE_URL": "https://www.conduction.nl/wp-content/uploads/2021/07/cropped-Conduction_HOME_0000_afb1-1.png", + "GATSBY_FOOTER_LOGO_HREF": "https://www.conduction.nl/", + "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/pwa/src/templates/templateParts/footer/FooterContent.json", + "GATSBY_FOOTER_CONTENT_HEADER": "", + "GATSBY_OIDN_NUMBER": "" +} diff --git a/pwa/static/configFiles/epe.json b/pwa/static/configFiles/epe.json new file mode 100644 index 00000000..4bb0e6d1 --- /dev/null +++ b/pwa/static/configFiles/epe.json @@ -0,0 +1,11 @@ +{ + "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", + "GATSBY_ORGANISATION_NAME": "Gemeente Epe", + "GATSBY_JUMBOTRON_IMAGE_URL": "https://www.epe.nl/sites/default/files/styles/hero_medium/public/2023-09/Koeien.jpg?h=18223889&itok=BSberuIC", + "GATSBY_FOOTER_LOGO_HREF": "https://www.epe.nl/", + "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-epe/main/FooterContent.json", + "GATSBY_FOOTER_CONTENT_HEADER": "heading-3", + "GATSBY_OIDN_NUMBER": "00000001001104524000" +} diff --git a/pwa/static/configFiles/noordwijk.json b/pwa/static/configFiles/noordwijk.json new file mode 100644 index 00000000..61e707af --- /dev/null +++ b/pwa/static/configFiles/noordwijk.json @@ -0,0 +1,11 @@ +{ + "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", + "GATSBY_ORGANISATION_NAME": "Gemeente Noordwijk", + "GATSBY_JUMBOTRON_IMAGE_URL": "https://raw.githubusercontent.com/ConductionNL/woo-website-noordwijk/main/images/Bollenvelden%20Panorama%20Noordwijkerhout%20-%20Luchtfoto%5B3766%5D.JPG", + "GATSBY_FOOTER_LOGO_HREF": "https://www.noordwijk.nl/", + "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-noordwijk/main/FooterContent.json", + "GATSBY_FOOTER_CONTENT_HEADER": "heading-2", + "GATSBY_OIDN_NUMBER": "00000001825792150000" +} diff --git a/pwa/tsconfig.json b/pwa/tsconfig.json index 08214f8e..43d4b660 100644 --- a/pwa/tsconfig.json +++ b/pwa/tsconfig.json @@ -9,7 +9,8 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, - "skipLibCheck": true + "skipLibCheck": true, + "resolveJsonModule": true }, "include": ["./src/**/*"] }