From fd9c61a1c74bab93d7a833f4791bce76eebebe26 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 8 Aug 2025 01:19:36 +0200 Subject: [PATCH] Redirect new users to onboarding page --- app/complete-profile/page.tsx | 23 +- app/{register_test => onboarding}/page.tsx | 0 app/register/page.tsx | 6 +- components/MultiStepForm.tsx | 1158 +++++++++++--------- lib/client/errors.tsx | 20 + prisma/schema.prisma | 4 +- prisma/seed.ts | 5 +- 7 files changed, 682 insertions(+), 534 deletions(-) rename app/{register_test => onboarding}/page.tsx (100%) create mode 100644 lib/client/errors.tsx diff --git a/app/complete-profile/page.tsx b/app/complete-profile/page.tsx index 8dfe1650..bb0d1c8e 100644 --- a/app/complete-profile/page.tsx +++ b/app/complete-profile/page.tsx @@ -12,6 +12,7 @@ import PromptAnswer from '@/components/ui/PromptAnswer'; import imageCompression from 'browser-image-compression'; import {Item} from '@/lib/client/schema'; import {fetchFeatures} from "@/lib/client/fetching"; +import {errorBlock} from "@/lib/client/errors"; export default function CompleteProfile() { @@ -606,24 +607,6 @@ function RegisterComponent() { } - function errorBlock() { - return
-
-
- - - -
-
-

{error}

-
-
-
- } - return (
@@ -633,7 +616,7 @@ function RegisterComponent() {
- {error && errorBlock()} + {error && errorBlock(error)}
@@ -963,7 +946,7 @@ function RegisterComponent() { )}
- {error && errorBlock()} + {error && errorBlock(error)}
+ ))} +
+ ) : (currentQuestion.type === "multiselect" && currentQuestion.options && currentQuestion.options.length <= 6) ? ( +
+ {currentQuestion.options.map((opt) => { + const selected = (formValues[currentQuestion.name] || []).includes(opt); + return ( + + ); + })} +
+ ) : currentQuestion.type === "slider" ? ( +
+ {currentQuestion.range && ( + + {currentQuestion.range[0]} + )} -
- ); - }) - ) : currentQuestion.name === "birthday" ? ( -
- - - - {(() => { - const month = getValues("birthday_month"); - const day = getValues("birthday_day"); - const year = getValues("birthday_year"); - const age = getAge(month, day, year); - if (age && age > 0 && age < 120) { - return You are {age}!; - } - return null; - })()} -
- ) : (currentQuestion.type === "select" && currentQuestion.options && currentQuestion.options.length <= 6) ? ( -
- {currentQuestion.options.map((opt) => ( - - ))} -
- ) : (currentQuestion.type === "multiselect" && currentQuestion.options && currentQuestion.options.length <= 6) ? ( -
- {currentQuestion.options.map((opt) => { - const selected = (formValues[currentQuestion.name] || []).includes(opt); - return ( - - ); - })} -
- ) : currentQuestion.type === "select" ? ( - - ) : currentQuestion.type === "multiselect" ? ( - - // For a more advanced UI, consider using react-select's MultiSelect component - ) : currentQuestion.type === "textarea" ? ( -