Skip to content

Commit

Permalink
Merge pull request #1130 from cultuurnet/feature/PPF-457
Browse files Browse the repository at this point in the history
  • Loading branch information
Anahkiasen authored May 23, 2024
2 parents 47f7acf + fc3bd47 commit 8b4ddbd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ E2E_TEST_PASSWORD=
E2E_TEST_ADMIN_EMAIL=[email protected]
E2E_TEST_ADMIN_PASSWORD=

UITPAS_INTEGRATION_TYPE_ENABLED=true
VITE_UITPAS_INTEGRATION_TYPE_ENABLED=${UITPAS_INTEGRATION_TYPE_ENABLED}
2 changes: 1 addition & 1 deletion resources/ts/Components/IntegrationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Props = Integration &
};

const productTypeToPath = {
"uitpas-api": "/",
uitpas: "/",
"entry-api": "/uitdatabank/entry-api/introduction",
"search-api": "/uitdatabank/search-api/introduction",
widgets: "/widgets/aan-de-slag",
Expand Down
22 changes: 12 additions & 10 deletions resources/ts/Components/IntegrationTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,25 @@ export const getIntegrationTypesInfo = (t: TFunction) => [
export const useIntegrationTypesInfo = () => {
const { t } = useTranslation();

return useMemo(() => getIntegrationTypesInfo(t), [t]);
return useMemo(() => {
const integrationTypesInfo = getIntegrationTypesInfo(t);

// See https://jira.publiq.be/browse/PPF-481
return uitpasEnabled
? integrationTypesInfo
: integrationTypesInfo.filter(
(integrationTypesInfo) =>
integrationTypesInfo.type !== IntegrationType.UiTPAS
);
}, [t]);
};

export type IntegrationTypesInfo = ReturnType<
typeof getIntegrationTypesInfo
>[number];

export const IntegrationTypes = () => {
const integrationTypesInfo = useIntegrationTypesInfo();

// See https://jira.publiq.be/browse/PPF-481
const filteredIntegrationTypes = uitpasEnabled
? integrationTypesInfo
: integrationTypesInfo.filter(
(integrationTypesInfo) =>
integrationTypesInfo.type !== IntegrationType.UiTPAS
);
const filteredIntegrationTypes = useIntegrationTypesInfo();

return (
<div>
Expand Down
2 changes: 1 addition & 1 deletion resources/ts/types/IntegrationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const IntegrationType = {
EntryApi: "entry-api",
SearchApi: "search-api",
Widgets: "widgets",
UiTPAS: "uitpas-api",
UiTPAS: "uitpas",
} as const;

export type IntegrationType = Values<typeof IntegrationType>;
Expand Down

0 comments on commit 8b4ddbd

Please sign in to comment.