diff --git a/.github/workflows/woo-page-deploy.yml b/.github/workflows/woo-page-deploy.yml index 0fd20047..678ce22b 100644 --- a/.github/workflows/woo-page-deploy.yml +++ b/.github/workflows/woo-page-deploy.yml @@ -9,13 +9,18 @@ env: # Change these to your preferences any image url can also be a base encoded GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }} API_BASE_URL: "https://api.gateway.commonground.nu/api" NL_DESIGN_THEME_CLASSNAME: "conduction-theme" + DEV_ENVIRONMENT: "true" + SHOW_CATEGORY: "true" + SHOW_ORGANIZATION: "true" FAVICON_URL: "https://conduction.nl/wp-content/uploads/2021/07/cropped-favicon-32x32.png" HEADER_LOGO_URL: "https://conduction.nl/wp-content/uploads/2021/07/cropped-conductionlogo-1.png" ORGANISATION_NAME: "Conduction" JUMBOTRON_IMAGE_URL: "https://www.conduction.nl/wp-content/uploads/2021/07/cropped-Conduction_HOME_0000_afb1-1.png" FOOTER_LOGO_URL: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICAgICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgd2lkdGg9IjcxLjAwMDAwMHB0IiBoZWlnaHQ9IjcwLjAwMDAwMHB0IiB2aWV3Qm94PSIwIDAgNzEuMDAwMDAwIDcwLjAwMDAwMCIKICAgICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0Ij4KCiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCw3MC4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiCiAgICAgICBmaWxsPSIjNDM3NkZDIiBzdHJva2U9Im5vbmUiPgogICAgICAgIDxwYXRoIGQ9Ik0yMTggNTkyIGwtMTM3IC03NyAwIC0xNjUgMCAtMTY1IDEzMSAtNzQgYzcyIC00MSAxMzcgLTc0IDE0MyAtNzQgNgowIDcwIDMzIDE0MyA3NCBsMTMxIDc0IDEgMTY1IDAgMTY1IC02OCAzNyBjLTM3IDIxIC05OSA1NiAtMTM3IDc3IGwtNzEgNDAKLTEzNiAtNzd6IG0yOTUgLTg1IGw1NyAtMzIgMCAtMTI1IDAgLTEyNSAtMTA2IC02MCBjLTU4IC0zMyAtMTA4IC02MCAtMTExCi01OSAtMyAwIC01MiAyNyAtMTA5IDYwIGwtMTAzIDU5IDAgMTI1IDAgMTI1IDEwNyA2MSAxMDcgNjIgNTAgLTI5IGMyNyAtMTYKNzYgLTQ0IDEwOCAtNjJ6Ii8+CiAgICAgICAgPHBhdGggZD0iTTI3OCA0NzIgbC02OCAtMzcgMCAtODUgMCAtODUgNzMgLTM5IDczIC0zOSA2MiAzNCBjMzQgMTggNjIgMzcgNjIKNDEgMCA0IC0xNCAxNSAtMzEgMjMgLTI4IDE1IC0zMyAxNSAtNTQgMSAtMzEgLTIwIC00NiAtMjAgLTg0IDIgLTI3IDE1IC0zMQoyMiAtMzEgNjIgMCA0MCA0IDQ3IDMxIDYzIDM4IDIxIDUzIDIxIDg0IDEgMjEgLTE0IDI2IC0xNCA1NCAxIDE3IDggMzEgMTkgMzEKMjMgMCA4IC0xMTMgNzIgLTEyNiA3MiAtNSAwIC0zOSAtMTcgLTc2IC0zOHoiLz4KICAgIDwvZz4KPC9zdmc+Cg==" - FOOTER_LOGO_HREF: "https://conduction.nl/" + FOOTER_LOGO_HREF: "https://conduction.nl/", + FOOTER_CONTENT: "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/pwa/src/templates/templateParts/footer/FooterContent.json" # OIDN_NUMBER: " " + ENV_VARS_SET: "true" on: push: @@ -41,13 +46,18 @@ jobs: envkey_USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX: ${{ env.USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX }} envkey_GATSBY_API_BASE_URL: ${{ env.API_BASE_URL }} envkey_GATSBY_NL_DESIGN_THEME_CLASSNAME: ${{ env.NL_DESIGN_THEME_CLASSNAME }} + envkey_GATSBY_DEV_ENVIRONMENT: ${{ env.DEV_ENVIRONMENT }} + envkey_GATSBY_SHOW_CATEGORY: ${{ env.SHOW_CATEGORY }} + envkey_GATSBY_SHOW_ORGANIZATION: ${{ env.SHOW_ORGANIZATION }} envkey_GATSBY_FAVICON_URL: ${{ env.FAVICON_URL }} envkey_GATSBY_HEADER_LOGO_URL: ${{ env.HEADER_LOGO_URL }} envkey_GATSBY_ORGANISATION_NAME: ${{ env.ORGANISATION_NAME }} envkey_GATSBY_JUMBOTRON_IMAGE_URL: ${{ env.JUMBOTRON_IMAGE_URL }} envkey_GATSBY_FOOTER_LOGO_URL: ${{ env.FOOTER_LOGO_URL }} envkey_GATSBY_FOOTER_LOGO_HREF: ${{ env.FOOTER_LOGO_HREF }} + envkey_GATSBY_FOOTER_CONTENT: ${{ env.FOOTER_CONTENT }} # envkey_GATSBY_OIDN_NUMBER: ${{ env.OIDN_NUMBER }} + envkey_GATSBY_ENV_VARS_SET: ${{ env.ENV_VARS_SET }} directory: pwa/static file_name: .env.production fail_on_empty: true @@ -56,11 +66,14 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: 14 + node-version: 18 - name: Install dependencies run: cd pwa && npm install + - name: Install parcel/watcher + run: cd pwa && npm install @parcel/watcher + - name: Remove old Gatsby cache run: rm -rf pwa/.cache diff --git a/pwa/package-lock.json b/pwa/package-lock.json index 99b332b2..d23d5e96 100644 --- a/pwa/package-lock.json +++ b/pwa/package-lock.json @@ -9,11 +9,11 @@ "version": "1.0.0", "dependencies": { "@conduction/components": "2.2.36", - "@conduction/theme": "1.0.55", - "@fortawesome/fontawesome-svg-core": "^6.4.2", - "@fortawesome/free-brands-svg-icons": "6.4.2", - "@fortawesome/free-regular-svg-icons": "6.4.2", - "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@conduction/theme": "1.0.56", + "@fortawesome/fontawesome-svg-core": "^6.5.0", + "@fortawesome/free-brands-svg-icons": "6.5.0", + "@fortawesome/free-regular-svg-icons": "6.5.0", + "@fortawesome/free-solid-svg-icons": "^6.5.0", "@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", @@ -55,7 +55,7 @@ "gatsby-plugin-breadcrumb": "^12.3.2", "gatsby-plugin-layout": "^4.12.0", "html-react-parser": "^5.0.6", - "i18next": "^23.7.6", + "i18next": "^23.7.7", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "qs": "^6.11.2", @@ -2164,9 +2164,9 @@ } }, "node_modules/@conduction/theme": { - "version": "1.0.55", - "resolved": "https://registry.npmjs.org/@conduction/theme/-/theme-1.0.55.tgz", - "integrity": "sha512-GCk9v3HyAy/3exE2G7VpJF8g8m8g5l0do9i0AaWz4u12I5UMoY581tXmX3YUkh1wawS+TCgL7jvB/t2C6tl+1g==", + "version": "1.0.56", + "resolved": "https://registry.npmjs.org/@conduction/theme/-/theme-1.0.56.tgz", + "integrity": "sha512-h1nIUMkQdnSeD0zBfepLH4Jb27tI7/lLev07RBpWmVkwei2DGeUwG3bfEJ2HChTPu5EyfItHu/37UnqRE7ADNg==", "dependencies": { "lodash": "^4.17.15", "string-natural-compare": "^3.0.1" @@ -3259,52 +3259,57 @@ "license": "MIT" }, "node_modules/@fortawesome/fontawesome-common-types": { - "version": "6.4.2", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.0.tgz", + "integrity": "sha512-vYC8oN2l8meu05sRi1j3Iie/HNFAeIxpitYFhsUrBc11TxiMken9QdXnSQ0q16FYsOSt/6soxs5ghdk+VYGiog==", "hasInstallScript": true, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/fontawesome-svg-core": { - "version": "6.4.2", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.0.tgz", + "integrity": "sha512-5DrR+oxQr+ruRQ3CEVV8DSCT/q8Atm56+FzAs0P6eW/epW47OmecSpSwc/YTlJ3u5BfPKUBSGyPR2qjZ+5eIgA==", "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.4.2" + "@fortawesome/fontawesome-common-types": "6.5.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-brands-svg-icons": { - "version": "6.4.2", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.5.0.tgz", + "integrity": "sha512-LwIl3b5cH0xjmBS7mcy8+SsSsl/7J4xi3aP+Tr4rDUf2Tab8r1c8NcqC8wP5c+bgphGstyG3QPx7l4b9WtcO5Q==", "hasInstallScript": true, - "license": "(CC-BY-4.0 AND MIT)", "dependencies": { - "@fortawesome/fontawesome-common-types": "6.4.2" + "@fortawesome/fontawesome-common-types": "6.5.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-regular-svg-icons": { - "version": "6.4.2", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.5.0.tgz", + "integrity": "sha512-RaBW/y0jKcCyEPM+NYuBs3bQXuLYZHnXABQPmg6qwuRxNb2EUmyCcVUECUH2dkFmMjggh/xvl6n6y62Pl19JkA==", "hasInstallScript": true, - "license": "(CC-BY-4.0 AND MIT)", "dependencies": { - "@fortawesome/fontawesome-common-types": "6.4.2" + "@fortawesome/fontawesome-common-types": "6.5.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-solid-svg-icons": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.4.2.tgz", - "integrity": "sha512-sYwXurXUEQS32fZz9hVCUUv/xu49PEJEyUOsA51l6PU/qVgfbTb2glsTEaJngVVT8VqBATRIdh7XVgV1JF1LkA==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.0.tgz", + "integrity": "sha512-6ZPq8mme67Q7O9Fbp2O+Z7mPZbcWTsRv555JLftLaTodiV0Wq+99YgMhyQ8O6mgNQfComqS9OEvqs7M8ySA92g==", "hasInstallScript": true, - "license": "(CC-BY-4.0 AND MIT)", "dependencies": { - "@fortawesome/fontawesome-common-types": "6.4.2" + "@fortawesome/fontawesome-common-types": "6.5.0" }, "engines": { "node": ">=6" @@ -11390,9 +11395,9 @@ } }, "node_modules/i18next": { - "version": "23.7.6", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.7.6.tgz", - "integrity": "sha512-O66BhXBw0fH4bEJMA0/klQKPEbcwAp5wjXEL803pdAynNbg2f4qhLIYlNHJyE7icrL6XmSZKPYaaXwy11kJ6YQ==", + "version": "23.7.7", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.7.7.tgz", + "integrity": "sha512-peTvdT+Lma+o0LfLFD7IC2M37N9DJ04dH0IJYOyOHRhDfLo6nK36v7LkrQH35C2l8NHiiXZqGirhKESlEb/5PA==", "funding": [ { "type": "individual", diff --git a/pwa/package.json b/pwa/package.json index e9746417..b0d48b0c 100644 --- a/pwa/package.json +++ b/pwa/package.json @@ -25,11 +25,11 @@ }, "dependencies": { "@conduction/components": "2.2.36", - "@conduction/theme": "1.0.55", - "@fortawesome/fontawesome-svg-core": "^6.4.2", - "@fortawesome/free-brands-svg-icons": "6.4.2", - "@fortawesome/free-regular-svg-icons": "6.4.2", - "@fortawesome/free-solid-svg-icons": "^6.4.2", + "@conduction/theme": "1.0.56", + "@fortawesome/fontawesome-svg-core": "^6.5.0", + "@fortawesome/free-brands-svg-icons": "6.5.0", + "@fortawesome/free-regular-svg-icons": "6.5.0", + "@fortawesome/free-solid-svg-icons": "^6.5.0", "@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", @@ -71,7 +71,7 @@ "gatsby-plugin-breadcrumb": "^12.3.2", "gatsby-plugin-layout": "^4.12.0", "html-react-parser": "^5.0.6", - "i18next": "^23.7.6", + "i18next": "^23.7.7", "jwt-decode": "^4.0.0", "lodash": "^4.17.21", "qs": "^6.11.2", diff --git a/pwa/src/apiService/resources/availableFilters.ts b/pwa/src/apiService/resources/availableFilters.ts index 21444fd9..8d7dac8a 100644 --- a/pwa/src/apiService/resources/availableFilters.ts +++ b/pwa/src/apiService/resources/availableFilters.ts @@ -11,10 +11,10 @@ export default class AvailableFilters { } public getCategories = async (): Promise => { - let endpoint = "/openWOO?_queries[]=categorie"; + let endpoint = "/publicaties?_queries[]=categorie"; if (window.sessionStorage.getItem("OIDN_NUMBER")) { - endpoint += `&embedded.behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; + endpoint += `&organisatie.oin=${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 99a05a27..183d7fd4 100644 --- a/pwa/src/apiService/resources/openWoo.ts +++ b/pwa/src/apiService/resources/openWoo.ts @@ -15,12 +15,12 @@ export default class OpenWoo { } public getAll = async (filters: IFiltersContext, currentPage: number, limit: number): Promise => { - let endpoint = `/openWOO?extend[]=all${filtersToQueryParams( + let endpoint = `/publicaties?extend[]=all${filtersToQueryParams( filters, )}&_order[publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`; if (window.sessionStorage.getItem("OIDN_NUMBER")) { - endpoint += `&embedded.behandelendBestuursorgaan.oidn=${window.sessionStorage.getItem("OIDN_NUMBER")}`; + endpoint += `&organisatie.oin=${window.sessionStorage.getItem("OIDN_NUMBER")}`; } const { data } = await this._send(this._instance, "GET", endpoint); @@ -29,7 +29,7 @@ export default class OpenWoo { }; public getOne = async (id: string): Promise => { - const { data } = await this._send(this._instance, "GET", `/openWOO/${id}`); + const { data } = await this._send(this._instance, "GET", `/publicaties/${id}`); return data; }; diff --git a/pwa/src/context/categoryOptions.ts b/pwa/src/context/categoryOptions.ts new file mode 100644 index 00000000..a156f59a --- /dev/null +++ b/pwa/src/context/categoryOptions.ts @@ -0,0 +1,22 @@ +import * as React from "react"; +import { GlobalContext } from "./global"; +import { TGroupedSelectOption, TSelectOption } from "@conduction/components/lib/components/formFields/select/select"; + +export interface ICategoriesContext { + options: TSelectOption[] | TGroupedSelectOption[]; +} + +export const defaultCategoriesContext: ICategoriesContext = { + options: [], +}; + +export const useCategoriesContext = () => { + const [globalContext, setGlobalContext] = React.useContext(GlobalContext); + const categoryOptions: ICategoriesContext = globalContext.categoryOptions; + + const setCategoryOptions = (newFilters: ICategoriesContext) => { + setGlobalContext((context) => ({ ...context, categoryOptions: { ...globalContext.categoryOptions, ...newFilters } })); + }; + + return { categoryOptions, setCategoryOptions }; +}; diff --git a/pwa/src/context/global.ts b/pwa/src/context/global.ts index 189ac629..90ca7468 100644 --- a/pwa/src/context/global.ts +++ b/pwa/src/context/global.ts @@ -4,6 +4,7 @@ import { defaultFiltersContext, IFiltersContext } from "./filters"; import { defaultDisplayContext, IDisplayContext } from "./displays"; import { defaultPaginationContext, IPaginationContext } from "./pagination"; import { defaultQueryLimitContext, IQueryLimitContext } from "./queryLimit"; +import { defaultCategoriesContext, ICategoriesContext } from "./categoryOptions"; export interface IGlobalContext { initiated: boolean; @@ -12,6 +13,7 @@ export interface IGlobalContext { displays: IDisplayContext; pagination: IPaginationContext; queryLimit: IQueryLimitContext; + categoryOptions: ICategoriesContext; } export const defaultGlobalContext: IGlobalContext = { @@ -21,6 +23,7 @@ export const defaultGlobalContext: IGlobalContext = { displays: defaultDisplayContext, pagination: defaultPaginationContext, queryLimit: defaultQueryLimitContext, + categoryOptions: defaultCategoriesContext, }; export const GlobalContext = React.createContext< diff --git a/pwa/src/services/isUUID.ts b/pwa/src/services/isUUID.ts deleted file mode 100644 index 875cb770..00000000 --- a/pwa/src/services/isUUID.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const isUUID = (id: string): boolean => { - const regexExp = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi; - - return regexExp.test(id); -}; diff --git a/pwa/src/templates/landing/LandingTemplate.tsx b/pwa/src/templates/landing/LandingTemplate.tsx index 6b554faf..ebb60f28 100644 --- a/pwa/src/templates/landing/LandingTemplate.tsx +++ b/pwa/src/templates/landing/LandingTemplate.tsx @@ -1,12 +1,12 @@ import * as React from "react"; import * as styles from "./LandingTemplate.module.css"; +import Skeleton from "react-loading-skeleton"; import { Page, PageContent } from "@utrecht/component-library-react/dist/css-module"; import { FiltersTemplate } from "../templateParts/filters/FiltersTemplate"; import { ResultsDisplayTemplate } from "../templateParts/resultsDisplayTemplate/ResultsDisplayTemplate"; import { JumbotronTemplate } from "../jumbotronTemplate/JumbotronTemplate"; import { useOpenWoo } from "../../hooks/openWoo"; import { useFiltersContext } from "../../context/filters"; -import Skeleton from "react-loading-skeleton"; import { QueryClient } from "react-query"; import { Pagination } from "@conduction/components"; import { usePaginationContext } from "../../context/pagination"; diff --git a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx index ca8bca40..b691ce4d 100644 --- a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx @@ -19,16 +19,14 @@ export const CardsResultsTemplate: React.FC = ({ requ
{requests.map((request) => ( navigate(request._self.id)} + onClick={() => navigate(request._id)} tabIndex={0} aria-label={`${ request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A") }, ${request.titel}, ${request.samenvatting} ${ - window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" - ? `,${request.embedded?.behandelendBestuursorgaan?.naam}` - : "" + window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" ? `,${request.organisatie?.naam}` : "" } ${ window.sessionStorage.getItem("SHOW_CATEGORY") === "true" ? `, ${t("Category")}, ${request.categorie}` @@ -52,7 +50,7 @@ export const CardsResultsTemplate: React.FC = ({ requ {window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" && ( - {request.embedded?.behandelendBestuursorgaan?.naam} + {request.organisatie?.naam} )} diff --git a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx index 9b1062f2..be8cb147 100644 --- a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx +++ b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx @@ -17,6 +17,7 @@ import { navigate } from "gatsby"; import { useGatsbyContext } from "../../../context/gatsby"; import { useAvailableFilters } from "../../../hooks/availableFilters"; import { usePaginationContext } from "../../../context/pagination"; +import { useCategoriesContext } from "../../../context/categoryOptions"; interface FiltersTemplateProps { isLoading: boolean; @@ -24,12 +25,12 @@ interface FiltersTemplateProps { export const FiltersTemplate: React.FC = ({ isLoading }) => { const { t } = useTranslation(); - const { filters, setFilters } = useFiltersContext(); const { setPagination } = usePaginationContext(); const { gatsbyContext } = useGatsbyContext(); + const { filters, setFilters } = useFiltersContext(); + const { categoryOptions, setCategoryOptions } = useCategoriesContext(); const [queryParams, setQueryParams] = React.useState(defaultFiltersContext); const [categoryParams, setCategoryParams] = React.useState(); - const [categoryOptions, setCategoryOptions] = React.useState(); const filterTimeout = React.useRef(null); const { @@ -50,6 +51,8 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = const [, params] = url.split("?"); const parsedParams = qs.parse(params); + const getCategories = useAvailableFilters().getCategories(); + const handleSetFormValues = (params: any): void => { const basicFields: string[] = ["_search", "category"]; basicFields.forEach((field) => setValue(field, params[field])); @@ -66,7 +69,7 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = getCategories.isSuccess && setValue( "category", - categoryOptions.find((option: any) => option.value === params.categorie?.replace(/_/g, " ")), + categoryOptions.options.find((option: any) => option.value === params.categorie?.replace(/_/g, " ")), ); }; @@ -107,8 +110,6 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = setPagination({ currentPage: 1 }); }, [filters]); - const getCategories = useAvailableFilters().getCategories(); - React.useEffect(() => { if (!getCategories.isSuccess) return; @@ -117,7 +118,8 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = value: _.upperFirst(category._id.toLowerCase()), })); - setCategoryOptions(_.orderBy(_.uniqBy(categoriesWithData, "value"), "label", "asc")); + const uniqueOptions: any[] = _.orderBy(_.uniqBy(categoriesWithData, "value"), "label", "asc"); + setCategoryOptions({ options: uniqueOptions }); }, [getCategories.isSuccess]); return ( @@ -148,10 +150,13 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = {getCategories.isLoading && } {getCategories.isSuccess && ( option.value === filters.categorie)} + defaultValue={ + categoryOptions.options && + categoryOptions.options.find((option: any) => option.value === filters.categorie) + } isClearable disabled={getCategories.isLoading} {...{ register, errors, control }} diff --git a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx index 61105e59..8a0c2b88 100644 --- a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx @@ -51,15 +51,13 @@ export const TableResultsTemplate: React.FC = ({ requ {requests.map((request) => ( navigate(request._self.id)} + key={request._id} + onClick={() => navigate(request._id)} tabIndex={0} aria-label={`${request.titel}, ${ request.publicatiedatum ? translateDate(i18n.language, request.publicatiedatum) : t("N/A") } ${ - window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" - ? `,${request.embedded?.behandelendBestuursorgaan?.naam}` - : "" + window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" ? `,${request.organisatie?.naam}` : "" } ${window.sessionStorage.getItem("SHOW_CATEGORY") === "true" ? `, ${request.categorie}` : ""}, ${ request.samenvatting }`} @@ -75,7 +73,7 @@ export const TableResultsTemplate: React.FC = ({ requ <> {window.sessionStorage.getItem("SHOW_ORGANIZATION") === "true" && ( - {request.embedded?.behandelendBestuursorgaan?.naam ?? t("No municipality available")} + {request.organisatie?.naam ?? t("No municipality available")} )} {window.sessionStorage.getItem("SHOW_CATEGORY") === "true" && ( diff --git a/pwa/src/templates/templateParts/themeSwitcherTopBar/ThemeSwitcherTopBar.tsx b/pwa/src/templates/templateParts/themeSwitcherTopBar/ThemeSwitcherTopBar.tsx index 66148515..85304248 100644 --- a/pwa/src/templates/templateParts/themeSwitcherTopBar/ThemeSwitcherTopBar.tsx +++ b/pwa/src/templates/templateParts/themeSwitcherTopBar/ThemeSwitcherTopBar.tsx @@ -36,6 +36,8 @@ export const ThemeSwitcherTopBar: React.FC = () => { React.useEffect(() => { if (!watchTheme) return; + if (window.sessionStorage.getItem("SHOW_THEME_SWITCHER") !== "true") return; + navigate("/"); initiateFromJSON(watchTheme.value); diff --git a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx index a5dbf859..d595de23 100644 --- a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx +++ b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx @@ -1,5 +1,7 @@ import * as React from "react"; import * as styles from "./WOOItemDetailTemplate.module.css"; +import _ from "lodash"; +import Skeleton from "react-loading-skeleton"; import { Page, PageContent, @@ -19,9 +21,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faArrowLeft } from "@fortawesome/free-solid-svg-icons"; import { QueryClient } from "react-query"; import { useOpenWoo } from "../../hooks/openWoo"; -import Skeleton from "react-loading-skeleton"; import { getPDFName } from "../../services/getPDFName"; -import { isUUID } from "../../services/isUUID"; import { HorizontalOverflowWrapper } from "@conduction/components"; interface WOOItemDetailTemplateProps { @@ -50,7 +50,7 @@ export const WOOItemDetailTemplate: React.FC = ({ wo
- {getItems.isSuccess && ( + {getItems.isSuccess && getItems.data && ( <> {getItems.data.titel !== "" ? getItems.data.titel : t("No title available")} @@ -67,9 +67,7 @@ export const WOOItemDetailTemplate: React.FC = ({ wo {getItems.data.id && ( {t("Feature")} - - {isUUID(getItems.data._self.id) ? getItems.data.id : getItems.data._self.id} - + {getItems.data.id} )} @@ -93,10 +91,10 @@ export const WOOItemDetailTemplate: React.FC = ({ wo )} - {getItems.data.termijnoverschrijding && ( + {getItems.data.metadata?.verzoek?.termijnoverschrijding && ( {t("Exceeding the term")} - {getItems.data.termijnoverschrijding} + {getItems.data.metadata?.verzoek?.termijnoverschrijding} )} @@ -111,82 +109,88 @@ export const WOOItemDetailTemplate: React.FC = ({ wo )} - {getItems.data.ontvangstdatum && ( + {getItems.data.metadata?.verzoek?.ontvangstdatum && ( {t("Registration date")} - {translateDate(i18n.language, getItems.data.ontvangstdatum) ?? "-"} + + {translateDate(i18n.language, getItems.data.metadata?.verzoek?.ontvangstdatum) ?? "-"} + )} - {getItems.data.embedded?.metadata?.besluitdatum && ( + {getItems.data.metadata?.besluitdatum && ( {t("Decision date")} - - {translateDate(i18n.language, getItems.data.embedded?.metadata?.besluitdatum) ?? "-"} - + {translateDate(i18n.language, getItems.data.metadata?.besluitdatum) ?? "-"} )} - {getItems.data?.embedded?.themas && ( + {!_.isEmpty(getItems.data.themas) && ( {t("Themes")} - {getItems.data?.embedded?.themas.map((thema: any, idx: number) => ( + {getItems.data.themas.map((thema: any, idx: number) => ( - {thema.hoofdthema + (idx !== getItems.data?.embedded?.themas?.length - 1 ? ", " : "")} + {thema.hoofdthema + (idx !== getItems.data.themas?.length - 1 ? ", " : "")} ))} )} - {getItems.data?.embedded?.informatieverzoek && ( + {getItems.data.metadata?.verzoek?.informatieverzoek && ( {t("Information request")} - - {getItems.data?.embedded?.informatieverzoek?.titel} + + {getItems.data.metadata?.verzoek?.informatieverzoek?.titel ?? + getPDFName(getItems.data.metadata?.verzoek?.informatieverzoek?.url)} )} - {(getItems.data?.besluit || - (getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url)) && ( + {(getItems.data.metadata?.verzoek?.besluit || + (getItems.data.metadata?.verzoek?.besluit ?? getItems.data.metadata?.verzoek?.besluit?.url)) && ( {t("Decision")} - {(getItems.data?.embedded?.besluit ?? getItems.data?.embedded?.besluit?.url) && ( + {(getItems.data.metadata?.verzoek?.besluit ?? + getItems.data.metadata?.verzoek?.besluit?.url) && ( - {getItems.data?.embedded?.besluit?.titel ?? - getPDFName(getItems.data?.embedded?.besluit?.url)} + {getItems.data.metadata?.verzoek?.besluit?.titel ?? + getPDFName(getItems.data.metadata?.verzoek?.besluit?.url)} )} )} - {getItems.data?.embedded?.inventarisatielijst && ( + {getItems.data.metadata?.verzoek?.inventarisatielijst && ( {t("Inventory list")} - - {getItems.data?.embedded?.inventarisatielijst?.titel} + + {getItems.data.metadata?.verzoek?.inventarisatielijst?.titel ?? + getPDFName(getItems.data.metadata?.verzoek?.inventarisatielijst?.url)} )} - {getItems.data?.embedded?.bijlagen && ( + {!_.isEmpty(getItems.data.bijlagen) && ( {t("Attachments")} - {getItems.data?.embedded?.bijlagen.map( + {getItems.data.bijlagen.map( (bijlage: any, idx: number) => bijlage.titel && ( diff --git a/pwa/static/configFiles/albrandswaard.json b/pwa/static/configFiles/albrandswaard.json index 5705bd9a..239cd057 100644 --- a/pwa/static/configFiles/albrandswaard.json +++ b/pwa/static/configFiles/albrandswaard.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.albrandswaard.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "albrandswaard", + "GATSBY_OIDN_NUMBER": "00000001006825515000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/barendrecht.json b/pwa/static/configFiles/barendrecht.json index 82b4430b..ee81bd22 100644 --- a/pwa/static/configFiles/barendrecht.json +++ b/pwa/static/configFiles/barendrecht.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.barendrecht.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "barendrecht", + "GATSBY_OIDN_NUMBER": "00000001001876946000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/buren.json b/pwa/static/configFiles/buren.json index 0a8f5e5c..00ef2317 100644 --- a/pwa/static/configFiles/buren.json +++ b/pwa/static/configFiles/buren.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.buren.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "buren", + "GATSBY_OIDN_NUMBER": "00000001807287684000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/hoeksche-waard.json b/pwa/static/configFiles/hoeksche-waard.json index d017c654..eb10ade0 100644 --- a/pwa/static/configFiles/hoeksche-waard.json +++ b/pwa/static/configFiles/hoeksche-waard.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.gemeentehw.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "hoeksche-waard", + "GATSBY_OIDN_NUMBER": "00000001825766096000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/lansingerland.json b/pwa/static/configFiles/lansingerland.json index a859a2b6..1b45bbbd 100644 --- a/pwa/static/configFiles/lansingerland.json +++ b/pwa/static/configFiles/lansingerland.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.lansingerland.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "lansingerland", + "GATSBY_OIDN_NUMBER": "00000001817291295000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/ridderkerk.json b/pwa/static/configFiles/ridderkerk.json index 4bb0870e..4c44cb77 100644 --- a/pwa/static/configFiles/ridderkerk.json +++ b/pwa/static/configFiles/ridderkerk.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.ridderkerk.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "ridderkerk", + "GATSBY_OIDN_NUMBER": "00000001001877410000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/rijssen-holten.json b/pwa/static/configFiles/rijssen-holten.json index 42706b7d..31a5a565 100644 --- a/pwa/static/configFiles/rijssen-holten.json +++ b/pwa/static/configFiles/rijssen-holten.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.rijssen-holten.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "rijssen-holten", + "GATSBY_OIDN_NUMBER": "00000001001584169000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/stede-broec.json b/pwa/static/configFiles/stede-broec.json index c469f248..425493cf 100644 --- a/pwa/static/configFiles/stede-broec.json +++ b/pwa/static/configFiles/stede-broec.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.stedebroec.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "stedebroec", + "GATSBY_OIDN_NUMBER": "00000001004620732000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/texel.json b/pwa/static/configFiles/texel.json index 036c3622..69148f3d 100644 --- a/pwa/static/configFiles/texel.json +++ b/pwa/static/configFiles/texel.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.texel.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "texel", + "GATSBY_OIDN_NUMBER": "00000001002000155000", "GATSBY_SHOW_CATEGORY": "true", "GATSBY_SHOW_ORGANIZATION": "" } diff --git a/pwa/static/configFiles/waddinxveen.json b/pwa/static/configFiles/waddinxveen.json index 556574f4..201f659e 100644 --- a/pwa/static/configFiles/waddinxveen.json +++ b/pwa/static/configFiles/waddinxveen.json @@ -8,7 +8,7 @@ "GATSBY_FOOTER_LOGO_HREF": "https://www.waddinxveen.nl/", "GATSBY_FOOTER_CONTENT": "https://raw.githubusercontent.com/ConductionNL/woo-website-template/main/docs/FooterContent.json", "GATSBY_FOOTER_CONTENT_HEADER": "", - "GATSBY_OIDN_NUMBER": "waddinxveen", + "GATSBY_OIDN_NUMBER": "00000001001998389000", "GATSBY_SHOW_CATEGORY": "", "GATSBY_SHOW_ORGANIZATION": "" }