diff --git a/app/verify/page.tsx b/app/verify/page.tsx new file mode 100644 index 0000000..eaaae14 --- /dev/null +++ b/app/verify/page.tsx @@ -0,0 +1,26 @@ +"use client" +import {useEffect} from "react"; +import {RegistrationRest} from "../../src/rest/RegistrationRest"; +import {Box, CircularProgress, Typography} from "@mui/material"; +import {useRouter} from "next/navigation"; + +export default function Page() { + + const router = useRouter() + + useEffect(() => { + if (typeof window !== 'undefined') { + const queryParameters = new URLSearchParams(window?.location?.search) + const type = queryParameters.get("token") + const registrationRest = new RegistrationRest() + registrationRest.verifyToken(type).then(() => router.push("/?isVerified=true")) + } + + }, []); + return + + + Verifying your Token + + +} \ No newline at end of file diff --git a/src/components/Registration/Registration.jsx b/src/components/Registration/Registration.jsx index 9b9bd81..43e3be5 100644 --- a/src/components/Registration/Registration.jsx +++ b/src/components/Registration/Registration.jsx @@ -25,7 +25,7 @@ import {useMemo, useState} from 'react'; import HackHPIWrapper from "../Theme/HackHPIWrapper.jsx"; import {LoadingButton} from "@mui/lab"; import {RegistrationRest} from "../../rest/RegistrationRest.js"; -import {Send} from "@mui/icons-material"; +import {Mail, Send} from "@mui/icons-material"; // types: 0 = empty, 1 = textfield, 2 = date, 3 = select, 4 = radio @@ -243,6 +243,25 @@ const steps = [ label: 'Team members', content: teamMembers, }, + { + label: 'E-Mail Verification', + children: ( + + + + To complete the Registration, please click on the link in the Mail we sent + you! + + + ), + }, ]; @@ -253,39 +272,29 @@ function Registration() { const registrationRest = useMemo(() => new RegistrationRest(), []) function handleChange(name, inputValue) { - console.log("incoming", name, values) const newValue = {...values} newValue[name] = inputValue; - console.log(newValue) setValues(newValue); } function enableNext(inputList, name) { - console.log("#######", name, "#########") if (!inputList) { return; } const result = inputList.content.reduce((previous, current) => { - console.log("--------", current.name, "----------", values[current.name]) - if (!current.required && (values[current.name] === undefined || values[current.name] === "")){ - console.log("Skipping evaluation - not required and empty") + if (!current.required && (values[current.name] === undefined || values[current.name] === "")) { return true } - if (current.required && ((!values[current.name] && values[current.name] !== 0 ) || values[current.name] === "")){ - console.log("Declining - required not filled") + if (current.required && ((!values[current.name] && values[current.name] !== 0) || values[current.name] === "")) { return false } const meetsMax = current.max ? values[current.name]?.length <= current.max : true; - console.log("max", meetsMax) const meetsMin = current.min ? values[current.name]?.length >= current.min : true; - console.log("min", meetsMin) const meetsAll = meetsMax && meetsMin - console.log(current.name, meetsAll, previous) - return previous && meetsMax && meetsMin + return previous && meetsAll }, true) - console.log("results for ", name, result) return result } @@ -370,6 +379,32 @@ function Registration() { } + function renderNextButton(index, step) { + if (index === steps.length - 1) { + return + } + if (index === steps.length - 2) { + return ( + } + loading={isSending} + onClick={submitForm}> + Send + + ) + } + + return ( + + ) + + } + return ( @@ -386,8 +421,7 @@ function Registration() { ) : null } > - + {step.label} @@ -396,7 +430,7 @@ function Registration() { - {step.content.map((item, i) => ( + {step.children ? step.children : step.content.map((item, i) => ( @@ -414,27 +448,13 @@ function Registration() { ))} - {index === steps.length - 1 ? - } - loading={isSending} - onClick={submitForm}> - Send - - : - - } - + {renderNextButton(index, step)} + {index === steps.length - 1 ? undefined : - + }