Skip to content

Commit

Permalink
Merge pull request #92 from ConductionNL/development
Browse files Browse the repository at this point in the history
Development to main, week 47
  • Loading branch information
remko48 authored Nov 27, 2023
2 parents 899ec9f + 810f0cd commit 7dd956d
Show file tree
Hide file tree
Showing 10 changed files with 4,231 additions and 5,790 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/pull-request-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Remove cache, modules and public
run: rm -rf pwa/node_modules && rm -rf pwa/.cache && rm -rf pwa/public

- name: Parcel/watcher
run: npm i @parcel/watcher

- name: Install dependencies
run: cd pwa && npm i

Expand Down
9,324 changes: 3,662 additions & 5,662 deletions pwa/package-lock.json

Large diffs are not rendered by default.

135 changes: 69 additions & 66 deletions pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,85 @@
"prepare": "cd .. && husky install"
},
"dependencies": {
"@conduction/components": "2.2.8",
"@conduction/theme": "1.0.41",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.1.18",
"@nl-design-system-unstable/amsterdam-design-tokens": "^1.0.0-alpha.107",
"@nl-design-system-unstable/bodegraven-reeuwijk-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/borne-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/buren-design-tokens": "^1.0.0-alpha.83",
"@nl-design-system-unstable/demodam-design-tokens": "^1.0.0-alpha.95",
"@nl-design-system-unstable/drechterland-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/duiven-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/duo-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/enkhuizen-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/groningen-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/haarlem-design-tokens": "^1.0.0-alpha.107",
"@nl-design-system-unstable/haarlemmermeer-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/hoorn-design-tokens": "^1.0.0-alpha.96",
"@nl-design-system-unstable/horstaandemaas-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/leidschendam-voorburg-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/nijmegen-design-tokens": "^1.0.0-alpha.95",
"@nl-design-system-unstable/noordoostpolder-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/provincie-zuid-holland-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/rotterdam-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/stedebroec-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/tilburg-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/venray-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/vught-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/westervoort-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/zevenaar-design-tokens": "^1.0.0-alpha.100",
"@nl-design-system-unstable/zwolle-design-tokens": "^1.0.0-alpha.100",
"@tabler/icons-react": "2.21.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@utrecht/design-tokens": "^1.0.0-alpha.524",
"@utrecht/web-component-library-react": "^1.0.0-alpha.530",
"@utrecht/component-library-react": "^1.0.0-alpha.355",
"axios": "^0.25.0",
"clsx": "^1.1.1",
"@conduction/components": "2.2.30",
"@conduction/theme": "1.0.55",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@nl-design-system-unstable/amsterdam-design-tokens": "^1.0.0-alpha.128",
"@nl-design-system-unstable/bodegraven-reeuwijk-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/borne-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/buren-design-tokens": "^1.0.0-alpha.104",
"@nl-design-system-unstable/demodam-design-tokens": "^1.0.0-alpha.116",
"@nl-design-system-unstable/drechterland-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/duiven-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/duo-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/enkhuizen-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/groningen-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/haarlem-design-tokens": "^1.0.0-alpha.128",
"@nl-design-system-unstable/haarlemmermeer-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/hoorn-design-tokens": "^1.0.0-alpha.117",
"@nl-design-system-unstable/horstaandemaas-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/leidschendam-voorburg-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/nijmegen-design-tokens": "^1.0.0-alpha.116",
"@nl-design-system-unstable/noordoostpolder-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/provincie-zuid-holland-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/rotterdam-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/stedebroec-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/tilburg-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/venray-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/vught-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/westervoort-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/zevenaar-design-tokens": "^1.0.0-alpha.121",
"@nl-design-system-unstable/zwolle-design-tokens": "^1.0.0-alpha.121",
"@tabler/icons-react": "2.42.0",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@utrecht/design-tokens": "^1.0.0-alpha.607",
"@utrecht/web-component-library-react": "^1.0.2",
"@utrecht/component-library-react": "^2.0.0",
"axios": "^1.6.2",
"clsx": "^2.0.0",
"dateformat": "^5.0.3",
"dedent": "^0.7.0",
"gatsby": "^4.11.1",
"gatsby-plugin-breadcrumb": "^12.3.1",
"gatsby-plugin-layout": "^3.11.0",
"html-react-parser": "^4.0.0",
"i18next": "^21.6.16",
"jwt-decode": "^3.1.2",
"dedent": "^1.5.1",
"gatsby": "^5.12.11",
"gatsby-plugin-breadcrumb": "^12.3.2",
"gatsby-plugin-layout": "^4.12.0",
"html-react-parser": "^5.0.6",
"i18next": "^23.7.6",
"jwt-decode": "^4.0.0",
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-collapsible": "^2.10.0",
"react-dom": "^18.2.0",
"react-favicon": "^1.0.1",
"react-favicon": "^2.0.3",
"react-helmet": "^6.1.0",
"react-hook-form": "7.29.0",
"react-hook-form": "7.48.2",
"react-hot-toast": "^2.4.1",
"react-i18next": "^11.16.6",
"react-loading-skeleton": "^3.1.0",
"react-paginate": "^8.1.4",
"react-query": "^3.34.19",
"react-select": "^5.3.2"
"react-i18next": "^13.5.0",
"react-loading-skeleton": "^3.3.1",
"react-paginate": "^8.2.0",
"react-query": "^3.39.3",
"react-select": "^5.8.0"
},
"devDependencies": {
"@types/dateformat": "^5.0.0",
"@types/dedent": "^0.7.0",
"@types/node": "^17.0.23",
"@types/react-helmet": "^6.1.5",
"@typescript-eslint/eslint-plugin": "^5.55.0",
"@typescript-eslint/parser": "^5.55.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-react": "^7.32.2",
"gh-pages": "^5.0.0",
"@parcel/watcher": "^2.3.0",
"@types/dateformat": "^5.0.2",
"@types/dedent": "^0.7.2",
"@types/node": "^20.9.4",
"@types/react-helmet": "^6.1.9",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-react": "^7.33.2",
"gh-pages": "^6.1.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"lint-staged": "^15.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.5",
"typescript": "^4.6.3"
"prettier": "^3.1.0",
"typescript": "^5.3.2"
}
}
14 changes: 14 additions & 0 deletions pwa/src/apiService/apiService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import axios, { AxiosInstance, AxiosResponse } from "axios";
import toast from "react-hot-toast";
import { removeFileNameFromUrl } from "../services/FileNameFromUrl";
import { DEFAULT_FOOTER_CONTENT_URL } from "../templates/templateParts/footer/FooterTemplate";

