Redirect new users to onboarding page

This commit is contained in:
MartinBraquet
2025-08-08 01:19:36 +02:00
parent 4a2dba6e2e
commit fd9c61a1c7
7 changed files with 682 additions and 534 deletions

View File

@@ -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 <div className="bg-red-50 border-l-4 border-red-400 p-4">
<div className="flex">
<div className="flex-shrink-0">
<svg className="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
fill="currentColor">
<path fillRule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
clipRule="evenodd"/>
</svg>
</div>
<div className="ml-3">
<p className="text-sm text-red-700">{error}</p>
</div>
</div>
</div>
}
return (
<div className="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
<div className="max-w-3xl w-full space-y-8">
@@ -633,7 +616,7 @@ function RegisterComponent() {
</h2>
</div>
{error && errorBlock()}
{error && errorBlock(error)}
<div className="flex justify-center mb-6">
<div className="relative">
@@ -963,7 +946,7 @@ function RegisterComponent() {
)}
</div>
{error && errorBlock()}
{error && errorBlock(error)}
<div>
<button

View File

@@ -16,6 +16,8 @@ export default function RegisterPage() {
);
}
const href = '/onboarding';
function RegisterComponent() {
const searchParams = useSearchParams();
const [error, setError] = useState<string | null>(searchParams.get('error'));
@@ -25,13 +27,13 @@ function RegisterComponent() {
function redirect() {
// Redirect to complete profile page
window.location.href = '/complete-profile';
window.location.href = href;
}
const handleGoogleSignUp = async () => {
try {
setIsLoading(true);
await signIn('google', {callbackUrl: '/complete-profile'});
await signIn('google', {callbackUrl: href});
} catch (error) {
console.error('Error signing up with Google:', error);
setError('Failed to sign up with Google');

View File

File diff suppressed because it is too large Load Diff

20
lib/client/errors.tsx Normal file
View File

@@ -0,0 +1,20 @@
import React from "react";
export function errorBlock(error: string = '') {
return <div className="bg-red-50 border-l-4 border-red-400 p-4">
<div className="flex">
<div className="flex-shrink-0">
<svg className="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
fill="currentColor">
<path fillRule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
clipRule="evenodd"/>
</svg>
</div>
<div className="ml-3">
<p className="text-sm text-red-700">{error}</p>
</div>
</div>
</div>
}

View File

@@ -55,8 +55,8 @@ model Profile {
}
enum Gender {
Male
Female
Man
Woman
Other
}

View File

@@ -108,8 +108,7 @@ async function main() {
data: [
{name: 'Debate Partner'},
{name: 'Friendship'},
{name: 'Short-Term Relationship'},
{name: 'Long-Term Relationship'},
{name: 'Relationship'},
],
skipDuplicates: true,
});
@@ -135,7 +134,7 @@ async function main() {
birthYear: 2025 - profile.age,
introversion: profile.introversion,
description: `[Dummy profile for demo purposes]\n${profile.bio}`,
gender: i % 2 === 0 ? 'Male' : 'Female',
gender: i % 2 === 0 ? 'Man' : 'Woman',
personalityType: i % 3 === 0 ? 'Extrovert' : 'Introvert',
conflictStyle: 'Avoidant',
contactInfo: `Email: user${i}@bayesbond.com\nPhone: +1 (123) 456-7890`,