Skip to content

Commit fd9c61a

Browse files
committed
Redirect new users to onboarding page
1 parent 4a2dba6 commit fd9c61a

File tree

7 files changed

+692
-544
lines changed

7 files changed

+692
-544
lines changed

app/complete-profile/page.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import PromptAnswer from '@/components/ui/PromptAnswer';
1212
import imageCompression from 'browser-image-compression';
1313
import {Item} from '@/lib/client/schema';
1414
import {fetchFeatures} from "@/lib/client/fetching";
15+
import {errorBlock} from "@/lib/client/errors";
1516

1617

1718
export default function CompleteProfile() {
@@ -606,24 +607,6 @@ function RegisterComponent() {
606607
</>
607608
}
608609

609-
function errorBlock() {
610-
return <div className="bg-red-50 border-l-4 border-red-400 p-4">
611-
<div className="flex">
612-
<div className="flex-shrink-0">
613-
<svg className="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
614-
fill="currentColor">
615-
<path fillRule="evenodd"
616-
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"
617-
clipRule="evenodd"/>
618-
</svg>
619-
</div>
620-
<div className="ml-3">
621-
<p className="text-sm text-red-700">{error}</p>
622-
</div>
623-
</div>
624-
</div>
625-
}
626-
627610
return (
628611
<div className="min-h-screen flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
629612
<div className="max-w-3xl w-full space-y-8">
@@ -633,7 +616,7 @@ function RegisterComponent() {
633616
</h2>
634617
</div>
635618

636-
{error && errorBlock()}
619+
{error && errorBlock(error)}
637620

638621
<div className="flex justify-center mb-6">
639622
<div className="relative">
@@ -963,7 +946,7 @@ function RegisterComponent() {
963946
)}
964947
</div>
965948

966-
{error && errorBlock()}
949+
{error && errorBlock(error)}
967950

968951
<div>
969952
<button

app/register/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export default function RegisterPage() {
1616
);
1717
}
1818

19+
const href = '/onboarding';
20+
1921
function RegisterComponent() {
2022
const searchParams = useSearchParams();
2123
const [error, setError] = useState<string | null>(searchParams.get('error'));
@@ -25,13 +27,13 @@ function RegisterComponent() {
2527

2628
function redirect() {
2729
// Redirect to complete profile page
28-
window.location.href = '/complete-profile';
30+
window.location.href = href;
2931
}
3032

3133
const handleGoogleSignUp = async () => {
3234
try {
3335
setIsLoading(true);
34-
await signIn('google', {callbackUrl: '/complete-profile'});
36+
await signIn('google', {callbackUrl: href});
3537
} catch (error) {
3638
console.error('Error signing up with Google:', error);
3739
setError('Failed to sign up with Google');

0 commit comments

Comments
 (0)