From 69904a8ab1b249fd706987619b2e914b124288a6 Mon Sep 17 00:00:00 2001
From: Marc Buma
Date: Wed, 19 Jun 2024 10:24:13 +0200
Subject: [PATCH] Merge edits made directly in main to acceptance (#91)
* Fix stallingdetails not showing, add text message when there are no subscriptions available
* remove border from no subscription text
* Add "Opwaarderen stallingstegoed" link to Login screen
* Remove message 'Openingstijden edit not working'
---------
Co-authored-by: bartwr
---
package-lock.json | 195 +++++++++----
src/components/parking/ParkingEditOpening.tsx | 4 +-
.../parking/ParkingViewAbonnementen.tsx | 28 +-
.../parking/ParkingViewCapaciteit.tsx | 8 +-
src/pages/content.tsx | 49 +++-
src/pages/login.tsx | 266 +++++++++---------
6 files changed, 337 insertions(+), 213 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index dbf73c6..fb02753 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "0.1.0",
"hasInstallScript": true,
"dependencies": {
+ "@auth/prisma-adapter": "^1.5.0",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@fontsource/roboto": "^4.5.8",
@@ -35,6 +36,7 @@
"next-auth": "^4.23.1",
"next-pwa": "^5.6.0",
"next-redux-wrapper": "^8.1.0",
+ "nodemailer": "^6.9.12",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "^2.4.1",
@@ -45,7 +47,7 @@
},
"devDependencies": {
"@prisma-korea/prisma-generator-proto": "^2.3.2",
- "@prisma/client": "^5.1.1",
+ "@prisma/client": "^5.11.0",
"@types/bcrypt": "^5.0.0",
"@types/eslint": "^8.21.3",
"@types/formidable": "^3.4.3",
@@ -63,7 +65,7 @@
"postcss": "^8.4.21",
"prettier": "^2.8.6",
"prettier-plugin-tailwindcss": "^0.2.5",
- "prisma": "^5.9.1",
+ "prisma": "^5.11.0",
"tailwindcss": "^3.2.7",
"typescript": "^5.0.2"
}
@@ -116,6 +118,83 @@
"nun": "bin/nun.mjs"
}
},
+ "node_modules/@auth/core": {
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/@auth/core/-/core-0.29.0.tgz",
+ "integrity": "sha512-MdfEjU6WRjUnPG1+XeBWrTIlAsLZU6V0imCIqVDDDPxLI6UZWldXVqAA2EsDazGofV78jqiCLHaN85mJITDqdg==",
+ "dependencies": {
+ "@panva/hkdf": "^1.1.1",
+ "@types/cookie": "0.6.0",
+ "cookie": "0.6.0",
+ "jose": "^5.1.3",
+ "oauth4webapi": "^2.4.0",
+ "preact": "10.11.3",
+ "preact-render-to-string": "5.2.3"
+ },
+ "peerDependencies": {
+ "@simplewebauthn/browser": "^9.0.1",
+ "@simplewebauthn/server": "^9.0.2",
+ "nodemailer": "^6.8.0"
+ },
+ "peerDependenciesMeta": {
+ "@simplewebauthn/browser": {
+ "optional": true
+ },
+ "@simplewebauthn/server": {
+ "optional": true
+ },
+ "nodemailer": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@auth/core/node_modules/cookie": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/@auth/core/node_modules/jose": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/jose/-/jose-5.3.0.tgz",
+ "integrity": "sha512-IChe9AtAE79ru084ow8jzkN2lNrG3Ntfiv65Cvj9uOCE2m5LNsdHG+9EbxWxAoWRF9TgDOqLN5jm08++owDVRg==",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
+ "node_modules/@auth/core/node_modules/preact": {
+ "version": "10.11.3",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.11.3.tgz",
+ "integrity": "sha512-eY93IVpod/zG3uMF22Unl8h9KkrcKIRs2EGar8hwLZZDU1lkjph303V9HZBwufh2s736U6VXuhD109LYqPoffg==",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/preact"
+ }
+ },
+ "node_modules/@auth/core/node_modules/preact-render-to-string": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-5.2.3.tgz",
+ "integrity": "sha512-aPDxUn5o3GhWdtJtW0svRC2SS/l8D9MAgo2+AWml+BhDImb27ALf04Q2d+AHqUUOc6RdSXFIBVa2gxzgMKgtZA==",
+ "dependencies": {
+ "pretty-format": "^3.8.0"
+ },
+ "peerDependencies": {
+ "preact": ">=10"
+ }
+ },
+ "node_modules/@auth/prisma-adapter": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@auth/prisma-adapter/-/prisma-adapter-1.6.0.tgz",
+ "integrity": "sha512-PQU8/Oi5gfjzb0MkhMGVX0Dg877phPzsQdK54+C7ubukCeZPjyvuSAx1vVtWEYVWp2oQvjgG/C6QiDoeC7S10A==",
+ "dependencies": {
+ "@auth/core": "0.29.0"
+ },
+ "peerDependencies": {
+ "@prisma/client": ">=2.26.0 || >=3 || >=4 || >=5"
+ }
+ },
"node_modules/@babel/code-frame": {
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
@@ -125,7 +204,7 @@
"chalk": "^2.4.2"
},
"engines": {
- "node": ">=6.9.0"
+ "node": ">= 0.6"
}
},
"node_modules/@babel/code-frame/node_modules/ansi-styles": {
@@ -2831,10 +2910,9 @@
}
},
"node_modules/@prisma/client": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.9.1.tgz",
- "integrity": "sha512-caSOnG4kxcSkhqC/2ShV7rEoWwd3XrftokxJqOCMVvia4NYV/TPtJlS9C2os3Igxw/Qyxumj9GBQzcStzECvtQ==",
- "devOptional": true,
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.14.0.tgz",
+ "integrity": "sha512-akMSuyvLKeoU4LeyBAUdThP/uhVP3GuLygFE3MlYzaCb3/J8SfsYBE5PkaFuLuVpLyA6sFoW+16z/aPhNAESqg==",
"hasInstallScript": true,
"engines": {
"node": ">=16.13"
@@ -2860,46 +2938,46 @@
}
},
"node_modules/@prisma/engines": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.9.1.tgz",
- "integrity": "sha512-gkdXmjxQ5jktxWNdDA5aZZ6R8rH74JkoKq6LD5mACSvxd2vbqWeWIOV0Py5wFC8vofOYShbt6XUeCIUmrOzOnQ==",
- "dev": true,
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.14.0.tgz",
+ "integrity": "sha512-lgxkKZ6IEygVcw6IZZUlPIfLQ9hjSYAtHjZ5r64sCLDgVzsPFCi2XBBJgzPMkOQ5RHzUD4E/dVdpn9+ez8tk1A==",
+ "devOptional": true,
"hasInstallScript": true,
"dependencies": {
- "@prisma/debug": "5.9.1",
- "@prisma/engines-version": "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64",
- "@prisma/fetch-engine": "5.9.1",
- "@prisma/get-platform": "5.9.1"
+ "@prisma/debug": "5.14.0",
+ "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "@prisma/fetch-engine": "5.14.0",
+ "@prisma/get-platform": "5.14.0"
}
},
"node_modules/@prisma/engines-version": {
- "version": "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64",
- "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64.tgz",
- "integrity": "sha512-HFl7275yF0FWbdcNvcSRbbu9JCBSLMcurYwvWc8WGDnpu7APxQo2ONtZrUggU3WxLxUJ2uBX+0GOFIcJeVeOOQ==",
- "dev": true
+ "version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48.tgz",
+ "integrity": "sha512-ip6pNkRo1UxWv+6toxNcYvItNYaqQjXdFNGJ+Nuk2eYtRoEdoF13wxo7/jsClJFFenMPVNVqXQDV0oveXnR1cA==",
+ "devOptional": true
},
"node_modules/@prisma/engines/node_modules/@prisma/debug": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.9.1.tgz",
- "integrity": "sha512-yAHFSFCg8KVoL0oRUno3m60GAjsUKYUDkQ+9BA2X2JfVR3kRVSJFc/GpQ2fSORi4pSHZR9orfM4UC9OVXIFFTA==",
- "dev": true
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz",
+ "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==",
+ "devOptional": true
},
"node_modules/@prisma/fetch-engine": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.9.1.tgz",
- "integrity": "sha512-l0goQOMcNVOJs1kAcwqpKq3ylvkD9F04Ioe1oJoCqmz05mw22bNAKKGWuDd3zTUoUZr97va0c/UfLNru+PDmNA==",
- "dev": true,
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.14.0.tgz",
+ "integrity": "sha512-VrheA9y9DMURK5vu8OJoOgQpxOhas3qF0IBHJ8G/0X44k82kc8E0w98HCn2nhnbOOMwbWsJWXfLC2/F8n5u0gQ==",
+ "devOptional": true,
"dependencies": {
- "@prisma/debug": "5.9.1",
- "@prisma/engines-version": "5.9.0-32.23fdc5965b1e05fc54e5f26ed3de66776b93de64",
- "@prisma/get-platform": "5.9.1"
+ "@prisma/debug": "5.14.0",
+ "@prisma/engines-version": "5.14.0-25.e9771e62de70f79a5e1c604a2d7c8e2a0a874b48",
+ "@prisma/get-platform": "5.14.0"
}
},
"node_modules/@prisma/fetch-engine/node_modules/@prisma/debug": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.9.1.tgz",
- "integrity": "sha512-yAHFSFCg8KVoL0oRUno3m60GAjsUKYUDkQ+9BA2X2JfVR3kRVSJFc/GpQ2fSORi4pSHZR9orfM4UC9OVXIFFTA==",
- "dev": true
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz",
+ "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==",
+ "devOptional": true
},
"node_modules/@prisma/generator-helper": {
"version": "3.15.2",
@@ -2914,19 +2992,19 @@
}
},
"node_modules/@prisma/get-platform": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.9.1.tgz",
- "integrity": "sha512-6OQsNxTyhvG+T2Ksr8FPFpuPeL4r9u0JF0OZHUBI/Uy9SS43sPyAIutt4ZEAyqWQt104ERh70EZedkHZKsnNbg==",
- "dev": true,
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.14.0.tgz",
+ "integrity": "sha512-/yAyBvcEjRv41ynZrhdrPtHgk47xLRRq/o5eWGcUpBJ1YrUZTYB8EoPiopnP7iQrMATK8stXQdPOoVlrzuTQZw==",
+ "devOptional": true,
"dependencies": {
- "@prisma/debug": "5.9.1"
+ "@prisma/debug": "5.14.0"
}
},
"node_modules/@prisma/get-platform/node_modules/@prisma/debug": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.9.1.tgz",
- "integrity": "sha512-yAHFSFCg8KVoL0oRUno3m60GAjsUKYUDkQ+9BA2X2JfVR3kRVSJFc/GpQ2fSORi4pSHZR9orfM4UC9OVXIFFTA==",
- "dev": true
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.14.0.tgz",
+ "integrity": "sha512-iq56qBZuFfX3fCxoxT8gBX33lQzomBU0qIUaEj1RebsKVz1ob/BVH1XSBwwwvRVtZEV1b7Fxx2eVu34Ge/mg3w==",
+ "devOptional": true
},
"node_modules/@prisma/internals": {
"version": "4.16.2",
@@ -4939,6 +5017,11 @@
"@types/node": "*"
}
},
+ "node_modules/@types/cookie": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="
+ },
"node_modules/@types/cross-spawn": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@types/cross-spawn/-/cross-spawn-6.0.2.tgz",
@@ -10045,6 +10128,14 @@
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
"integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw=="
},
+ "node_modules/nodemailer": {
+ "version": "6.9.13",
+ "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.13.tgz",
+ "integrity": "sha512-7o38Yogx6krdoBf3jCAqnIN4oSQFx+fMa0I7dK1D+me9kBxx12D+/33wSb+fhOCtIxvYJ+4x4IMEhmhCKfAiOA==",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
"node_modules/nopt": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
@@ -10205,6 +10296,14 @@
"resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",
"integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA=="
},
+ "node_modules/oauth4webapi": {
+ "version": "2.10.4",
+ "resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-2.10.4.tgz",
+ "integrity": "sha512-DSoj8QoChzOCQlJkRmYxAJCIpnXFW32R0Uq7avyghIeB6iJq0XAblOD7pcq3mx4WEBDwMuKr0Y1qveCBleG2Xw==",
+ "funding": {
+ "url": "https://github.com/sponsors/panva"
+ }
+ },
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -11042,13 +11141,13 @@
"integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="
},
"node_modules/prisma": {
- "version": "5.9.1",
- "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.9.1.tgz",
- "integrity": "sha512-Hy/8KJZz0ELtkw4FnG9MS9rNWlXcJhf98Z2QMqi0QiVMoS8PzsBkpla0/Y5hTlob8F3HeECYphBjqmBxrluUrQ==",
- "dev": true,
+ "version": "5.14.0",
+ "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.14.0.tgz",
+ "integrity": "sha512-gCNZco7y5XtjrnQYeDJTiVZmT/ncqCr5RY1/Cf8X2wgLRmyh9ayPAGBNziI4qEE4S6SxCH5omQLVo9lmURaJ/Q==",
+ "devOptional": true,
"hasInstallScript": true,
"dependencies": {
- "@prisma/engines": "5.9.1"
+ "@prisma/engines": "5.14.0"
},
"bin": {
"prisma": "build/index.js"
diff --git a/src/components/parking/ParkingEditOpening.tsx b/src/components/parking/ParkingEditOpening.tsx
index f12e343..1a29971 100644
--- a/src/components/parking/ParkingEditOpening.tsx
+++ b/src/components/parking/ParkingEditOpening.tsx
@@ -245,9 +245,9 @@ const ParkingEditOpening = ({ parkingdata, openingChanged }: { parkingdata: any,
-
+ {/*
Het veranderen van de openingstijden (specifiek uren) werkt tijdelijk niet. We werken hieraan; kom binnenkort terug als je de uren wilt aanpassen.
-
+
*/}
{formatOpeningTimesForEdit(data, "ma", "Maandag", handleChange, handleChangeChecks)}
diff --git a/src/components/parking/ParkingViewAbonnementen.tsx b/src/components/parking/ParkingViewAbonnementen.tsx
index 0243456..f035aac 100644
--- a/src/components/parking/ParkingViewAbonnementen.tsx
+++ b/src/components/parking/ParkingViewAbonnementen.tsx
@@ -16,10 +16,9 @@ const ParkingViewAbonnementen = ({ parkingdata }: { parkingdata: ParkingDetailsT
(state: any) => state.map.activeMunicipalityInfo
);
- // Don't render HTML if no subscriptions are available
- if (!parkingdata.abonnementsvorm_fietsenstalling || parkingdata.abonnementsvorm_fietsenstalling.length <= 0) {
- return <>>
- }
+ // console.log('activeMunicipalityInfo', activeMunicipalityInfo);
+ // parkingdata.abonnementsvorm_fietsenstalling.map(x => console.log('abonnement', x));
+ // console.log("abonnementsvormen", JSON.stringify(parkingdata.abonnementsvorm_fietsenstalling, null, 2));
return (
<>
@@ -32,15 +31,20 @@ const ParkingViewAbonnementen = ({ parkingdata }: { parkingdata: ParkingDetailsT
€{x.abonnementsvormen.prijs?.toLocaleString('nl-NL') || "---"}
}) : <>>}
-
-
-
+ {((parkingdata.abonnementsvorm_fietsenstalling && parkingdata.abonnementsvorm_fietsenstalling.length > 0)) ?
+
+
+
+ :
+
+ Geen abonnementen beschikbaar
+
}
-
+
>
diff --git a/src/components/parking/ParkingViewCapaciteit.tsx b/src/components/parking/ParkingViewCapaciteit.tsx
index 831426a..9471209 100644
--- a/src/components/parking/ParkingViewCapaciteit.tsx
+++ b/src/components/parking/ParkingViewCapaciteit.tsx
@@ -73,8 +73,8 @@ const ParkingViewCapaciteit = ({ parkingdata }: { parkingdata: ParkingDetailsTyp
if (capacitydata.detailed === null || Object.keys(capacitydata.detailed).length === 0) {
content = (
<>
- {parkingdata.Capacity}
-
+ {parkingdata.Capacity}
+
>
);
}
@@ -86,14 +86,14 @@ const ParkingViewCapaciteit = ({ parkingdata }: { parkingdata: ParkingDetailsTyp
} else if (detail.Toegestaan === false) {
return (
<>
- {key}
+ {key}
Niet toegestaan
>
);
} else if ((detail.Capaciteit || 0) > 0) {
return (
<>
- {key}
+ {key}
{detail.Capaciteit}
>
);
diff --git a/src/pages/content.tsx b/src/pages/content.tsx
index c2d9c5d..301c612 100644
--- a/src/pages/content.tsx
+++ b/src/pages/content.tsx
@@ -1,4 +1,6 @@
import React, { useRef, useState, useEffect } from "react";
+import { NextPage } from "next/types";
+import { GetServerSidePropsContext } from 'next';
import { useRouter } from 'next/navigation'
import { useSelector, useDispatch } from "react-redux";
import useQueryParam from '../hooks/useQueryParam';
@@ -7,6 +9,8 @@ import { authOptions } from '~/pages/api/auth/[...nextauth]'
import { signIn } from "next-auth/react";
import Head from "next/head";
import { usePathname } from 'next/navigation';
+import type { fietsenstallingen } from "@prisma/client";
+import { AppState } from "~/store/store";
// Import components
import PageTitle from "~/components/PageTitle";
@@ -32,12 +36,13 @@ import { getParkingsFromDatabase } from "~/utils/prisma";
import {
setActiveMunicipalityInfo,
} from "~/store/mapSlice";
+import { ParkingDetailsType } from "~/types";
-export async function getServerSideProps(context) {
+export async function getServerSideProps(context: GetServerSidePropsContext) {
try {
const session = await getServerSession(context.req, context.res, authOptions)
const sites = session?.user?.sites || [];
- const fietsenstallingen = await getParkingsFromDatabase(sites);
+ const fietsenstallingen = await getParkingsFromDatabase(sites, session);
return {
props: {
@@ -54,17 +59,28 @@ export async function getServerSideProps(context) {
}
}
-const Content: NextPage = ({ fietsenstallingen }) => {
+const Content: NextPage = ({ fietsenstallingen }: any) => {
const dispatch = useDispatch();
const { push } = useRouter();
const pathName = usePathname();
const [currentStallingId, setCurrentStallingId] = useState(undefined);
- const [pageContent, setPageContent] = useState({});
+ const [currentStalling, setCurrentStalling] = useState(undefined);
+ const [pageContent, setPageContent] = useState | undefined>(undefined); // TODO: type -> generic JSON object, make more specific later
+
+ useEffect(() => {
+ if (currentStallingId === undefined) {
+ setCurrentStalling(undefined);
+ }
+
+ const currentStalling = fietsenstallingen.find((stalling: any) => {
+ return stalling.ID === currentStallingId;
+ });
+
+ setCurrentStalling(currentStalling);
+
+ }, [currentStallingId]);
- const currentStalling = fietsenstallingen.find((stalling: any) => {
- return stalling.ID === currentStallingId;
- });
const activeMunicipalityInfo = useSelector(
(state: AppState) => state.map.activeMunicipalityInfo
@@ -196,7 +212,7 @@ const Content: NextPage = ({ fietsenstallingen }) => {
}}
>
{parkingTypesToFilterOn && {
+ customFilter={(x: ParkingDetailsType) => {
return parkingTypesToFilterOn.indexOf(x.Type) > -1
&& (
// Check if parking municipality == active municipality
@@ -214,14 +230,14 @@ const Content: NextPage = ({ fietsenstallingen }) => {
- {currentStallingId && isSm && (<>
+ {currentStalling?.ID !== undefined && isSm && (<>
setCurrentStallingId(undefined)}
>
- setCurrentStallingId(undefined)}
/>
>)}
@@ -232,10 +248,13 @@ const Content: NextPage = ({ fietsenstallingen }) => {
clickOutsideClosesDialog={false}
>
{
+ id={'parking-' + currentStallingId}
+ stallingId={fietsenstallingen.find((stalling: any) => {
return stalling.ID === currentStallingId;
}).ID}
+ onStallingIdChanged={setCurrentStallingId}
+ onClose={() => setCurrentStallingId(undefined)}
+
/>
>)}
diff --git a/src/pages/login.tsx b/src/pages/login.tsx
index acc0da4..b5f1e78 100644
--- a/src/pages/login.tsx
+++ b/src/pages/login.tsx
@@ -16,50 +16,50 @@ import Styles from "./login.module.css";
import { NextPage } from "next/types";
const Login: NextPage = () => {
- const emailRef = useRef(null);
- const passwordRef = useRef(null);
-
- const router = useRouter()
- const error = useQueryParam("error")[0];
-
- const onSignIn = async (e: any) => {
- e.preventDefault();
-
- if (
- emailRef.current && emailRef.current.value !== '' &&
- passwordRef.current && passwordRef.current.value !== ''
- ) {
- // console.log('signing in with magic link')
- // signIn("email", {
- // email: emailRef.current.value.trim(),
- // // password: passwordRef.current.value,
- // // callbackUrl: "/",
- // });
- signIn("credentials", {
- email: emailRef.current.value.trim(),
- password: passwordRef.current.value,
- callbackUrl: "/",
- });
- } else {
- alert('no email of password given');
- }
- };
-
- const allowLogin = emailRef.current?.value !== '' && passwordRef.current?.value !== '';
-
- return (
- <>
-
-
- Login - VeiligStallen
-
-
-
-
-
-
-
-
(null);
+ const passwordRef = useRef
(null);
+
+ const router = useRouter()
+ const error = useQueryParam("error")[0];
+
+ const onSignIn = async (e: any) => {
+ e.preventDefault();
+
+ if (
+ emailRef.current && emailRef.current.value !== '' &&
+ passwordRef.current && passwordRef.current.value !== ''
+ ) {
+ // console.log('signing in with magic link')
+ // signIn("email", {
+ // email: emailRef.current.value.trim(),
+ // // password: passwordRef.current.value,
+ // // callbackUrl: "/",
+ // });
+ signIn("credentials", {
+ email: emailRef.current.value.trim(),
+ password: passwordRef.current.value,
+ callbackUrl: "/",
+ });
+ } else {
+ alert('no email of password given');
+ }
+ };
+
+ const allowLogin = emailRef.current?.value !== '' && passwordRef.current?.value !== '';
+
+ return (
+ <>
+
+
+ Login - VeiligStallen
+
+
+
+
+
+
+
+
{
flex
flex-wrap
`}
- style={{
- width: '1000px',
- maxWidth: '90%'
- }}>
-
-
-
-
+
+
-
- >
- );
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
};
export default Login;