// Resources
import GitHub from "./resources/gitHub";
import FooterContent from "./resources/footerContent";

interface PromiseMessage {
loading?: string;
Expand All @@ -26,10 +30,20 @@ export default class APIService {
});
}

public get FooterContentClient(): AxiosInstance {
return axios.create({
baseURL: removeFileNameFromUrl(window.sessionStorage.getItem("FOOTER_CONTENT") ?? DEFAULT_FOOTER_CONTENT_URL),
});
}

public get GitHub(): GitHub {
return new GitHub(this.gitHubClient, this.Send);
}

public get FooterContent(): FooterContent {
return new FooterContent(this.FooterContentClient, this.Send);
}

// Send method
public Send: TSendFunction = (instance, method, endpoint, payload, promiseMessage) => {
const _payload = JSON.stringify(payload);
Expand Down
18 changes: 18 additions & 0 deletions pwa/src/apiService/resources/footerContent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { TSendFunction } from "../apiService";
import { AxiosInstance } from "axios";

export default class FooterContent {
private _instance: AxiosInstance;
private _send: TSendFunction;

constructor(_instance: AxiosInstance, send: TSendFunction) {
this._instance = _instance;
this._send = send;
}

public getContent = async (fileName: string): Promise<any> => {
const { data } = await this._send(this._instance, "GET", fileName);

return data;
};
}
21 changes: 21 additions & 0 deletions pwa/src/hooks/footerContent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from "react";
import { useQuery } from "react-query";
import APIService from "../apiService/apiService";
import APIContext from "../apiService/apiContext";
import { getFileNameFromUrl } from "../services/FileNameFromUrl";
import { DEFAULT_FOOTER_CONTENT_URL } from "../templates/templateParts/footer/FooterTemplate";

export const useFooterContent = () => {
const API: APIService | null = React.useContext(APIContext);

const fileName = getFileNameFromUrl(window.sessionStorage.getItem("FOOTER_CONTENT") ?? DEFAULT_FOOTER_CONTENT_URL);

const getContent = () =>
useQuery<any, Error>(["footer-content", fileName], () => API?.FooterContent.getContent(fileName), {
onError: (error) => {
console.warn(error.message);
},
});

return { getContent };
};
8 changes: 7 additions & 1 deletion pwa/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import * as React from "react";
import * as styles from "./Layout.module.css";
import "../translations/i18n";
import clsx from "clsx";
import APIContext, { APIProvider } from "../apiService/apiContext";
import APIService from "../apiService/apiService";
import { defaultGlobalContext, GlobalProvider, IGlobalContext } from "../context/global";
import { Head } from "./Head";
import { Content } from "../Content";
import { Document } from "@utrecht/component-library-react/dist/css-module";
import { Toaster } from "react-hot-toast";
import clsx from "clsx";
import { IconPack, library } from "@fortawesome/fontawesome-svg-core";
import { fas } from "@fortawesome/free-solid-svg-icons";
import { fab } from "@fortawesome/free-brands-svg-icons";
import { far } from "@fortawesome/free-regular-svg-icons";

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -20,6 +24,8 @@ const Layout: React.FC<LayoutProps> = ({ children, pageContext, location }) => {
const [API, setAPI] = React.useState<APIService>(React.useContext(APIContext));
const [globalContext, setGlobalContext] = React.useState<IGlobalContext>(defaultGlobalContext);

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

React.useEffect(() => {
setAPI(new APIService());
}, [pageContext]);
Expand Down
9 changes: 9 additions & 0 deletions pwa/src/services/FileNameFromUrl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const getFileNameFromUrl = (url: string) => {
const finalSlashIndex = url.lastIndexOf("/");
return url.substring(finalSlashIndex + 1);
};

export const removeFileNameFromUrl = (url: string) => {
const finalSlashIndex = url.lastIndexOf("/");
return url.replace(`/${url.substring(finalSlashIndex + 1)}`, "");
};
Loading

0 comments on commit 7dd956d

Please sign in to comment.