Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into docupdate-integratie
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvdlinde committed Nov 27, 2023
2 parents 0f5fe86 + eba5de4 commit fbe42b5
Show file tree
Hide file tree
Showing 26 changed files with 352 additions and 139 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ De implementatie van de Wet Open Overheid brengt twee kernuitdagingen met zich m
2. **Proactieve Publicatie:**
Overheden moeten informatie proactief te publiceren. Dit betekent dat publicatie onderdeel moet worden van het normale werkproces. Hiermee is het richting de toekomst niet haalbaar om Woo-publicaties handmatig via een apart systeem (bijvoorbeeld CMS website) te laten verlopen.

Deze uitdagingen kunnen niet effectief worden aangepakt met een enkel Content Management Systeem (CMS) of door levering vanuit één systeem. Handmatige publicatie van alle overheidsinformatie zou een aanzienlijke personele inzet vereisen, wat onpraktisch is. Daarbij komt dat de verscheidenheid aan publicatietypen vaak verdeeld is over meerdere systemen, wat de situatie verder compliceert.
Deze uitdagingen kunnen niet effectief worden aangepakt met een enkel Content Management Systeem (CMS) of door levering vanuit één systeem. Handmatige publicatie van alle overheidsinformatie zou een aanzienlijke personele inzet vereisen, wat onpraktisch is. Daarbij komt het voor dat verscheidende categorieën vaak verdeeld zijn over meerdere systemen, wat de situatie verder compliceert.

## Oplossing

Expand All @@ -30,7 +30,7 @@ De Open Woo-app biedt een geïntegreerde oplossing die bestaat uit een aantal ho
Een interface waarmee belanghebbenden binnen een organisatie naar relevante informatie kunnen zoeken.

3. **Koppelvlak:**
Een module die in staat is om informatie uit verschillende systemen te verzamelen, waardoor een gecentraliseerde toegang tot diverse publicatietypen mogelijk wordt.
Een module die in staat is om informatie uit verschillende systemen te verzamelen, waardoor een gecentraliseerde toegang tot diverse categorieën mogelijk wordt.

4. **CMS-module:**
Een aanvullende module voor het handmatig invoeren van informatie die niet automatisch kan worden opgehaald, en voor het beheren van de gepubliceerde pagina's.
Expand Down Expand Up @@ -73,14 +73,14 @@ De Woo specificeert een aantal categorieën (zie configuratie) die door een orga
## Praktijk voorbeelden
Op dit moment wordt de OpenWoo.app al door een aantal organisaties gebruikt

