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

Development to main, week 47 #180

Merged
merged 23 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f1b42e8
Merge remote-tracking branch 'origin/development' into Feature/XW-109…
remko48 Nov 22, 2023
e82d74f
updated oidn
remko48 Nov 22, 2023
e6c46dd
Merge pull request #179 from ConductionNL/Feature/XW-109/object-change
remko48 Nov 22, 2023
6d70ab7
fix for filters and epe site
remko48 Nov 22, 2023
9e9dcdc
Merge pull request #181 from ConductionNL/Feature/XW-109/object-change
remko48 Nov 22, 2023
f996987
prod hotfix
remko48 Nov 22, 2023
8b41e31
Merge branch 'development' into Feature/XW-109/object-change
remko48 Nov 22, 2023
db3457b
revert fix
remko48 Nov 22, 2023
b1363ba
Merge pull request #182 from ConductionNL/Feature/XW-109/object-change
remko48 Nov 22, 2023
e0352f6
prod fix
remko48 Nov 22, 2023
5398db9
Merge pull request #183 from ConductionNL/Feature/XW-109/object-change
remko48 Nov 22, 2023
fe11c31
fixed backendcall bug
remko48 Nov 23, 2023
a062659
cleanup
remko48 Nov 23, 2023
57d239a
Merge pull request #184 from ConductionNL/Feature/XW-109/object-change
remko48 Nov 23, 2023
1ea53fa
set config to prod
remko48 Nov 24, 2023
2c31f6b
Merge pull request #185 from ConductionNL/Feature/XW-119/config
remko48 Nov 24, 2023
17fc347
added openWoo config
remko48 Nov 24, 2023
0beb528
cleanup
remko48 Nov 24, 2023
e719b0d
Merge pull request #186 from ConductionNL/Feature/XW-119/config
remko48 Nov 24, 2023
20207b9
cleanup
remko48 Nov 24, 2023
22f444e
Merge pull request #187 from ConductionNL/Feature/XW-119/config
remko48 Nov 24, 2023
2183041
name change
remko48 Nov 24, 2023
b5a425c
Merge pull request #188 from ConductionNL/Feature/XW-119/config
remko48 Nov 24, 2023
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
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/availableFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default class AvailableFilters {
}

