Skip to content

Commit

Permalink
Merge branch 'main' into feature/III-6231
Browse files Browse the repository at this point in the history
  • Loading branch information
Anahkiasen authored Oct 19, 2024
2 parents e68de55 + 69af524 commit 5845495
Show file tree
Hide file tree
Showing 38 changed files with 869 additions and 222 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ NEXT_PUBLIC_TAXONOMY_URL=
NEXT_PUBLIC_CULTUURKUUR_LOCATION_ID=
NEXT_PUBLIC_SHOULD_SHOW_BETA_VERSION=
NEXT_PUBLIC_HOTJAR_MISSING_FIELD_NAME=
NEXT_PUBLIC_OWNERSHIP_ENABLED=

SENTRY_AUTH_TOKEN=

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
if: github.actor != 'dependabot-preview[bot]' && github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Publish to Chromatic
uses: chromaui/action@v1
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
29 changes: 13 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '16.20'

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '16.20'

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand All @@ -35,27 +35,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '16.20'

- name: Install dependencies
run: |
yarn install --frozen-lockfile
yarn add @playwright/test@latest --ignore-engines
npx playwright install
run: yarn install --frozen-lockfile
- name: Run Typescript
run: yarn types:check

test-unit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '16.20'

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: '16.20'

- name: Install dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const moduleExports = {
shouldShowBetaVersion: process.env.NEXT_PUBLIC_SHOULD_SHOW_BETA_VERSION,
hotjarEventName: process.env.NEXT_PUBLIC_HOTJAR_EVENT_NAME,
hotjarMissingFieldName: process.env.NEXT_PUBLIC_HOTJAR_MISSING_FIELD_NAME,
ownershipEnabled: process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED,
},
pageExtensions: ['page.tsx', 'page.js', 'api.ts'],
eslint: {
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"lint:check": "next lint",
"format": "prettier . --write --ignore-path ./.gitignore",
"format:check": "prettier . --check --ignore-path ./.gitignore",
"types:check": "tsc",
"types:check": "tsc -v && tsc",
"storybook": "start-storybook -p 6006",
"storybook:build": "build-storybook",
"test:unit": "jest",
"test:e2e": "playwright test",
"ci": "yarn types:check & yarn lint:check & yarn format:check"
"ci": "yarn types:check & yarn lint:check & yarn format:check",
"postinsall": "patch-package --error-on-fail=false"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -115,6 +116,8 @@
"jest": "^26.6.1",
"jest-fetch-mock": "^3.0.3",
"jsconfig-paths-jest-mapper": "^1.0.0",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.8.1",
"pretty-quick": "^3.1.0",
"react-test-renderer": "^17.0.1",
Expand Down
13 changes: 13 additions & 0 deletions patches/@auth0+nextjs-auth0+2.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@auth0/nextjs-auth0/dist/auth0-session/client.js b/node_modules/@auth0/nextjs-auth0/dist/auth0-session/client.js
index 8294f31..15847ab 100644
--- a/node_modules/@auth0/nextjs-auth0/dist/auth0-session/client.js
+++ b/node_modules/@auth0/nextjs-auth0/dist/auth0-session/client.js
@@ -88,7 +88,7 @@ function get(config, _a) {
config.auth0Logout !== false)) {
Object.defineProperty(client, 'endSessionUrl', {
value: function (params) {
- var id_token_hint = params.id_token_hint, post_logout_redirect_uri = params.post_logout_redirect_uri, extraParams = tslib_1.__rest(params, ["id_token_hint", "post_logout_redirect_uri"]);
+ var post_logout_redirect_uri = params.post_logout_redirect_uri, extraParams = tslib_1.__rest(params, ["post_logout_redirect_uri"]);
var parsedUrl = url_1.default.parse((0, url_join_1.default)(issuer.metadata.issuer, '/v2/logout'));
parsedUrl.query = tslib_1.__assign(tslib_1.__assign({}, extraParams), { returnTo: post_logout_redirect_uri, client_id: config.clientID });
Object.entries(parsedUrl.query).forEach(function (_a) {
9 changes: 9 additions & 0 deletions public/assets/uit-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Sentry.init({
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

transportOptions: {
fetchOptions: {
credentials: 'omit',
},
},

replaysOnErrorSampleRate: 1.0,

// This sets the sample rate to be 10%. You may want this to be 100% while
Expand Down
6 changes: 6 additions & 0 deletions sentry.edge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

transportOptions: {
fetchOptions: {
credentials: 'omit',
},
},
});
6 changes: 6 additions & 0 deletions sentry.server.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ Sentry.init({

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

transportOptions: {
fetchOptions: {
credentials: 'omit',
},
},
});
20 changes: 10 additions & 10 deletions src/constants/DaysOfWeek.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Values } from '@/types/Values';

const DaysOfWeek = {
MONDAY: 'monday',
TUESDAY: 'tuesday',
WEDNESDAY: 'wednesday',
THURSDAY: 'thursday',
FRIDAY: 'friday',
SATURDAY: 'saturday',
SUNDAY: 'sunday',
} as const;
const DaysOfWeek = [
'monday',
'tuesday',
'wednesday',
'thursday',
'friday',
'saturday',
'sunday',
] as const;

type DayOfWeek = Values<typeof DaysOfWeek>;
type DayOfWeek = (typeof DaysOfWeek)[number];

export { DaysOfWeek };
export type { DayOfWeek };
3 changes: 2 additions & 1 deletion src/hooks/api/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const getEventsByIds = async ({
q: `id:(${ids.join(' OR ')})`,
});

searchParams.append('embedCalendarSummaries[]', 'xs-text');
searchParams.append('embedCalendarSummaries[]', 'sm-text');
searchParams.append('embedCalendarSummaries[]', 'lg-text');

Expand Down Expand Up @@ -293,7 +294,7 @@ const useGetEventsByCreatorQuery = (
creator,
paginationOptions = { start: 0, limit: 50 },
sortOptions = { field: 'modified', order: 'desc' },
calendarSummaryFormats = ['lg-text', 'sm-text'],
calendarSummaryFormats = ['lg-text', 'sm-text', 'xs-text'],
}: AuthenticatedQueryOptions<
PaginationOptions &
SortOptions &
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/api/offers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const useGetOffersByCreatorQuery = (
creator,
paginationOptions = { start: 0, limit: 50 },
sortOptions = { field: 'modified', order: 'desc' },
calendarSummaryFormats = ['lg-text', 'sm-text'],
calendarSummaryFormats = ['lg-text', 'sm-text', 'xs-text'],
}: AuthenticatedQueryOptions<
PaginationOptions &
SortOptions &
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/api/places.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const useGetPlacesByCreatorQuery = (
creator,
paginationOptions = { start: 0, limit: 50 },
sortOptions = { field: 'modified', order: 'desc' },
calendarSummaryFormats = ['lg-text', 'sm-text'],
calendarSummaryFormats = ['lg-text', 'sm-text', 'xs-text'],
}: AuthenticatedQueryOptions<
PaginationOptions &
SortOptions &
Expand Down
4 changes: 0 additions & 4 deletions src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,6 @@
}
}
},
"pagination": {
"next": "Weiter",
"previous": "Zurück"
},
"pictures": {
"add_button": "Bild hinzufügen",
"change": "Ändern",
Expand Down
4 changes: 0 additions & 4 deletions src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,6 @@
}
}
},
"pagination": {
"next": "Prochain",
"previous": "Dernier"
},
"pictures": {
"add_button": "Ajouter une image",
"change": "Modifier",
Expand Down
4 changes: 0 additions & 4 deletions src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -893,10 +893,6 @@
}
}
},
"pagination": {
"next": "Volgende",
"previous": "Vorige"
},
"pictures": {
"add_button": "Afbeelding toevoegen",
"change": "Wijzigen",
Expand Down
9 changes: 8 additions & 1 deletion src/middleware.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ export const middleware = async (request: NextRequest) => {
const url = new URL('/beta-version', request.url);
return NextResponse.redirect(url);
}

const isOwnershipPage = request.nextUrl.pathname.endsWith('ownerships');

if (isOwnershipPage && !process.env.NEXT_PUBLIC_OWNERSHIP_ENABLED) {
const url = new URL('/404', request.url);
return NextResponse.redirect(url);
}
};