| Organisatie | Type | Woo Pagina | Woo Bron(en) | Status |
|-------------|------------|-------------------------|------------|
| [Noordwijk](https://www.noordwijk.nl/) | Gemeente | [Pagina](https://conductionnl.github.io/woo-website-noordwijk/) | Zaaksysteem | Acceptatie |
| [Tubbergen](https://www.tubbergen.nl/) | Gemeente |[Pagina](https://conductionnl.github.io/woo-website-tubbergen/) | Zaaksysteem | Acceptatie |
| Organisatie | Type | Woo Pagina | Woo Bron | Status |
|-------------|------|------------|--------------|--------|
| [Noordwijk](https://www.noordwijk.nl/) | Gemeente | [Pagina](https://conductionnl.github.io/woo-website-noordwijk/) | Zaaksysteem.nl | Acceptatie |
| [Tubbergen](https://www.tubbergen.nl/) | Gemeente |[Pagina](https://conductionnl.github.io/woo-website-tubbergen/) | Zaaksysteem.nl | Acceptatie |
| [Epe](https://www.epe.nl/) | Gemeente |[Pagina](https://open.epe.nl/) | Zaaksysteem | Productie |
| [Dinkelland](https://www.dinkelland.nl/) | Gemeente |[Pagina](https://conductionnl.github.io/woo-website-dinkelland/) | Zaaksysteem | Acceptatie |
| [Dinkelland](https://www.dinkelland.nl/) | Gemeente |[Pagina](https://conductionnl.github.io/woo-website-dinkelland/) | Zaaksysteem.nl | Acceptatie |
| [Rotterdam (Alleen vormgeving)](https://www.rotterdam.nl/) | Gemeente |[Pagina](https://conductionnl.github.io/woo-website-rotterdam/) | Demo Omgeving | Demo |
| [Noaberkracht](https://www.dinkelland.nl/noaberkracht-dinkelland-tubbergen) | Samenwerkingsverband | [Pagina](https://conductionnl.github.io/woo-website-noaberkracht/) | Zaaksysteem | Acceptatie |
| [Noaberkracht](https://www.dinkelland.nl/noaberkracht-dinkelland-tubbergen) | Samenwerkingsverband | [Pagina](https://conductionnl.github.io/woo-website-noaberkracht/) | Zaaksysteem.nl | Acceptatie |
| [Leiden (Alleen vormgeving)](https://gemeente.leiden.nl/) | Gemeente | [Pagina](https://conductionnl.github.io/woo-website-leiden/) | Demo Omgeving | Demo |
| [Xxllnc (Demo omgeving)](https://xxllnc.nl/) | Leverancier | [Pagina](https://conductionnl.github.io/woo-website-xxllnc/) | Demo Omgeving | Demo |

Expand Down
3 changes: 3 additions & 0 deletions pwa/src/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from "react";
import * as styles from "./Content.module.css";
import { FooterTemplate } from "./templates/templateParts/footer/FooterTemplate";
import { HeaderTemplate } from "./templates/templateParts/header/HeaderTemplate";
import { ThemeSwitcherTopBar } from "./templates/templateParts/themeSwitcherTopBar/ThemeSwitcherTopBar";

interface ContentProps {
children: React.ReactNode;
Expand All @@ -10,6 +11,8 @@ interface ContentProps {
export const Content: React.FC<ContentProps> = ({ children }) => {
return (
<div className={styles.container}>
<ThemeSwitcherTopBar />

<HeaderTemplate layoutClassName={styles.header} />

<div className={styles.pageContent}>{children}</div>
Expand Down
2 changes: 1 addition & 1 deletion pwa/src/apiService/resources/availableFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class AvailableFilters {
let endpoint = "/openWOO?_queries[]=Categorie";

if (window.sessionStorage.getItem("OIDN_NUMBER")) {
endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
}

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
2 changes: 1 addition & 1 deletion pwa/src/apiService/resources/openWoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class OpenWoo {
)}&_order[Publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`;

if (window.sessionStorage.getItem("OIDN_NUMBER")) {
endpoint += `&oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
endpoint += `&behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`;
}

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
12 changes: 8 additions & 4 deletions pwa/src/hooks/footerContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ export const useFooterContent = () => {
const fileName = getFileNameFromUrl(window.sessionStorage.getItem("FOOTER_CONTENT") ?? DEFAULT_FOOTER_CONTENT_URL);

const getContent = () =>
useQuery<any, Error>(["contents", fileName], () => API?.FooterContent.getContent(fileName), {
onError: (error) => {
console.warn(error.message);
useQuery<any, Error>(
["contents", window.sessionStorage.getItem("FOOTER_CONTENT")],
() => API?.FooterContent.getContent(fileName),
{
onError: (error) => {
console.warn(error.message);
},
},
});
);

return { getContent };
};
18 changes: 11 additions & 7 deletions pwa/src/hooks/openWoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const useOpenWoo = (queryClient: QueryClient) => {

const getAll = (filters: IFiltersContext, currentPage: number, limit: number) =>
useQuery<any, Error>(
["OpenWoo", filters, currentPage, limit],
["OpenWoo", filters, currentPage, limit, window.sessionStorage.getItem("OIDN_NUMBER")],
() => API?.OpenWoo.getAll(filters, currentPage, limit),
{
onError: (error) => {
Expand All @@ -19,13 +19,17 @@ export const useOpenWoo = (queryClient: QueryClient) => {
);

const getOne = (requestId: string) =>
useQuery<any, Error>(["OpenWoo", requestId], () => API?.OpenWoo.getOne(requestId), {
initialData: () => queryClient.getQueryData<any[]>("OpenWoo")?.find((_OpenWoo) => _OpenWoo.id === requestId),
onError: (error) => {
throw new Error(error.message);
useQuery<any, Error>(
["OpenWoo", requestId, window.sessionStorage.getItem("OIDN_NUMBER")],
() => API?.OpenWoo.getOne(requestId),
{
initialData: () => queryClient.getQueryData<any[]>("OpenWoo")?.find((_OpenWoo) => _OpenWoo.id === requestId),
onError: (error) => {
throw new Error(error.message);
},
enabled: !!requestId,
},
enabled: !!requestId,
});
);

return { getAll, getOne };
};
71 changes: 71 additions & 0 deletions pwa/src/hooks/useEnvironment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import * as React from "react";
import { getConfig } from "../services/getConfig";
import { uniqueId } from "lodash";

export const useEnvironment = () => {
const [, setSessionStorageUpdatedId] = React.useState("-1");

const handleStorageChange = () => {
setSessionStorageUpdatedId(uniqueId());
themeSwitcherMiddleware();
};

const updateSessionStorage = () => {
window.dispatchEvent(new Event("sessionStorageChange"));
};

React.useEffect(() => {
window.addEventListener("sessionStorageChange", handleStorageChange);

return () => {
window.removeEventListener("sessionStorageChange", handleStorageChange);
};
}, []);

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 ?? "");
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.GATSBY_FOOTER_CONTENT ?? "");
window.sessionStorage.setItem("FOOTER_CONTENT_HEADER", process.env.GATSBY_FOOTER_CONTENT_HEADER ?? "");
window.sessionStorage.setItem("OIDN_NUMBER", process.env.GATSBY_OIDN_NUMBER ?? "");

updateSessionStorage();
};

const initiateFromJSON = (themeOrDomainName: string) => {
const config = getConfig(themeOrDomainName);

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 ?? "");
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 ?? "");

updateSessionStorage();
};

const themeSwitcherMiddleware = () => {
switch (window.location.hostname) {
case "koophulpje.nl":
// case "localhost": // development purposes
window.sessionStorage.setItem("SHOW_THEME_SWITCHER", "true");
break;
}

if (process.env.GATSBY_SHOW_THEME_SWITCHER === "true") window.sessionStorage.setItem("SHOW_THEME_SWITCHER", "true");
};

return { initiateFromEnv, initiateFromJSON };
};
9 changes: 7 additions & 2 deletions pwa/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +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 { useEnvironment } from "../hooks/useEnvironment";

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -23,11 +23,16 @@ interface LayoutProps {
const Layout: React.FC<LayoutProps> = ({ children, pageContext, location }) => {
const [API, setAPI] = React.useState<APIService>(React.useContext(APIContext));
const [globalContext, setGlobalContext] = React.useState<IGlobalContext>(defaultGlobalContext);
const { initiateFromEnv, initiateFromJSON } = useEnvironment();

library.add(fas, fab as IconPack, far as IconPack);

React.useEffect(() => {
initiateEnvironment();
if (process.env.GATSBY_ENV_VARS_SET === "true") {
initiateFromEnv();
} else {
initiateFromJSON(window.location.hostname);
}
}, []);

React.useEffect(() => {
Expand Down
81 changes: 66 additions & 15 deletions pwa/src/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,78 @@ import Dinkelland from "./../../static/configFiles/dinkelland.json";
import Epe from "./../../static/configFiles/epe.json";
import Noaberkracht from "./../../static/configFiles/noaberkracht.json";
import Noordwijk from "./../../static/configFiles/noordwijk.json";
import OpenWebconcept from "./../../static/configFiles/open-webconcept.json";
import Rotterdam from "./../../static/configFiles/rotterdam.json";
import Tubbergen from "./../../static/configFiles/tubbergen.json";
import Xxllnc from "./../../static/configFiles/xxllnc.json";

export const getConfig = (domain: string): Record<string, any> | undefined => {
switch (domain) {
export const getConfig = (themeOrDomainName: string): Record<string, any> | undefined => {
switch (themeOrDomainName) {
case "open.epe.nl":
return Epe as Record<string, any>;
case "epe-theme":
return Epe;
case "open.noordwijk.nl":
return Noordwijk as Record<string, any>;
// case "open.rotterdam.nl":
// return Rotterdam as Record<string, any>;
// case "open.noaberkracht.nl":
// return Noaberkracht as Record<string, any>;
// case "open.tubbergen.nl":
// return Tubbergen as Record<string, any>;
// case "open.dinkelland.nl":
// return Dinkelland as Record<string, any>;
// case "open.xxllnc.nl":
// return Xxllnc as Record<string, any>;
case "noordwijk-theme":
return Noordwijk;
case "open.rotterdam.nl":
case "rotterdam-theme":
return Rotterdam;
case "open.noaberkracht.nl":
case "noaberkracht-theme":
return Noaberkracht;
case "open.tubbergen.nl":
case "tubbergen-theme":
return Tubbergen;
case "open.dinkelland.nl":
case "dinkelland-theme":
return Dinkelland;
case "open.xxllnc.nl":
case "xxllnc-theme":
return Xxllnc;
case "koophulpje.nl":
case "open-webconcept-theme":
// case "localhost": // development purposes
return OpenWebconcept;
default:
return Conduction as Record<string, any>;
return Conduction;
}
};

export const availableThemes: { label: string; value: string }[] = [
{
label: "Koophulpje",
value: "open-webconcept-theme",
},
{
label: "Conduction",
value: "conduction-theme",
},
{
label: "Dinkelland",
value: "dinkelland-theme",
},
{
label: "Epe",
value: "epe-theme",
},
{
label: "Noaberkracht",
value: "noaberkracht-theme",
},
{
label: "Noordwijk",
value: "noordwijk-theme",
},
{
label: "Rotterdam",
value: "rotterdam-theme",
},
{
label: "Tubbergen",
value: "tubbergen-theme",
},
{
label: "XXLLNC",
value: "xxllnc-theme",
},
];
33 changes: 0 additions & 33 deletions pwa/src/services/initiateEnvironment.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<div className={styles.componentsGrid}>
{requests.map((request) => (
<CardWrapper
key={request.id}
key={request._self.id}
className={styles.cardContainer}
onClick={() => navigate(request.id)}
onClick={() => navigate(request._self.id)}
tabIndex={0}
aria-label={`${request.Titel}, ${request.Samenvatting}, ${
request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")
aria-label={`${request.titel}, ${request.samenvatting}, ${
request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")
}`}
>
<CardHeader className={styles.cardHeader}>
<CardHeaderDate>
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : t("N/A")}
{request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A")}
</CardHeaderDate>
<CardHeaderTitle className={styles.title}>
<Heading2>{request.Titel ?? t("No title available")}</Heading2>
<Heading2>{request.titel ?? t("No title available")}</Heading2>
</CardHeaderTitle>
</CardHeader>

<Paragraph className={styles.description}>{request.Samenvatting}</Paragraph>
<Paragraph className={styles.description}>{request.samenvatting}</Paragraph>
</CardWrapper>
))}
</div>
Expand Down
Loading

0 comments on commit fbe42b5

Please sign in to comment.