public getCategories = async (): Promise<any> => {
let endpoint = "/openWOO?_queries[]=Categorie";
let endpoint = "/openWOO?_queries[]=categorie";

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

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
4 changes: 2 additions & 2 deletions pwa/src/apiService/resources/openWoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default class OpenWoo {
public getAll = async (filters: IFiltersContext, currentPage: number, limit: number): Promise<any> => {
let endpoint = `/openWOO?extend[]=all${filtersToQueryParams(
filters,
)}&_order[Publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`;
)}&_order[publicatiedatum]=desc&_limit=${limit}&_page=${currentPage}`;

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

const { data } = await this._send(this._instance, "GET", endpoint);
Expand Down
12 changes: 6 additions & 6 deletions pwa/src/context/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { GlobalContext } from "./global";

export interface IFiltersContext {
_search: string | undefined;
"Publicatiedatum[after]": string | undefined;
"Publicatiedatum[before]": string | undefined;
Categorie: string | undefined;
"publicatiedatum[after]": string | undefined;
"publicatiedatum[before]": string | undefined;
categorie: string | undefined;
}

export const defaultFiltersContext: IFiltersContext = {
_search: "",
"Publicatiedatum[after]": undefined,
"Publicatiedatum[before]": undefined,
Categorie: undefined,
"publicatiedatum[after]": undefined,
"publicatiedatum[before]": undefined,
categorie: undefined,
};

export const useFiltersContext = () => {
Expand Down
14 changes: 12 additions & 2 deletions pwa/src/hooks/useEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export const useEnvironment = () => {

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(
"API_BASE_URL",
process.env.GATSBY_DEV_ENVIRONMENT === "true"
? "https://api.gateway.commonground.nu/api"
: 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 ?? "");
Expand All @@ -43,7 +48,12 @@ export const useEnvironment = () => {
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(
"API_BASE_URL",
process.env.GATSBY_DEV_ENVIRONMENT === "true"
? "https://api.gateway.commonground.nu/api"
: 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 ?? "");
Expand Down
4 changes: 2 additions & 2 deletions pwa/src/services/filtersToQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export const filtersToUrlQueryParams = (filters: Record<string, any>): string =>
? value.map((v: string) => v.replace(/\s+/g, "_")).join(`&${key}[]=`)
: (value as string).replace(/\s+/g, "_");

if (key == "Publicatiedatum[after]") return;
if (key == "Publicatiedatum[before]")
if (key == "publicatiedatum[after]") return;
if (key == "publicatiedatum[before]")
return `year=${
generateYearsArray(currentYear - 1995).find((year: any) => {
return year.before === value;
Expand Down
84 changes: 79 additions & 5 deletions pwa/src/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ 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";
import Barendrecht from "./../../static/configFiles/barendrecht.json";
import Ridderkerk from "./../../static/configFiles/ridderkerk.json";
import Buren from "./../../static/configFiles/buren.json";
import Albrandswaard from "./../../static/configFiles/albrandswaard.json";
import StedeBroec from "./../../static/configFiles/stede-broec.json";
import Lansingerland from "./../../static/configFiles/lansingerland.json";
import Waddinxveen from "./../../static/configFiles/waddinxveen..json";
import RijssenHolten from "./../../static/configFiles/rijssen-holten.json";
import HoekscheWaard from "./../../static/configFiles/hoeksche-waard.json";
import Texel from "./../../static/configFiles/texel.json";

export const getConfig = (themeOrDomainName: string): Record<string, any> | undefined => {
switch (themeOrDomainName) {
Expand Down Expand Up @@ -35,20 +45,55 @@ export const getConfig = (themeOrDomainName: string): Record<string, any> | unde
case "open-webconcept-theme":
// case "localhost": // development purposes
return OpenWebconcept;

case "barendrecht":
return Barendrecht;
case "ridderkerk":
return Ridderkerk;
case "buren":
return Buren;
case "albrandswaard":
return Albrandswaard;
case "stedebroec":
return StedeBroec;
case "lansingerland":
return Lansingerland;
case "waddinxveen":
return Waddinxveen;
case "rijssen-holten":
return RijssenHolten;
case "hoeksche-waard":
return HoekscheWaard;
case "texel":
return Texel;

default:
return Conduction;
}
};

export const availableThemes: { label: string; value: string }[] = [
{
label: "Koophulpje",
label: "Alle organisaties",
value: "open-webconcept-theme",
},
{
label: "Conduction",
value: "conduction-theme",
label: "Albrandswaard",
value: "albrandswaard",
},
{
label: "Barendrecht",
value: "barendrecht",
},
{
label: "Buren",
value: "buren",
},
// {
// label: "Conduction",
// value: "conduction-theme",
// },
// development purposes
{
label: "Dinkelland",
value: "dinkelland-theme",
Expand All @@ -57,6 +102,14 @@ export const availableThemes: { label: string; value: string }[] = [
label: "Epe",
value: "epe-theme",
},
{
label: "Hoeksche Waard",
value: "hoeksche-waard",
},
{
label: "Lansingerland",
value: "lansingerland",
},
{
label: "Noaberkracht",
value: "noaberkracht-theme",
Expand All @@ -65,16 +118,37 @@ export const availableThemes: { label: string; value: string }[] = [
label: "Noordwijk",
value: "noordwijk-theme",
},
{
label: "Ridderkerk",
value: "ridderkerk",
},
{
label: "Rijssen-Holten",
value: "rijssen-holten",
},
{
label: "Rotterdam",
value: "rotterdam-theme",
},
{
label: "Stede Broec",
value: "stedebroec",
},
{
label: "Texel",
value: "texel",
},
{
label: "Tubbergen",
value: "tubbergen-theme",
},
{
label: "XXLLNC",
value: "xxllnc-theme",
label: "Waddinxveen",
value: "waddinxveen",
},
// {
// label: "XXLLNC",
// value: "xxllnc-theme",
// },
// development purposes
];
16 changes: 8 additions & 8 deletions pwa/src/templates/templateParts/filters/FiltersTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
getCategories.isSuccess &&
setValue(
"category",
categoryOptions.find((option: any) => option.value === params.Categorie?.replace(/_/g, " ")),
categoryOptions.find((option: any) => option.value === params.categorie?.replace(/_/g, " ")),
);
};

const onSubmit = (data: any) => {
setFilters({
_search: data._search,
"Publicatiedatum[after]": data.year?.after,
"Publicatiedatum[before]": data.year?.before,
Categorie: data.category?.value,
"publicatiedatum[after]": data.year?.after,
"publicatiedatum[before]": data.year?.before,
categorie: data.category?.value,
});
};

Expand Down Expand Up @@ -112,9 +112,9 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
React.useEffect(() => {
if (!getCategories.isSuccess) return;

const categoriesWithData = getCategories.data.Categorie.map((category: any) => ({
const categoriesWithData = getCategories.data.categorie.map((category: any) => ({
label: _.upperFirst(category._id.toLowerCase()),
value: category._id.toLowerCase(),
value: _.upperFirst(category._id.toLowerCase()),
}));

setCategoryOptions(_.orderBy(_.uniqBy(categoriesWithData, "value"), "label", "asc"));
Expand All @@ -138,7 +138,7 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
isClearable
defaultValue={generateYearsArray(currentYear - 2021).find((year: any) => {
return (
year.after === filters["Publicatiedatum[after]"] && year.before === filters["Publicatiedatum[before]"]
year.after === filters["publicatiedatum[after]"] && year.before === filters["publicatiedatum[before]"]
);
})}
{...{ register, errors, control }}
Expand All @@ -151,7 +151,7 @@ export const FiltersTemplate: React.FC<FiltersTemplateProps> = ({ isLoading }) =
options={categoryOptions}
name="category"
placeholder={t("Category")}
defaultValue={categoryOptions && categoryOptions.find((option: any) => option.value === filters.Categorie)}
defaultValue={categoryOptions && categoryOptions.find((option: any) => option.value === filters.categorie)}
isClearable
disabled={getCategories.isLoading}
{...{ register, errors, control }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,28 @@ export const ThemeSwitcherTopBar: React.FC = () => {
initiateFromJSON(watchTheme.value);
}, [watchTheme]);

if (window.sessionStorage.getItem("SHOW_THEME_SWITCHER") === "false") {
return <></>;
}
if (window.sessionStorage.getItem("SHOW_THEME_SWITCHER") === "true") {
return (
<section className={clsx(styles.container, "open-webconcept-theme")}>
<div>
<Heading3>Koophulpje</Heading3>

return (
<section className={clsx(styles.container, "open-webconcept-theme")}>
<div>
<Heading3>Koophulpje</Heading3>
<Paragraph>Bekijk de Woo-berichten van verschillende gemeenten</Paragraph>
</div>

<Paragraph>Bekijk de Woo-berichten van verschillende gemeenten</Paragraph>
</div>
<div>
<Paragraph className={styles.label}>Selecteer een gemeente</Paragraph>

<div>
<Paragraph className={styles.label}>Selecteer een gemeente</Paragraph>
<SelectSingle
options={availableThemes}
name="theme"
ariaLabel="Theme selector"
{...{ register, errors, control }}
/>
</div>
</section>
);
}

<SelectSingle
options={availableThemes}
name="theme"
ariaLabel="Theme selector"
{...{ register, errors, control }}
/>
</div>
</section>
);
return <></>;
};
6 changes: 5 additions & 1 deletion pwa/static/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX="true"
GATSBY_API_BASE_URL=https://api.gateway.commonground.nu/api
GATSBY_NL_DESIGN_THEME_CLASSNAME=conduction-theme

# Always uses Development Gateway
GATSBY_DEV_ENVIRONMENT="true"


# Header
GATSBY_FAVICON_URL="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICAgICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgICAgd2lkdGg9IjcxLjAwMDAwMHB0IiBoZWlnaHQ9IjcwLjAwMDAwMHB0IiB2aWV3Qm94PSIwIDAgNzEuMDAwMDAwIDcwLjAwMDAwMCIKICAgICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWlkWU1pZCBtZWV0Ij4KCiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbG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OME_0000_afb1-1.png

Expand Down
12 changes: 12 additions & 0 deletions pwa/static/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ USE_GITHUB_REPOSITORY_NAME_AS_PATH_PREFIX=
GATSBY_API_BASE_URL=
GATSBY_NL_DESIGN_THEME_CLASSNAME=

# Always uses Development Gateway
GATSBY_DEV_ENVIRONMENT=

# Header
GATSBY_FAVICON_URL=

Expand All @@ -18,5 +21,14 @@ GATSBY_JUMBOTRON_IMAGE_URL=
GATSBY_FOOTER_LOGO_HREF=
GATSBY_FOOTER_CONTENT=

# options: "heading-1" | "heading-2" | "heading-3" | "heading-4" | "heading-5"
GATSBY_FOOTER_CONTENT_HEADER=

#OIDN
GATSBY_OIDN_NUMBER=

#Theme switcher
GATSBY_SHOW_THEME_SWITCHER=

# Deployment option, if you're using this .env file DO NOT REMOVE OR EDIT THIS
GATSBY_ENV_VARS_SET=
12 changes: 12 additions & 0 deletions pwa/static/configFiles/albrandswaard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.common-gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "open-webconcept-theme",
"GATSBY_FAVICON_URL": "https://www.albrandswaard.nl/wp-content/uploads/sites/2/2022/12/cropped-favicon-1-192x192.png",
"GATSBY_ORGANISATION_NAME": "Gemeente Albrandswaard",
"GATSBY_JUMBOTRON_IMAGE_URL": "https://www.albrandswaard.nl/wp-content/uploads/sites/2/2023/11/20230828_046M.Muus_-scaled.jpg",
"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"
}
12 changes: 12 additions & 0 deletions pwa/static/configFiles/barendrecht.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.common-gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "open-webconcept-theme",
"GATSBY_FAVICON_URL": "https://www.barendrecht.nl/wp-content/uploads/2022/08/cropped-favicon-270x270.png",
"GATSBY_ORGANISATION_NAME": "Gemeente Barendrecht",
"GATSBY_JUMBOTRON_IMAGE_URL": "https://www.barendrecht.nl/wp-content/uploads/2023/01/16-9_ITF-6421-scaled.jpg",
"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"
}
12 changes: 12 additions & 0 deletions pwa/static/configFiles/buren.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"GATSBY_SHOW_THEME_SWITCHER": "false",
"GATSBY_API_BASE_URL": "https://api.common-gateway.commonground.nu/api",
"GATSBY_NL_DESIGN_THEME_CLASSNAME": "open-webconcept-theme",
"GATSBY_FAVICON_URL": "https://www.buren.nl/wp-content/uploads/2020/04/cropped-buren_logo-1-32x32.png",
"GATSBY_ORGANISATION_NAME": "Gemeente Buren",
"GATSBY_JUMBOTRON_IMAGE_URL": "https://www.buren.nl/wp-content/uploads/2020/04/waterberging.jpg",
"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"
}
Loading
Loading