export const config = {
matcher: ['/event', '/login'],
matcher: ['/event', '/login', '/organizers/:id/ownerships'],
};
10 changes: 8 additions & 2 deletions src/pages/PictureUploadBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ const { grey5 } = colors;

const getValue = getValueFromTheme('pictureUploadBox');

const ImageIcon = ({ width }: { width: string }) => {
const ImageIcon = ({
width,
color = grey5,
}: {
width: string;
color?: string;
}) => {
return (
<CustomIcon color={grey5} name={CustomIconVariants.IMAGE} width={width} />
<CustomIcon color={color} name={CustomIconVariants.IMAGE} width={width} />
);
};

Expand Down
7 changes: 6 additions & 1 deletion src/pages/[...params].page.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ const Fallback = () => {

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 && { ownership: 'true' }),
}),
'?',
);
Expand Down
12 changes: 10 additions & 2 deletions src/pages/api/auth/[...auth0].api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ const authServer = getAuthServer();

export default authServer.handleAuth({
async login(req, res) {
const language = req.cookies['udb-language'] ?? 'nl';
const language = req.cookies['udb-language'] || 'nl';
try {
await authServer.handleLogin(req, res, {
authorizationParams: {
audience: 'https://api.publiq.be',
scope: 'openid profile email',
// TODO: Remove once keycloak migration complete
locale: language,
ui_locales: language,
referrer: 'udb',
skip_verify_legacy: 'true',
product_display_name: 'UiTdatabank',
Expand All @@ -23,10 +25,16 @@ export default authServer.handleAuth({
res.status(error.status || 400).end(error.message);
}
},
async logout(req: NextApiRequest, res) {
async logout(req, res) {
const { publicRuntimeConfig } = getConfig();
const language = req.cookies['udb-language'] || 'nl';
try {
await authServer.handleLogout(req, res, {
logoutParams: {
// TODO: Remove once keycloak migration complete
locale: language,
ui_locales: language,
},
returnTo: publicRuntimeConfig.baseUrl,
});
} catch (err) {
Expand Down
Loading

0 comments on commit 5845495

Please sign in to comment.