Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feauter/XW-79/PublicationDate #80

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions pwa/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +0,0 @@
<p align="center">
<a href="https://www.gatsbyjs.com/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter-ts">
<img alt="Gatsby" src="https://www.gatsbyjs.com/Gatsby-Monogram.svg" width="60" />
</a>
</p>
<h1 align="center">
Gatsby minimal TypeScript starter
</h1>

## 🚀 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/):

[<img src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-minimal-ts)
30 changes: 18 additions & 12 deletions pwa/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
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 @@ -15,7 +15,7 @@ export default class OpenWoo {
}

public getAll = async (filters: IFiltersContext, currentPage: number): Promise<any> => {
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}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.container {
align-items: center;
flex-wrap: nowrap;
flex-wrap: nowrap !important;
margin-inline-start: 12px;
}

Expand Down
8 changes: 4 additions & 4 deletions pwa/src/context/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
4 changes: 2 additions & 2 deletions pwa/src/data/years.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export const CardsResultsTemplate: React.FC<CardsResultsTemplateProps> = ({ requ
<CardWrapper key={request.id} className={styles.cardContainer} onClick={() => navigate(request.id)}>
<CardHeader>
<CardHeaderDate>
<FontAwesomeIcon icon={faClock} /> {translateDate(i18n.language, request.Besluitdatum) ?? "-"}
<FontAwesomeIcon icon={faClock} />{" "}
{request.Publicatiedatum ? translateDate(i18n.language, request.Publicatiedatum) : "NVT"}
</CardHeaderDate>
<CardHeaderTitle className={styles.title}>
<Heading2>{request.Titel}</Heading2>
Expand Down
9 changes: 6 additions & 3 deletions pwa/src/templates/templateParts/filters/FiltersTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ 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,
});
};
Expand All @@ -49,7 +52,7 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
<InputText name="title" placeholder="Zoeken.." defaultValue={filters._search} {...{ register, errors }} />

<SelectSingle
options={generateYearsArray(28)}
options={generateYearsArray(currentYear - 1995)}
name="year"
placeholder="Jaar"
isClearable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
<TableRow>
<TableHeaderCell>Woo-verzoek</TableHeaderCell>
<TableHeaderCell>Onderwerp</TableHeaderCell>
<TableHeaderCell>Publicatiedatum</TableHeaderCell>
<TableHeaderCell>Ontvangstdatum</TableHeaderCell>
<TableHeaderCell>Besluitdatum</TableHeaderCell>
<TableHeaderCell>Besluit</TableHeaderCell>
Expand All @@ -35,8 +36,21 @@ export const TableResultsTemplate: React.FC<TableResultsTemplateProps> = ({ requ
<TableRow className={styles.tableRow} key={request.id} onClick={() => navigate(request.id)}>
<TableCell>{request.Titel}</TableCell>
<TableCell>{request.Categorie ?? "-"}</TableCell>
<TableCell>{translateDate(i18n.language, request.Ontvangstdatum) ?? "-"}</TableCell>
<TableCell>{translateDate(i18n.language, request.Besluitdatum) ?? "-"}</TableCell>
<TableCell>
{request.Publicatiedatum
? translateDate(i18n.language, request.Publicatiedatum)
: "Geen publicatiedatum beschikbaar"}
</TableCell>
<TableCell>
{request.Ontvangstdatum
? translateDate(i18n.language, request.Ontvangstdatum)
: "Geen ontvanstdatum beschikbaar"}
</TableCell>
<TableCell>
{request.Besluitdatum
? translateDate(i18n.language, request.Besluitdatum)
: "Geen besluitdatum beschikbaar"}
</TableCell>
<TableCell>{request.Besluit !== "" ? request.Besluit : "Geen besluit beschikbaar"}</TableCell>
</TableRow>
))}
Expand Down
11 changes: 11 additions & 0 deletions pwa/src/templates/wooItemDetailTemplate/WOOItemDetailTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ export const WOOItemDetailTemplate: React.FC<WOOItemDetailTemplateProps> = ({ wo
</TableRow>
)}

{getItems.data.Publicatiedatum && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Publicatiedatum")}</TableCell>
<TableCell>
{getItems.data.Publicatiedatum
? translateDate(i18n.language, getItems.data.Publicatiedatum)
: "-"}
</TableCell>
</TableRow>
)}

{getItems.data.Ontvangstdatum && (
<TableRow className={styles.tableRow}>
<TableCell>{t("Ontvangstdatum")}</TableCell>
Expand Down
Loading