mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-04 14:59:24 -05:00
Redirect new users to onboarding page
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
20
lib/client/errors.tsx
Normal file
20
lib/client/errors.tsx
Normal 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>
|
||||
}
|
||||
@@ -55,8 +55,8 @@ model Profile {
|
||||
}
|
||||
|
||||
enum Gender {
|
||||
Male
|
||||
Female
|
||||
Man
|
||||
Woman
|
||||
Other
|
||||
}
|
||||
|
||||
|
||||
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user