From fe8532bef16d612d537a7e158d410a4eaf851447 Mon Sep 17 00:00:00 2001 From: Remko Date: Fri, 22 Sep 2023 13:38:43 +0200 Subject: [PATCH 1/2] added publicationDate --- pwa/README.md | 54 ------------------- pwa/package-lock.json | 30 ++++++----- pwa/package.json | 2 +- pwa/src/apiService/resources/openWoo.ts | 2 +- .../ResultsDisplaySwitch.module.css | 2 +- pwa/src/context/filters.ts | 8 +-- pwa/src/data/years.ts | 4 +- pwa/src/services/dateFormat.ts | 2 + .../CardsResultsTemplate.tsx | 2 +- .../templateParts/filters/FiltersTemplate.tsx | 9 ++-- 10 files changed, 36 insertions(+), 79 deletions(-) diff --git a/pwa/README.md b/pwa/README.md index d517a18e..e69de29b 100644 --- a/pwa/README.md +++ b/pwa/README.md @@ -1,54 +0,0 @@ -

- - Gatsby - -

-

- Gatsby minimal TypeScript starter -

- -## ๐Ÿš€ Quick start - -1. **Create a Gatsby site.** - - Use the Gatsby CLI to create a new site, specifying the minimal TypeScript starter. - - ```shell - # create a new Gatsby site using the minimal TypeScript starter - npm init gatsby - ``` - -2. **Start developing.** - - Navigate into your new siteโ€™s directory and start it up. - - ```shell - cd my-gatsby-site/ - npm run develop - ``` - -3. **Open the code and start customizing!** - - Your site is now running at http://localhost:8000! - - Edit `src/pages/index.tsx` to see your site update in real-time! - -4. **Learn more** - - - [Documentation](https://www.gatsbyjs.com/docs/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - - - [Tutorials](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - - - [Guides](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - - - [API Reference](https://www.gatsbyjs.com/docs/api-reference/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - - - [Plugin Library](https://www.gatsbyjs.com/plugins?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - - - [Cheat Sheet](https://www.gatsbyjs.com/docs/cheat-sheet/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts) - -## ๐Ÿš€ Quick start (Gatsby Cloud) - -Deploy this starter with one click on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/): - -[Deploy to Gatsby Cloud](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-minimal-ts) diff --git a/pwa/package-lock.json b/pwa/package-lock.json index 08f29a97..e34daf0b 100644 --- a/pwa/package-lock.json +++ b/pwa/package-lock.json @@ -8,7 +8,7 @@ "name": "product-website-template", "version": "1.0.0", "dependencies": { - "@conduction/components": "2.2.5", + "@conduction/components": "2.2.8", "@conduction/theme": "1.0.36", "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-solid-svg-icons": "^6.4.0", @@ -1997,9 +1997,9 @@ } }, "node_modules/@conduction/components": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@conduction/components/-/components-2.2.5.tgz", - "integrity": "sha512-BDKLQqikLM14hyJupR4Ww8uEFbN8g7DTPxAQIkBt8HZ8xpAMk08tx+LZfg/Lzz7b/VtcAC8+8J6cvBHopgCnTA==", + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/@conduction/components/-/components-2.2.8.tgz", + "integrity": "sha512-eaCLSm2giu+kCNlC6+H+gqZkehIeIFxOVGz/MYfhHBTP+lRulV1C258jQXpK8DjxXY65XHKruNVYrgi2ZEyYpA==", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.2.0", "@fortawesome/free-solid-svg-icons": "^6.2.0", @@ -3668,7 +3668,8 @@ }, "node_modules/@popperjs/core": { "version": "2.11.8", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" @@ -5677,7 +5678,8 @@ }, "node_modules/classnames": { "version": "2.3.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", + "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" }, "node_modules/clean-stack": { "version": "2.2.0", @@ -13601,14 +13603,15 @@ } }, "node_modules/react-datepicker": { - "version": "4.16.0", - "license": "MIT", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.18.0.tgz", + "integrity": "sha512-0MYt3HmLbHVk1sw4v+RCbLAVg5TA3jWP7RyjZbo53PC+SEi+pjdgc92lB53ai/ENZaTOhbXmgni9GzvMrorMAw==", "dependencies": { "@popperjs/core": "^2.11.8", "classnames": "^2.2.6", "date-fns": "^2.30.0", "prop-types": "^15.7.2", - "react-onclickoutside": "^6.12.2", + "react-onclickoutside": "^6.13.0", "react-popper": "^2.3.0" }, "peerDependencies": { @@ -13781,7 +13784,8 @@ }, "node_modules/react-onclickoutside": { "version": "6.13.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz", + "integrity": "sha512-ty8So6tcUpIb+ZE+1HAhbLROvAIJYyJe/1vRrrcmW+jLsaM+/powDRqxzo6hSh9CuRZGSL1Q8mvcF5WRD93a0A==", "funding": { "type": "individual", "url": "https://github.com/Pomax/react-onclickoutside/blob/master/FUNDING.md" @@ -13803,7 +13807,8 @@ }, "node_modules/react-popper": { "version": "2.3.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz", + "integrity": "sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==", "dependencies": { "react-fast-compare": "^3.0.1", "warning": "^4.0.2" @@ -16072,7 +16077,8 @@ }, "node_modules/warning": { "version": "4.0.3", - "license": "MIT", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", "dependencies": { "loose-envify": "^1.0.0" } diff --git a/pwa/package.json b/pwa/package.json index 0dd63a7f..3194d1c1 100644 --- a/pwa/package.json +++ b/pwa/package.json @@ -22,7 +22,7 @@ "prepare": "cd .. && husky install" }, "dependencies": { - "@conduction/components": "2.2.5", + "@conduction/components": "2.2.8", "@conduction/theme": "1.0.36", "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/free-solid-svg-icons": "^6.4.0", diff --git a/pwa/src/apiService/resources/openWoo.ts b/pwa/src/apiService/resources/openWoo.ts index c15ff9d4..91174196 100644 --- a/pwa/src/apiService/resources/openWoo.ts +++ b/pwa/src/apiService/resources/openWoo.ts @@ -15,7 +15,7 @@ export default class OpenWoo { } public getAll = async (filters: IFiltersContext, currentPage: number): Promise => { - let endpoint = `/openWOO?extend[]=all${filtersToQueryParams(filters)}&_order[Besluitdatum]=desc&_limit=${OPEN_WOO_LIMIT}&_page=${currentPage}`; + let endpoint = `/openWOO?extend[]=all${filtersToQueryParams(filters)}&_order[Publicatiedatum]=desc&_limit=${OPEN_WOO_LIMIT}&_page=${currentPage}`; if (process.env.GATSBY_OIDN_NUMBER) { endpoint += `&oidn=${process.env.GATSBY_OIDN_NUMBER}`; diff --git a/pwa/src/components/resultsDisplaySwitch/ResultsDisplaySwitch.module.css b/pwa/src/components/resultsDisplaySwitch/ResultsDisplaySwitch.module.css index c9adcdb3..db3cb651 100644 --- a/pwa/src/components/resultsDisplaySwitch/ResultsDisplaySwitch.module.css +++ b/pwa/src/components/resultsDisplaySwitch/ResultsDisplaySwitch.module.css @@ -1,6 +1,6 @@ .container { align-items: center; - flex-wrap: nowrap; + flex-wrap: nowrap !important; margin-inline-start: 12px; } diff --git a/pwa/src/context/filters.ts b/pwa/src/context/filters.ts index 187af7e6..10736825 100644 --- a/pwa/src/context/filters.ts +++ b/pwa/src/context/filters.ts @@ -3,15 +3,15 @@ import { GlobalContext } from "./global"; export interface IFiltersContext { _search: string | undefined; - "Ontvangstdatum[after]": string | undefined; - "Ontvangstdatum[before]": string | undefined; + "Publicatiedatum[after]": string | undefined; + "Publicatiedatum[before]": string | undefined; Categorie: string | undefined; } export const defaultFiltersContext: IFiltersContext = { _search: "", - "Ontvangstdatum[after]": undefined, - "Ontvangstdatum[before]": undefined, + "Publicatiedatum[after]": undefined, + "Publicatiedatum[before]": undefined, Categorie: undefined, }; diff --git a/pwa/src/data/years.ts b/pwa/src/data/years.ts index 024e08e7..711cfba2 100644 --- a/pwa/src/data/years.ts +++ b/pwa/src/data/years.ts @@ -5,8 +5,8 @@ export const generateYearsArray = (amountOfYears: number) => { for (let i = 0; i < amountOfYears; i++) { const year = currentYear - i; - const beforeDate = `${year + 1}-01-01`; - const afterDate = `${year - 1}-12-31`; + const beforeDate = `${year + 1}-01-01T00:00:00Z`; + const afterDate = `${year - 1}-12-31T23:59:59Z`; yearsArray.push({ label: `${year}`, diff --git a/pwa/src/services/dateFormat.ts b/pwa/src/services/dateFormat.ts index aa02bda2..98c2a0bb 100644 --- a/pwa/src/services/dateFormat.ts +++ b/pwa/src/services/dateFormat.ts @@ -1,6 +1,8 @@ import dateFormat from "dateformat"; export const translateDate = (language: string, date: Date): string => { + if (!date) return "NVT"; + switch (language) { case "nl": return dateFormat(date, "dd-mm-yyyy"); diff --git a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx index 72d94160..eddfb02f 100644 --- a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx @@ -22,7 +22,7 @@ export const CardsResultsTemplate: React.FC = ({ requ navigate(request.id)}> - {translateDate(i18n.language, request.Besluitdatum) ?? "-"} + {translateDate(i18n.language, request.Publicatiedatum) ?? "-"} {request.Titel} diff --git a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx index c53a3500..38e4335d 100644 --- a/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx +++ b/pwa/src/templates/templateParts/filters/FiltersTemplate.tsx @@ -28,11 +28,14 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = const watcher = watch(); + const today = new Date(); + const currentYear = today.getFullYear(); + const onSubmit = (data: any) => { setFilters({ _search: data.title, - "Ontvangstdatum[after]": data.year?.after, - "Ontvangstdatum[before]": data.year?.before, + "Publicatiedatum[after]": data.year?.after, + "Publicatiedatum[before]": data.year?.before, Categorie: data.category?.value, }); }; @@ -49,7 +52,7 @@ export const FiltersTemplate: React.FC = ({ isLoading }) = Date: Fri, 22 Sep 2023 13:54:46 +0200 Subject: [PATCH 2/2] added publicationDate --- pwa/src/services/dateFormat.ts | 2 -- .../CardsResultsTemplate.tsx | 3 ++- .../TableResultsTemplate.tsx | 18 ++++++++++++++++-- .../WOOItemDetailTemplate.tsx | 11 +++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/pwa/src/services/dateFormat.ts b/pwa/src/services/dateFormat.ts index 98c2a0bb..aa02bda2 100644 --- a/pwa/src/services/dateFormat.ts +++ b/pwa/src/services/dateFormat.ts @@ -1,8 +1,6 @@ import dateFormat from "dateformat"; export const translateDate = (language: string, date: Date): string => { - if (!date) return "NVT"; - switch (language) { case "nl": return dateFormat(date, "dd-mm-yyyy"); diff --git a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx index eddfb02f..0227737a 100644 --- a/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/cardsResultsTemplate/CardsResultsTemplate.tsx @@ -22,7 +22,8 @@ export const CardsResultsTemplate: React.FC = ({ requ navigate(request.id)}> - {translateDate(i18n.language, request.Publicatiedatum) ?? "-"} + {" "} + {request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : "NVT"} {request.Titel} diff --git a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx index 84b8f50a..c5d6565b 100644 --- a/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx +++ b/pwa/src/templates/templateParts/tableResultsTemplate/TableResultsTemplate.tsx @@ -25,6 +25,7 @@ export const TableResultsTemplate: React.FC = ({ requ Woo-verzoek Onderwerp + Publicatiedatum Ontvangstdatum Besluitdatum Besluit @@ -35,8 +36,21 @@ export const TableResultsTemplate: React.FC = ({ requ navigate(request.id)}> {request.Titel} {request.Categorie ?? "-"} - {translateDate(i18n.language, request.Ontvangstdatum) ?? "-"} - {translateDate(i18n.language, request.Besluitdatum) ?? "-"} + + {request.Publicatiedatum + ? translateDate(i18n.language, request.Publicatiedatum) + : "Geen publicatiedatum beschikbaar"} + + + {request.Ontvangstdatum + ? translateDate(i18n.language, request.Ontvangstdatum) + : "Geen ontvanstdatum beschikbaar"} + + + {request.Besluitdatum + ? translateDate(i18n.language, request.Besluitdatum) + : "Geen besluitdatum beschikbaar"} + {request.Besluit !== "" ? request.Besluit : "Geen besluit beschikbaar"} ))} diff --git a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx index cf46bb88..f2b9178b 100644 --- a/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx +++ b/pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx @@ -84,6 +84,17 @@ export const WOOItemDetailTemplate: React.FC = ({ wo )} + {getItems.data.Publicatiedatum && ( + + {t("Publicatiedatum")} + + {getItems.data.Publicatiedatum + ? translateDate(i18n.language, getItems.data.Publicatiedatum) + : "-"} + + + )} + {getItems.data.Ontvangstdatum && ( {t("Ontvangstdatum")}