From 108f58dcc0a13f354b20142909ee412c0dbed94f Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 29 Oct 2024 13:46:28 +0100 Subject: [PATCH 01/34] Improve legacyPath --- src/pages/[...params].page.js | 38 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/pages/[...params].page.js b/src/pages/[...params].page.js index b61fea2b6..c9fba4afd 100644 --- a/src/pages/[...params].page.js +++ b/src/pages/[...params].page.js @@ -36,12 +36,6 @@ IFrame.propTypes = { const Fallback = () => { const router = useRouter(); - const { - // eslint-disable-next-line no-unused-vars - query: { params = [], ...queryWithoutParams }, - asPath, - } = router; - const { publicRuntimeConfig } = getConfig(); // Keep track of which paths were not found. Do not store as a single boolean @@ -51,37 +45,37 @@ const Fallback = () => { const [notFoundPaths, setNotFoundPaths] = useState(['/404']); useHandleWindowMessage({ [WindowMessageTypes.URL_UNKNOWN]: () => - setNotFoundPaths([asPath, ...notFoundPaths]), + setNotFoundPaths([router.asPath, ...notFoundPaths]), }); const isClientSide = useIsClient(); const { cookies } = useCookiesWithOptions(['token', 'udb-language']); + const token = cookies['token']; + const language = cookies['udb-language']; const legacyPath = useMemo(() => { - const path = new URL(`http://localhost${asPath}`).pathname; - const ownershipPaths = - (router.asPath.startsWith('/organizer') && - !router.asPath.endsWith('/ownerships')) || - router.asPath.startsWith('/search'); + const path = new URL(`http://localhost${router.asPath}`).pathname; + const { params = [], ...queryWithoutParams } = router.query; const queryString = prefixWhenNotEmpty( new URLSearchParams({ ...queryWithoutParams, - jwt: cookies.token, - lang: cookies['udb-language'], - ...(ownershipPaths && - publicRuntimeConfig.ownershipEnabled === 'true' && { - ownership: 'true', - }), + jwt: token, + lang: language, }), '?', ); return `${publicRuntimeConfig.legacyAppUrl}${path}${queryString}`; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [asPath, cookies.token, cookies['udb-language']]); - - if (notFoundPaths.includes(asPath)) { + }, [ + language, + publicRuntimeConfig.legacyAppUrl, + router.asPath, + router.query, + token, + ]); + + if (notFoundPaths.includes(router.asPath)) { return ; } From 7995e618b7cedb656d4a8fa92f1a6481de2fa2af Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 29 Oct 2024 13:47:00 +0100 Subject: [PATCH 02/34] Add deep equal check urls URL_CHANGED --- src/layouts/index.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/layouts/index.js b/src/layouts/index.js index ffdbeb949..37052a6f8 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -67,20 +67,27 @@ const Layout = ({ children }) => { useChangeLanguage(); useHandleWindowMessage({ [WindowMessageTypes.URL_CHANGED]: ({ path }) => { - const currentPath = window.location.pathname; - const url = new URL( + const currentUrl = new URL(window.location.href); + const nextUrl = new URL( `${window.location.protocol}//${window.location.host}${path}`, ); - const query = Object.fromEntries(url.searchParams.entries()); - const hasPage = url.searchParams.has('page'); + + const areUrlsDeepEqual = + currentUrl.pathname === nextUrl.pathname && + [...nextUrl.searchParams.entries()] + .filter(([key]) => key !== 'jwt' && key !== 'lang') + .every(([key, val]) => currentUrl.searchParams.get(key) === val); + + if (areUrlsDeepEqual) { + return; + } + + const hasPage = nextUrl.searchParams.has('page'); + if (hasPage) { - window.history.pushState( - undefined, - '', - `${window.location.protocol}//${window.location.host}${path}`, - ); + window.history.pushState(undefined, '', nextUrl.toString()); } else { - router.push({ pathname: url.pathname, query }); + router.push(`${nextUrl.pathname}${nextUrl.search}`); } }, [WindowMessageTypes.HTTP_ERROR_CODE]: ({ code }) => { From 7380f745838984f8f9ef9beca3ec6f83d08afeb4 Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 29 Oct 2024 13:47:51 +0100 Subject: [PATCH 03/34] Add or remove ownership query in middleware --- src/middleware.api.ts | 45 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/src/middleware.api.ts b/src/middleware.api.ts index 360555794..7aaa0eee1 100644 --- a/src/middleware.api.ts +++ b/src/middleware.api.ts @@ -45,14 +45,49 @@ export const middleware = async (request: NextRequest) => { return NextResponse.redirect(url); } - const isOwnershipPage = request.nextUrl.pathname.endsWith('ownerships'); + const isOwnershipPage = + (request.nextUrl.pathname.startsWith('/organizer') && + !request.nextUrl.pathname.endsWith('/ownerships')) || + request.nextUrl.pathname.startsWith('/search'); - if (isOwnershipPage && !process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED) { - const url = new URL('/404', request.url); - return NextResponse.redirect(url); + if (isOwnershipPage) { + const isOwnershipEnabled = + process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED === 'true'; + + const redirectUrl = new URL(request.nextUrl); + + if ( + isOwnershipEnabled && + redirectUrl.searchParams.get('ownership') === 'true' + ) { + return NextResponse.next(); + } + + if ( + isOwnershipEnabled && + redirectUrl.searchParams.get('ownership') !== 'true' + ) { + redirectUrl.searchParams.set('ownership', 'true'); + return NextResponse.redirect(redirectUrl); + } + + if (!isOwnershipEnabled && redirectUrl.searchParams.has('ownership')) { + redirectUrl.searchParams.delete('ownership'); + return NextResponse.redirect(redirectUrl); + } + + return NextResponse.next(); } }; export const config = { - matcher: ['/event', '/login', '/organizers/:id/ownerships'], + matcher: [ + '/event', + '/login', + '/organizers/:id/ownerships', + '/organizer/(.*)', + '/(.*)/ownerships', + '/search(.*)', + '/[...params]', + ], }; From 8862c048dfc8eedb5b3ea525f0afa88cc06c07f5 Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 29 Oct 2024 14:24:53 +0100 Subject: [PATCH 04/34] Remove params --- src/middleware.api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/middleware.api.ts b/src/middleware.api.ts index 7aaa0eee1..17a22d5d1 100644 --- a/src/middleware.api.ts +++ b/src/middleware.api.ts @@ -54,7 +54,9 @@ export const middleware = async (request: NextRequest) => { const isOwnershipEnabled = process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED === 'true'; - const redirectUrl = new URL(request.nextUrl); + const redirectUrl = new URL(request.url); + // remove the path variables from nextjs routing + redirectUrl.searchParams.delete('params'); if ( isOwnershipEnabled && From f531d49cbc842dcaff705cad6b353cfcbe8df325 Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 29 Oct 2024 14:27:25 +0100 Subject: [PATCH 05/34] use nextUrl --- src/middleware.api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware.api.ts b/src/middleware.api.ts index 17a22d5d1..9c3affc0c 100644 --- a/src/middleware.api.ts +++ b/src/middleware.api.ts @@ -54,7 +54,7 @@ export const middleware = async (request: NextRequest) => { const isOwnershipEnabled = process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED === 'true'; - const redirectUrl = new URL(request.url); + const redirectUrl = new URL(request.nextUrl); // remove the path variables from nextjs routing redirectUrl.searchParams.delete('params'); From ef580d1ddd42de45576b983c1ce22c44cad09de1 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:33:46 +0100 Subject: [PATCH 06/34] Add useLegacyPath --- src/hooks/useLegacyPath.tsx | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/hooks/useLegacyPath.tsx diff --git a/src/hooks/useLegacyPath.tsx b/src/hooks/useLegacyPath.tsx new file mode 100644 index 000000000..eaed85538 --- /dev/null +++ b/src/hooks/useLegacyPath.tsx @@ -0,0 +1,44 @@ +import getConfig from 'next/config'; +import { useRouter } from 'next/router'; +import { useMemo } from 'react'; + +import { useCookiesWithOptions } from './useCookiesWithOptions'; + +const useLegacyPath = () => { + const { cookies } = useCookiesWithOptions(['token', 'udb-language']); + const router = useRouter(); + const { publicRuntimeConfig } = getConfig(); + const prefixWhenNotEmpty = (value, prefix) => + value ? `${prefix}${value}` : value; + const { + // eslint-disable-next-line no-unused-vars + query: { params = [], ...queryWithoutParams }, + asPath, + } = router; + + const useLegacyPath = useMemo(() => { + const path = new URL(`http://localhost${asPath}`).pathname; + const ownershipPaths = + router.asPath.startsWith('/organizer') && + !router.asPath.endsWith('/ownerships'); + const queryString = prefixWhenNotEmpty( + new URLSearchParams({ + ...queryWithoutParams, + jwt: cookies.token, + lang: cookies['udb-language'], + ...(ownershipPaths && + publicRuntimeConfig.ownershipEnabled === 'true' && { + ownership: 'true', + }), + }), + '?', + ); + + return `${publicRuntimeConfig.legacyAppUrl}${path}${queryString}`; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [asPath, cookies.token, cookies['udb-language']]); + + return useLegacyPath; +}; + +export { useLegacyPath }; From 35d1c504aed948be8fde8242ff82b293bb0e61c5 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:33:58 +0100 Subject: [PATCH 07/34] Implement useLegacyPath --- src/pages/[...params].page.js | 42 ++++------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/src/pages/[...params].page.js b/src/pages/[...params].page.js index b61fea2b6..80759822e 100644 --- a/src/pages/[...params].page.js +++ b/src/pages/[...params].page.js @@ -1,21 +1,17 @@ -import getConfig from 'next/config'; import { useRouter } from 'next/router'; import PropTypes from 'prop-types'; -import { memo, useMemo, useState } from 'react'; +import { memo, useState } from 'react'; -import { useCookiesWithOptions } from '@/hooks/useCookiesWithOptions'; import { useHandleWindowMessage, WindowMessageTypes, } from '@/hooks/useHandleWindowMessage'; import { useIsClient } from '@/hooks/useIsClient'; +import { useLegacyPath } from '@/hooks/useLegacyPath'; import PageNotFound from '@/pages/404.page'; import { Box } from '@/ui/Box'; import { getApplicationServerSideProps } from '@/utils/getApplicationServerSideProps'; -const prefixWhenNotEmpty = (value, prefix) => - value ? `${prefix}${value}` : value; - const IFrame = memo(({ url }) => ( { const router = useRouter(); + const { asPath } = router; - const { - // eslint-disable-next-line no-unused-vars - query: { params = [], ...queryWithoutParams }, - asPath, - } = router; - - const { publicRuntimeConfig } = getConfig(); + const legacyPath = useLegacyPath(); // Keep track of which paths were not found. Do not store as a single boolean // for the current path, because it's possible to navigate from a 404 path to @@ -56,31 +47,6 @@ const Fallback = () => { const isClientSide = useIsClient(); - const { cookies } = useCookiesWithOptions(['token', 'udb-language']); - - const legacyPath = useMemo(() => { - const path = new URL(`http://localhost${asPath}`).pathname; - const ownershipPaths = - (router.asPath.startsWith('/organizer') && - !router.asPath.endsWith('/ownerships')) || - router.asPath.startsWith('/search'); - const queryString = prefixWhenNotEmpty( - new URLSearchParams({ - ...queryWithoutParams, - jwt: cookies.token, - lang: cookies['udb-language'], - ...(ownershipPaths && - publicRuntimeConfig.ownershipEnabled === 'true' && { - ownership: 'true', - }), - }), - '?', - ); - - return `${publicRuntimeConfig.legacyAppUrl}${path}${queryString}`; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [asPath, cookies.token, cookies['udb-language']]); - if (notFoundPaths.includes(asPath)) { return ; } From 7d246a8591d8e82513107761cb4edf30f6f9e804 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:34:03 +0100 Subject: [PATCH 08/34] Add translations --- src/i18n/nl.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/i18n/nl.json b/src/i18n/nl.json index 0bf340c49..97f1a30cd 100644 --- a/src/i18n/nl.json +++ b/src/i18n/nl.json @@ -1056,6 +1056,11 @@ } } }, + "search": { + "title": "Zoeken", + "event_places": "Evenementen en locaties", + "organizers": "Organisaties" + }, "selectionTable": { "rowsSelectedCount": "{{count}} rij geselecteerd", "rowsSelectedCount_plural": "{{count}} rijen geselecteerd" From 45faaf3048b74213fe5263b8f70fbd36f64bbf01 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:34:16 +0100 Subject: [PATCH 09/34] Use activeBackgroundColor --- src/ui/Tabs.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx index 420272361..d08137a26 100644 --- a/src/ui/Tabs.tsx +++ b/src/ui/Tabs.tsx @@ -18,7 +18,7 @@ type Props = BoxProps & TabsProps & { activeBackgroundColor?: string }; const Tabs = ({ activeKey, onSelect, - activeBackgroundColor, + activeBackgroundColor = 'white', children: rawChildren, className, ...props @@ -65,7 +65,7 @@ const Tabs = ({ } &.active { - background-color: white; + background-color: ${activeBackgroundColor}; border-bottom-color: ${getValue('activeTabBackgroundColor')}; cursor: default; border-bottom: transparent; From d3d65a7a8d8c0d233adb87d2efc04a907df16b6f Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:35:00 +0100 Subject: [PATCH 10/34] Add search page --- src/pages/search/index.page.tsx | 127 ++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/pages/search/index.page.tsx diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx new file mode 100644 index 000000000..81f6304b8 --- /dev/null +++ b/src/pages/search/index.page.tsx @@ -0,0 +1,127 @@ +import getConfig from 'next/config'; +import { useRouter } from 'next/router'; +import { useEffect, useState } from 'react'; +import { TabContent } from 'react-bootstrap'; +import { useTranslation } from 'react-i18next'; + +import { useIsClient } from '@/hooks/useIsClient'; +import { useLegacyPath } from '@/hooks/useLegacyPath'; +import { Page } from '@/ui/Page'; +import { Stack } from '@/ui/Stack'; +import { Tabs } from '@/ui/Tabs'; +import { colors } from '@/ui/theme'; +import { getApplicationServerSideProps } from '@/utils/getApplicationServerSideProps'; + +import { Scope } from '../create/OfferForm'; + +const Search = () => { + const { publicRuntimeConfig } = getConfig(); + const { t } = useTranslation(); + const [iframeHeight, setIframeHeight] = useState(0); + const legacyPath = useLegacyPath(); + const { query, ...router } = useRouter(); + const tab = (query?.tab as Scope) ?? 'event-places'; + const { udbMainDarkBlue } = colors; + + const handleSelectTab = async (tabKey: Scope) => + router.push( + { + pathname: '/search', + query: { + tab: tabKey, + }, + }, + undefined, + { shallow: true }, + ); + + useEffect(() => { + const handleMessage = (event) => { + if (event.origin !== publicRuntimeConfig.legacyAppUrl) { + return; + } + + if (event.data.height) { + setIframeHeight(event.data.height); + } + }; + window.addEventListener('message', handleMessage); + + return () => window.removeEventListener('message', handleMessage); + }, []); + + return ( + + {t('search.title')} + + + + activeKey={tab} + onSelect={handleSelectTab} + activeBackgroundColor={`${udbMainDarkBlue}`} + css={` + .nav { + margin-left: 1.5rem; + margin-bottom: 1.5rem; + } + .nav-item.nav-link { + padding: 0.4rem 1rem; + border: 1px solid black; + } + .nav-item { + margin: 0 !important; + border-radius: 0; + + &:first-child { + border-right: none; + border-radius: 0.5rem 0 0 0.5rem; + } + + &:last-child { + border-radius: 0 0.5rem 0.5rem 0; + } + + &.active { + color: white; + } + + &.active:hover { + background-color: ${udbMainDarkBlue}; + } + } + `} + > + + {tab === 'event-places' && ( + + + + + + )} + + + {tab === 'organizers' &&
Hello
} +
+ +
+
+
+ ); +}; + +export const getServerSideProps = getApplicationServerSideProps(); + +export default Search; From df76f63e49858e4c052652de8dd461b876face4e Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Wed, 30 Oct 2024 15:02:17 +0100 Subject: [PATCH 11/34] Add isClientSide --- src/pages/search/index.page.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index 81f6304b8..51d0714bf 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -22,6 +22,7 @@ const Search = () => { const { query, ...router } = useRouter(); const tab = (query?.tab as Scope) ?? 'event-places'; const { udbMainDarkBlue } = colors; + const isClientSide = useIsClient(); const handleSelectTab = async (tabKey: Scope) => router.push( @@ -101,13 +102,16 @@ const Search = () => { {tab === 'event-places' && ( - + {isClientSide && ( + + )} )} From 186609e62b5ef20d634aa8b274d6f9ab5d5f1c5f Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 31 Oct 2024 15:53:19 +0100 Subject: [PATCH 12/34] Only show Blank Street toggle for organizers, not offers --- src/pages/steps/LocationStep.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/steps/LocationStep.tsx b/src/pages/steps/LocationStep.tsx index 6a83968df..5dc6a097f 100644 --- a/src/pages/steps/LocationStep.tsx +++ b/src/pages/steps/LocationStep.tsx @@ -708,14 +708,16 @@ const LocationStep = ({ t('location.add_modal.errors.streetAndNumber') } info={ - - onFieldChange({ - streetAndNumber, - location: { streetAndNumber }, - }) - } - /> + scope === ScopeTypes.ORGANIZERS && ( + + onFieldChange({ + streetAndNumber, + location: { streetAndNumber }, + }) + } + /> + ) } /> From 9923562e534be58ed5d8176bbf6238d9d61e87e2 Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 31 Oct 2024 16:06:36 +0100 Subject: [PATCH 13/34] Add regression to test to besure --- src/pages/steps/LocationStep.tsx | 2 +- src/test/e2e/create-place.spec.ts | 1 + src/ui/Inline.tsx | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/steps/LocationStep.tsx b/src/pages/steps/LocationStep.tsx index 5dc6a097f..5863de3fc 100644 --- a/src/pages/steps/LocationStep.tsx +++ b/src/pages/steps/LocationStep.tsx @@ -268,7 +268,7 @@ export const BlankStreetToggle = ({ return ( diff --git a/src/test/e2e/create-place.spec.ts b/src/test/e2e/create-place.spec.ts index d255f532a..fa72135c5 100644 --- a/src/test/e2e/create-place.spec.ts +++ b/src/test/e2e/create-place.spec.ts @@ -51,6 +51,7 @@ test('create a place', async ({ baseURL, page }) => { await page .getByRole('option', { name: dummyPlace.address.municipality }) .click(); + await expect(page.getByTestId('blank_address')).not.toBeVisible(); await page.getByLabel('Straat en nummer').nth(0).click(); await page .getByLabel('Straat en nummer') diff --git a/src/ui/Inline.tsx b/src/ui/Inline.tsx index 4b9277953..8efb65f05 100644 --- a/src/ui/Inline.tsx +++ b/src/ui/Inline.tsx @@ -98,7 +98,7 @@ const inlinePropTypes = [ const getInlineProps = (props: UnknownProps) => pickBy(props, (_value, key) => { // pass aria attributes to the DOM element - if (key.startsWith('aria-')) { + if (key.startsWith('aria-') || key.startsWith('data-')) { return true; } From 1e4dfbc3775e3cd70d8e41e79a7ff3c8b833e284 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:00:48 +0100 Subject: [PATCH 14/34] Update naming --- src/hooks/useLegacyPath.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/useLegacyPath.tsx b/src/hooks/useLegacyPath.tsx index eaed85538..f0daa0399 100644 --- a/src/hooks/useLegacyPath.tsx +++ b/src/hooks/useLegacyPath.tsx @@ -16,7 +16,7 @@ const useLegacyPath = () => { asPath, } = router; - const useLegacyPath = useMemo(() => { + const legacyPath = useMemo(() => { const path = new URL(`http://localhost${asPath}`).pathname; const ownershipPaths = router.asPath.startsWith('/organizer') && @@ -38,7 +38,7 @@ const useLegacyPath = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [asPath, cookies.token, cookies['udb-language']]); - return useLegacyPath; + return legacyPath; }; export { useLegacyPath }; From bf813eb8adc6539571e784e466a17469a174b404 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:25:01 +0100 Subject: [PATCH 15/34] Add message type --- src/hooks/useHandleWindowMessage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/useHandleWindowMessage.js b/src/hooks/useHandleWindowMessage.js index 362c00f88..069222f73 100644 --- a/src/hooks/useHandleWindowMessage.js +++ b/src/hooks/useHandleWindowMessage.js @@ -13,6 +13,7 @@ const WindowMessageTypes = { HTTP_ERROR_CODE: 'HTTP_ERROR_CODE', OFFER_MODERATED: 'OFFER_MODERATED', OPEN_ANNOUNCEMENT_MODAL: 'OPEN_ANNOUNCEMENT_MODAL', + PAGE_HEIGHT: 'PAGE_HEIGHT', }; const useHandleWindowMessage = (eventsMap = {}) => { From 4cb48e9c8864b202e858ee094383056b941ca6b3 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:25:45 +0100 Subject: [PATCH 16/34] Use useHandleWindowMessage --- src/pages/search/index.page.tsx | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index 51d0714bf..a54520a11 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -4,6 +4,10 @@ import { useEffect, useState } from 'react'; import { TabContent } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; +import { + useHandleWindowMessage, + WindowMessageTypes, +} from '@/hooks/useHandleWindowMessage'; import { useIsClient } from '@/hooks/useIsClient'; import { useLegacyPath } from '@/hooks/useLegacyPath'; import { Page } from '@/ui/Page'; @@ -36,20 +40,9 @@ const Search = () => { { shallow: true }, ); - useEffect(() => { - const handleMessage = (event) => { - if (event.origin !== publicRuntimeConfig.legacyAppUrl) { - return; - } - - if (event.data.height) { - setIframeHeight(event.data.height); - } - }; - window.addEventListener('message', handleMessage); - - return () => window.removeEventListener('message', handleMessage); - }, []); + useHandleWindowMessage({ + [WindowMessageTypes.PAGE_HEIGHT]: (event) => setIframeHeight(event?.height), + }); return ( From 1bd455bd8ff6a04b93ac51c1b26f991c1686e6a5 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:40:34 +0100 Subject: [PATCH 17/34] Add custom variant --- src/pages/search/index.page.tsx | 35 +-------- src/ui/Tabs.tsx | 125 +++++++++++++++++++++++--------- 2 files changed, 91 insertions(+), 69 deletions(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index a54520a11..1812685b4 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -12,14 +12,13 @@ import { useIsClient } from '@/hooks/useIsClient'; import { useLegacyPath } from '@/hooks/useLegacyPath'; import { Page } from '@/ui/Page'; import { Stack } from '@/ui/Stack'; -import { Tabs } from '@/ui/Tabs'; +import { Tabs, TabsCustomVariants } from '@/ui/Tabs'; import { colors } from '@/ui/theme'; import { getApplicationServerSideProps } from '@/utils/getApplicationServerSideProps'; import { Scope } from '../create/OfferForm'; const Search = () => { - const { publicRuntimeConfig } = getConfig(); const { t } = useTranslation(); const [iframeHeight, setIframeHeight] = useState(0); const legacyPath = useLegacyPath(); @@ -59,37 +58,7 @@ const Search = () => { activeKey={tab} onSelect={handleSelectTab} activeBackgroundColor={`${udbMainDarkBlue}`} - css={` - .nav { - margin-left: 1.5rem; - margin-bottom: 1.5rem; - } - .nav-item.nav-link { - padding: 0.4rem 1rem; - border: 1px solid black; - } - .nav-item { - margin: 0 !important; - border-radius: 0; - - &:first-child { - border-right: none; - border-radius: 0.5rem 0 0 0.5rem; - } - - &:last-child { - border-radius: 0 0.5rem 0.5rem 0; - } - - &.active { - color: white; - } - - &.active:hover { - background-color: ${udbMainDarkBlue}; - } - } - `} + customVariant={TabsCustomVariants.OUTLINED} > {tab === 'event-places' && ( diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx index d08137a26..844f363aa 100644 --- a/src/ui/Tabs.tsx +++ b/src/ui/Tabs.tsx @@ -6,19 +6,30 @@ import { TabsProps, } from 'react-bootstrap'; +import { Values } from '@/types/Values'; import type { BoxProps } from '@/ui/Box'; import { Box, getBoxProps, parseSpacing } from '@/ui/Box'; -import { getValueFromTheme } from './theme'; +import { colors, getValueFromTheme } from './theme'; const getValue = getValueFromTheme(`tabs`); -type Props = BoxProps & TabsProps & { activeBackgroundColor?: string }; +export const TabsCustomVariants = { + DEFAULT: 'default', + OUTLINED: 'outlined', +} as const; + +type Props = BoxProps & + TabsProps & { + activeBackgroundColor?: string; + customVariant?: Values; + }; const Tabs = ({ activeKey, onSelect, activeBackgroundColor = 'white', + customVariant = TabsCustomVariants.DEFAULT, children: rawChildren, className, ...props @@ -39,45 +50,87 @@ const Tabs = ({ return true; }); + const { udbMainDarkBlue, grey1 } = colors; + const TabStyles = { + default: ` + border-bottom: none; + + .nav-item:last-child { + border-right: 1px solid ${getValue('borderColor')}; + } + + .nav-item { + background-color: white; + color: ${getValue('color')}; + border-radius: ${getValue('borderRadius')}; + padding: ${parseSpacing(3)} ${parseSpacing(4)}; + border-color: ${getValue('borderColor')}; + border-right: none; + + &.nav-link { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + + &.active { + background-color: ${activeBackgroundColor}; + border-bottom-color: ${getValue('activeTabBackgroundColor')}; + cursor: default; + border-bottom: transparent; + } + + &:hover { + color: ${getValue('hoverColor')}; + border-color: transparent; + background-color: ${getValue('hoverTabBackgroundColor')}; + } + } + `, + outlined: ` + .nav { + margin-left: 1.5rem; + margin-bottom: 1.5rem; + } + .nav-item.nav-link { + padding: 0.4rem 1rem; + border: 1px solid black; + } + .nav-item { + margin: 0 !important; + border-radius: 0; + background-color: white; + + &:hover { + background-color: ${grey1}; + } + + &:first-child { + border-right: none; + border-radius: 0.5rem 0 0 0.5rem; + } + + &:last-child { + border-radius: 0 0.5rem 0.5rem 0; + } + + &.active { + color: white; + background-color: ${udbMainDarkBlue}; + } + + &.active:hover { + background-color: ${udbMainDarkBlue}; + } + } +`, + }; + return ( {children} From 7f046ca137167e0578e0dddf0dbaf147387627a2 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:21:11 +0100 Subject: [PATCH 18/34] Add translations --- src/i18n/de.json | 5 +++++ src/i18n/fr.json | 5 +++++ src/i18n/nl.json | 2 +- src/pages/search/index.page.tsx | 6 +++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/i18n/de.json b/src/i18n/de.json index fcc710ec5..d2bae64b2 100644 --- a/src/i18n/de.json +++ b/src/i18n/de.json @@ -1056,6 +1056,11 @@ } } }, + "search": { + "title": "Suchen", + "events_places": "Veranstaltungen und Orte", + "organizers": "Organisationen" + }, "selectionTable": { "rowsSelectedCount": "{{count}} Reihe ausgewählt", "rowsSelectedCount_plural": "{{count}} Reihen ausgewählt" diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 65b108453..5de57e84f 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -1056,6 +1056,11 @@ } } }, + "search": { + "title": "Chercher", + "events_places": "Événements et Lieux", + "organizers": "Organisations" + }, "selectionTable": { "rowsSelectedCount": "{{count}} ligne sélectionnée", "rowsSelectedCount_plural": "{{count}} lignes sélectionnées" diff --git a/src/i18n/nl.json b/src/i18n/nl.json index 97f1a30cd..91e65e636 100644 --- a/src/i18n/nl.json +++ b/src/i18n/nl.json @@ -1058,7 +1058,7 @@ }, "search": { "title": "Zoeken", - "event_places": "Evenementen en locaties", + "events_places": "Evenementen en locaties", "organizers": "Organisaties" }, "selectionTable": { diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index 1812685b4..648bb677d 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -23,7 +23,7 @@ const Search = () => { const [iframeHeight, setIframeHeight] = useState(0); const legacyPath = useLegacyPath(); const { query, ...router } = useRouter(); - const tab = (query?.tab as Scope) ?? 'event-places'; + const tab = (query?.tab as Scope) ?? 'events-places'; const { udbMainDarkBlue } = colors; const isClientSide = useIsClient(); @@ -60,8 +60,8 @@ const Search = () => { activeBackgroundColor={`${udbMainDarkBlue}`} customVariant={TabsCustomVariants.OUTLINED} > - - {tab === 'event-places' && ( + + {tab === 'events-places' && ( {isClientSide && ( From 42d2032c2a97b1b9f3d02eaf7d3b3570b273b3e1 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Mon, 4 Nov 2024 14:24:22 +0100 Subject: [PATCH 19/34] Fix format --- src/pages/search/index.page.tsx | 5 ++++- src/ui/Tabs.tsx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index 648bb677d..eb4abad98 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -60,7 +60,10 @@ const Search = () => { activeBackgroundColor={`${udbMainDarkBlue}`} customVariant={TabsCustomVariants.OUTLINED} > - + {tab === 'events-places' && ( diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx index 844f363aa..4d67eebad 100644 --- a/src/ui/Tabs.tsx +++ b/src/ui/Tabs.tsx @@ -87,6 +87,7 @@ const Tabs = ({ } `, outlined: ` + border-bottom: none; .nav { margin-left: 1.5rem; margin-bottom: 1.5rem; From 13a7eeefda3a4bfc773a03603a579c0417b2202d Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 5 Nov 2024 11:41:06 +0100 Subject: [PATCH 20/34] Add vhande to codeowners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index abcc42d91..3b3506a82 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,7 +1,7 @@ # CODEOWNERS are automatically assigned as possible reviewers to new PRs. # Global owners (also need to be duplicated in later rules) -* @simon-debruijn @brampauwelyn @Anahkiasen +* @simon-debruijn @brampauwelyn @Anahkiasen @vhande # Jenkins / deployment owners Gemfile* @willaerk @paulherbosch From 65c190d64454a15552abd5d920b8c298d0228439 Mon Sep 17 00:00:00 2001 From: simon-debruijn Date: Tue, 5 Nov 2024 13:23:57 +0100 Subject: [PATCH 21/34] Add redirect for manage organisations --- src/redirects.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/redirects.tsx b/src/redirects.tsx index 195506fed..636d9e703 100644 --- a/src/redirects.tsx +++ b/src/redirects.tsx @@ -1,3 +1,5 @@ +import getConfig from 'next/config'; + import { FeatureFlags } from './hooks/useFeatureFlag'; import type { SupportedLanguages } from './i18n'; import type { Values } from './types/Values'; @@ -39,6 +41,8 @@ const createDashboardRedirects = (environment: Environment) => { ]; }; +const { publicRuntimeConfig } = getConfig(); + const getRedirects = ( environment: Environment, language: Values = 'nl', @@ -97,6 +101,11 @@ const getRedirects = ( destination: '/organizers/:organizerId/ownerships', permanent: false, }, + publicRuntimeConfig.ownershipEnabled === 'true' && { + source: '/manage/organizations', + destination: '/search?tab=organizers', + permanent: false, + }, { source: '/:language/copyright', destination: '/copyright', From 87d1193acf2f018b16a0124437ee6a078d383025 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:55:53 +0100 Subject: [PATCH 22/34] Add ff --- src/pages/search/index.page.tsx | 72 +++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index eb4abad98..433f3e2c2 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -26,6 +26,8 @@ const Search = () => { const tab = (query?.tab as Scope) ?? 'events-places'; const { udbMainDarkBlue } = colors; const isClientSide = useIsClient(); + const { publicRuntimeConfig } = getConfig(); + const isOwnershipEnabled = publicRuntimeConfig.ownershipEnabled === 'true'; const handleSelectTab = async (tabKey: Scope) => router.push( @@ -54,37 +56,47 @@ const Search = () => { overflow-y: auto; `} > - - activeKey={tab} - onSelect={handleSelectTab} - activeBackgroundColor={`${udbMainDarkBlue}`} - customVariant={TabsCustomVariants.OUTLINED} - > - + activeKey={tab} + onSelect={handleSelectTab} + activeBackgroundColor={`${udbMainDarkBlue}`} + customVariant={TabsCustomVariants.OUTLINED} > - {tab === 'events-places' && ( - - - {isClientSide && ( - - )} - - - )} - - - {tab === 'organizers' &&
Hello
} -
- + + {tab === 'events-places' && ( + + + {isClientSide && ( + + )} + + + )} + + + {tab === 'organizers' &&
Hello
} +
+ + )} + {!isOwnershipEnabled && isClientSide && ( + + )}
From 2a5d26fcea85e64ab71b3356016dbe48faf1d295 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:14:39 +0100 Subject: [PATCH 23/34] Update [...params].page.js --- src/pages/[...params].page.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/[...params].page.js b/src/pages/[...params].page.js index d75a16b20..144b96841 100644 --- a/src/pages/[...params].page.js +++ b/src/pages/[...params].page.js @@ -1,17 +1,21 @@ +import getConfig from 'next/config'; import { useRouter } from 'next/router'; import PropTypes from 'prop-types'; -import { memo, useState } from 'react'; +import { memo, useMemo, useState } from 'react'; +import { useCookiesWithOptions } from '@/hooks/useCookiesWithOptions'; import { useHandleWindowMessage, WindowMessageTypes, } from '@/hooks/useHandleWindowMessage'; import { useIsClient } from '@/hooks/useIsClient'; -import { useLegacyPath } from '@/hooks/useLegacyPath'; import PageNotFound from '@/pages/404.page'; import { Box } from '@/ui/Box'; import { getApplicationServerSideProps } from '@/utils/getApplicationServerSideProps'; +const prefixWhenNotEmpty = (value, prefix) => + value ? `${prefix}${value}` : value; + const IFrame = memo(({ url }) => ( { const router = useRouter(); - const { asPath } = router; - const { publicRuntimeConfig } = getConfig(); // Keep track of which paths were not found. Do not store as a single boolean From 0c56fc35ffc0b30939cf99f061336f1e93cb155f Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:24:48 +0100 Subject: [PATCH 24/34] Rename variant --- src/pages/search/index.page.tsx | 23 +++++++++++++++++++---- src/ui/Tabs.tsx | 10 +++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index 433f3e2c2..ce24a95f4 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -1,6 +1,6 @@ import getConfig from 'next/config'; import { useRouter } from 'next/router'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { TabContent } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; @@ -12,7 +12,7 @@ import { useIsClient } from '@/hooks/useIsClient'; import { useLegacyPath } from '@/hooks/useLegacyPath'; import { Page } from '@/ui/Page'; import { Stack } from '@/ui/Stack'; -import { Tabs, TabsCustomVariants } from '@/ui/Tabs'; +import { Tabs, TabsVariants } from '@/ui/Tabs'; import { colors } from '@/ui/theme'; import { getApplicationServerSideProps } from '@/utils/getApplicationServerSideProps'; @@ -61,7 +61,7 @@ const Search = () => { activeKey={tab} onSelect={handleSelectTab} activeBackgroundColor={`${udbMainDarkBlue}`} - customVariant={TabsCustomVariants.OUTLINED} + variant={TabsVariants.OUTLINED} > { )} - {tab === 'organizers' &&
Hello
} + {tab === 'organizers' && ( + + + {isClientSide && ( + + )} + + + )}
)} diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx index 4d67eebad..6078c0d05 100644 --- a/src/ui/Tabs.tsx +++ b/src/ui/Tabs.tsx @@ -14,22 +14,22 @@ import { colors, getValueFromTheme } from './theme'; const getValue = getValueFromTheme(`tabs`); -export const TabsCustomVariants = { +export const TabsVariants = { DEFAULT: 'default', OUTLINED: 'outlined', } as const; type Props = BoxProps & - TabsProps & { + Omit & { activeBackgroundColor?: string; - customVariant?: Values; + variant?: Values; }; const Tabs = ({ activeKey, onSelect, activeBackgroundColor = 'white', - customVariant = TabsCustomVariants.DEFAULT, + variant = TabsVariants.DEFAULT, children: rawChildren, className, ...props @@ -131,7 +131,7 @@ const Tabs = ({ {children} From 32f93ab3d7131023f8a9c2563a567863622afcd2 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:37:48 +0100 Subject: [PATCH 25/34] Delete /search from the ownership pages. --- src/middleware.api.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/middleware.api.ts b/src/middleware.api.ts index 9c3affc0c..994a67820 100644 --- a/src/middleware.api.ts +++ b/src/middleware.api.ts @@ -46,9 +46,8 @@ export const middleware = async (request: NextRequest) => { } const isOwnershipPage = - (request.nextUrl.pathname.startsWith('/organizer') && - !request.nextUrl.pathname.endsWith('/ownerships')) || - request.nextUrl.pathname.startsWith('/search'); + request.nextUrl.pathname.startsWith('/organizer') && + !request.nextUrl.pathname.endsWith('/ownerships'); if (isOwnershipPage) { const isOwnershipEnabled = From b8855e9795f3ae676d176f6415d1bca31bbcb695 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:51:13 +0100 Subject: [PATCH 26/34] Add redirect for /search?tab=organizers --- src/redirects.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/redirects.tsx b/src/redirects.tsx index 636d9e703..b54144068 100644 --- a/src/redirects.tsx +++ b/src/redirects.tsx @@ -101,9 +101,16 @@ const getRedirects = ( destination: '/organizers/:organizerId/ownerships', permanent: false, }, - publicRuntimeConfig.ownershipEnabled === 'true' && { - source: '/manage/organizations', - destination: '/search?tab=organizers', + publicRuntimeConfig.ownershipEnabled === 'false' && { + source: '/search', + has: [ + { + type: 'query', + key: 'tab', + value: 'organizers', + }, + ], + destination: '/404', permanent: false, }, { From cfb6326900e06076dd357ed72cee45047c74f684 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:45:05 +0100 Subject: [PATCH 27/34] Fix eslint --- src/hooks/useLegacyPath.tsx | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/hooks/useLegacyPath.tsx b/src/hooks/useLegacyPath.tsx index f0daa0399..cbfd4790f 100644 --- a/src/hooks/useLegacyPath.tsx +++ b/src/hooks/useLegacyPath.tsx @@ -10,33 +10,30 @@ const useLegacyPath = () => { const { publicRuntimeConfig } = getConfig(); const prefixWhenNotEmpty = (value, prefix) => value ? `${prefix}${value}` : value; - const { - // eslint-disable-next-line no-unused-vars - query: { params = [], ...queryWithoutParams }, - asPath, - } = router; + + const jwt = cookies.token; + const lang = cookies['udb-language']; const legacyPath = useMemo(() => { - const path = new URL(`http://localhost${asPath}`).pathname; - const ownershipPaths = - router.asPath.startsWith('/organizer') && - !router.asPath.endsWith('/ownerships'); + const path = new URL(`http://localhost${router.asPath}`).pathname; + const { params = [], ...queryWithoutParams } = router.query; const queryString = prefixWhenNotEmpty( new URLSearchParams({ ...queryWithoutParams, - jwt: cookies.token, - lang: cookies['udb-language'], - ...(ownershipPaths && - publicRuntimeConfig.ownershipEnabled === 'true' && { - ownership: 'true', - }), + jwt, + lang, }), '?', ); return `${publicRuntimeConfig.legacyAppUrl}${path}${queryString}`; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [asPath, cookies.token, cookies['udb-language']]); + }, [ + router.asPath, + router.query, + jwt, + lang, + publicRuntimeConfig.legacyAppUrl, + ]); return legacyPath; }; From 413a97fe3b7b67a68728e4ce25ea3a72a322a86f Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:49:40 +0100 Subject: [PATCH 28/34] Update redirects.tsx --- src/redirects.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/redirects.tsx b/src/redirects.tsx index b54144068..bc4d75bac 100644 --- a/src/redirects.tsx +++ b/src/redirects.tsx @@ -101,15 +101,13 @@ const getRedirects = ( destination: '/organizers/:organizerId/ownerships', permanent: false, }, + publicRuntimeConfig.ownershipEnabled === 'true' && { + source: '/manage/organizations', + destination: '/search?tab=organizers', + permanent: false, + }, publicRuntimeConfig.ownershipEnabled === 'false' && { - source: '/search', - has: [ - { - type: 'query', - key: 'tab', - value: 'organizers', - }, - ], + source: '/search?tab=organizers', destination: '/404', permanent: false, }, From 6a95235742cab5655129a9ece358073c5128fa94 Mon Sep 17 00:00:00 2001 From: vhande <78013271+vhande@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:49:48 +0100 Subject: [PATCH 29/34] Add margin --- src/pages/search/index.page.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/search/index.page.tsx b/src/pages/search/index.page.tsx index ce24a95f4..c052250d6 100644 --- a/src/pages/search/index.page.tsx +++ b/src/pages/search/index.page.tsx @@ -62,6 +62,11 @@ const Search = () => { onSelect={handleSelectTab} activeBackgroundColor={`${udbMainDarkBlue}`} variant={TabsVariants.OUTLINED} + css={` + .nav-tabs { + margin-left: 1.5rem; + } + `} > Date: Tue, 12 Nov 2024 14:46:13 +0100 Subject: [PATCH 30/34] Fix ownership organizer name --- .../organizers/[organizerId]/ownerships/index.page.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/organizers/[organizerId]/ownerships/index.page.tsx b/src/pages/organizers/[organizerId]/ownerships/index.page.tsx index cd5891ddb..2344673ff 100644 --- a/src/pages/organizers/[organizerId]/ownerships/index.page.tsx +++ b/src/pages/organizers/[organizerId]/ownerships/index.page.tsx @@ -60,6 +60,9 @@ const Ownership = () => { }); // @ts-expect-error const organizer: Organizer = getOrganizerByIdQuery?.data; + const organizerName = + organizer?.name?.[i18n.language] ?? + organizer?.name?.[organizer.mainLanguage]; const getOwnershipRequestsQuery = useGetOwnershipRequestsQuery({ organizerId: organizerId, @@ -118,7 +121,7 @@ const Ownership = () => { {t('organizers.ownerships.title', { - name: organizer?.name?.[i18n.language], + name: organizerName, })} @@ -142,7 +145,7 @@ const Ownership = () => { i18nKey={`${translationsPath}.success`} values={{ ownerEmail: selectedRequest?.ownerEmail, - organizerName: organizer?.name?.[i18n.language], + organizerName: organizerName, }} /> @@ -232,7 +235,7 @@ const Ownership = () => { i18nKey={`${translationsPath}.body`} values={{ ownerEmail: selectedRequest?.ownerEmail, - organizerName: organizer?.name?.[i18n.language], + organizerName: organizerName, }} />
From a0386717449c548fd63796f8dbe872705e271bac Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 14 Nov 2024 11:54:07 +0100 Subject: [PATCH 31/34] Use field name instead of testid --- package.json | 2 +- src/pages/steps/LocationStep.tsx | 1 - src/test/e2e/create-place.spec.ts | 2 +- src/ui/Inline.tsx | 2 +- yarn.lock | 30 ++++++++++++++++++------------ 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 6c6f3dcb8..144db0eb9 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.0.2", - "@playwright/test": "^1.31.2", + "@playwright/test": "^1.48.2", "@storybook/addon-a11y": "^6.5.16", "@storybook/addon-actions": "^6.5.16", "@storybook/addon-essentials": "^6.5.16", diff --git a/src/pages/steps/LocationStep.tsx b/src/pages/steps/LocationStep.tsx index 5863de3fc..0ca07a1f6 100644 --- a/src/pages/steps/LocationStep.tsx +++ b/src/pages/steps/LocationStep.tsx @@ -268,7 +268,6 @@ export const BlankStreetToggle = ({ return ( diff --git a/src/test/e2e/create-place.spec.ts b/src/test/e2e/create-place.spec.ts index fa72135c5..6c99e2671 100644 --- a/src/test/e2e/create-place.spec.ts +++ b/src/test/e2e/create-place.spec.ts @@ -51,7 +51,7 @@ test('create a place', async ({ baseURL, page }) => { await page .getByRole('option', { name: dummyPlace.address.municipality }) .click(); - await expect(page.getByTestId('blank_address')).not.toBeVisible(); + await expect(page.getByLabel('blank_address')).not.toBeVisible(); await page.getByLabel('Straat en nummer').nth(0).click(); await page .getByLabel('Straat en nummer') diff --git a/src/ui/Inline.tsx b/src/ui/Inline.tsx index 8efb65f05..4b9277953 100644 --- a/src/ui/Inline.tsx +++ b/src/ui/Inline.tsx @@ -98,7 +98,7 @@ const inlinePropTypes = [ const getInlineProps = (props: UnknownProps) => pickBy(props, (_value, key) => { // pass aria attributes to the DOM element - if (key.startsWith('aria-') || key.startsWith('data-')) { + if (key.startsWith('aria-')) { return true; } diff --git a/yarn.lock b/yarn.lock index 374157541..ecc793f29 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1767,15 +1767,12 @@ tiny-glob "^0.2.9" tslib "^2.4.0" -"@playwright/test@^1.31.2": - version "1.31.2" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.31.2.tgz#426d8545143a97a6fed250a2a27aa1c8e5e2548e" - integrity sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw== +"@playwright/test@^1.48.2": + version "1.48.2" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.48.2.tgz#87dd40633f980872283404c8142a65744d3f13d6" + integrity sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw== dependencies: - "@types/node" "*" - playwright-core "1.31.2" - optionalDependencies: - fsevents "2.3.2" + playwright "1.48.2" "@pmmmwh/react-refresh-webpack-plugin@^0.5.3": version "0.5.10" @@ -11332,10 +11329,19 @@ pkg-dir@^5.0.0: dependencies: find-up "^5.0.0" -playwright-core@1.31.2: - version "1.31.2" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.2.tgz#debf4b215d14cb619adb7e511c164d068075b2ed" - integrity sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ== +playwright-core@1.48.2: + version "1.48.2" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.48.2.tgz#cd76ed8af61690edef5c05c64721c26a8db2f3d7" + integrity sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA== + +playwright@1.48.2: + version "1.48.2" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.48.2.tgz#fca45ae8abdc34835c715718072aaff7e305167e" + integrity sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ== + dependencies: + playwright-core "1.48.2" + optionalDependencies: + fsevents "2.3.2" please-upgrade-node@^3.2.0: version "3.2.0" From 44ff2a6a9ca2ef9e8689154b6f824496ee380ce2 Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 14 Nov 2024 11:57:45 +0100 Subject: [PATCH 32/34] Revert accidental package upgrade --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 144db0eb9..6c6f3dcb8 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.0.2", - "@playwright/test": "^1.48.2", + "@playwright/test": "^1.31.2", "@storybook/addon-a11y": "^6.5.16", "@storybook/addon-actions": "^6.5.16", "@storybook/addon-essentials": "^6.5.16", diff --git a/yarn.lock b/yarn.lock index ecc793f29..ab580e40b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1767,7 +1767,7 @@ tiny-glob "^0.2.9" tslib "^2.4.0" -"@playwright/test@^1.48.2": +"@playwright/test@^1.31.2": version "1.48.2" resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.48.2.tgz#87dd40633f980872283404c8142a65744d3f13d6" integrity sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw== From fb43adada42e94dddf466c54fdb881b19f9ad0bd Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 14 Nov 2024 12:17:13 +0100 Subject: [PATCH 33/34] Regenerate lockfile --- yarn.lock | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/yarn.lock b/yarn.lock index ab580e40b..fbcfce1f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1767,12 +1767,15 @@ tiny-glob "^0.2.9" tslib "^2.4.0" -"@playwright/test@^1.31.2": - version "1.48.2" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.48.2.tgz#87dd40633f980872283404c8142a65744d3f13d6" - integrity sha512-54w1xCWfXuax7dz4W2M9uw0gDyh+ti/0K/MxcCUxChFh37kkdxPdfZDw5QBbuPUJHr1CiHJ1hXgSs+GgeQc5Zw== +"@playwright/test@1.31.2": + version "1.31.2" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.31.2.tgz#426d8545143a97a6fed250a2a27aa1c8e5e2548e" + integrity sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw== dependencies: - playwright "1.48.2" + "@types/node" "*" + playwright-core "1.31.2" + optionalDependencies: + fsevents "2.3.2" "@pmmmwh/react-refresh-webpack-plugin@^0.5.3": version "0.5.10" @@ -11329,19 +11332,10 @@ pkg-dir@^5.0.0: dependencies: find-up "^5.0.0" -playwright-core@1.48.2: - version "1.48.2" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.48.2.tgz#cd76ed8af61690edef5c05c64721c26a8db2f3d7" - integrity sha512-sjjw+qrLFlriJo64du+EK0kJgZzoQPsabGF4lBvsid+3CNIZIYLgnMj9V6JY5VhM2Peh20DJWIVpVljLLnlawA== - -playwright@1.48.2: - version "1.48.2" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.48.2.tgz#fca45ae8abdc34835c715718072aaff7e305167e" - integrity sha512-NjYvYgp4BPmiwfe31j4gHLa3J7bD2WiBz8Lk2RoSsmX38SVIARZ18VYjxLjAcDsAhA+F4iSEXTSGgjua0rrlgQ== - dependencies: - playwright-core "1.48.2" - optionalDependencies: - fsevents "2.3.2" +playwright-core@1.31.2: + version "1.31.2" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.2.tgz#debf4b215d14cb619adb7e511c164d068075b2ed" + integrity sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ== please-upgrade-node@^3.2.0: version "3.2.0" From 492a31618ddb5756214400b4f25a83e629a0e6b1 Mon Sep 17 00:00:00 2001 From: Emma Fabre Date: Thu, 14 Nov 2024 12:18:25 +0100 Subject: [PATCH 34/34] Just lock goddamn Playwright since we're stuck on 31 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6c6f3dcb8..c134343a0 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.0.2", - "@playwright/test": "^1.31.2", + "@playwright/test": "1.31.2", "@storybook/addon-a11y": "^6.5.16", "@storybook/addon-actions": "^6.5.16", "@storybook/addon-essentials": "^6.5.16",