-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] new success and verification pages with full functionality EXC… #37
Changes from 3 commits
20b9847
fd937c0
4549cc0
fb08725
682949c
8a8e48e
68cd5ee
9f5e3a7
2cf3d3a
69852fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use client'; | ||
|
||
import { useRouter } from 'next/navigation'; | ||
import Rose from '@/public/images/rose-greenbg.svg'; | ||
import { | ||
Background, | ||
Image, | ||
InlineContainer, | ||
ReviewContainer, | ||
RoundedCornerButton, | ||
Title, | ||
} from '../../../styles/styles'; | ||
|
||
export default function Success() { | ||
const router = useRouter(); // Initialize useRouter | ||
|
||
const handleContinue = () => { | ||
router.push('/onboarding/role-selection'); // Navigate to the onboarding/general page | ||
}; | ||
|
||
return ( | ||
<Background> | ||
<Image src={Rose} alt="Rose" /> | ||
<InlineContainer> | ||
<ReviewContainer> | ||
<Title>Successfully verified!</Title> | ||
<text> | ||
Your email has been verified. Please use this email address to login | ||
in the future. | ||
</text> | ||
<RoundedCornerButton onClick={handleContinue}> | ||
Continue | ||
</RoundedCornerButton> | ||
</ReviewContainer> | ||
</InlineContainer> | ||
</Background> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
'use client'; | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import { | ||
getTempEmail, | ||
resendVerificationEmail, | ||
} from '@/api/supabase/queries/auth'; | ||
import Bud from '@/public/images/bud.svg'; | ||
import EmailIcon from '@/public/images/email.svg'; | ||
// import supabase from '@/api/supabase/createClient'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete the commented line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in latest commit! |
||
import { useSession } from '@/utils/AuthProvider'; | ||
import { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed in latest commit! |
||
Background, | ||
EmailContainer, | ||
EmailIconStyled, | ||
EmailText, | ||
Footer, | ||
Image, | ||
InlineContainer, | ||
Link, | ||
ResendMessage, | ||
ReviewContainer, | ||
RoundedCornerButton, | ||
Title, | ||
} from '../../../styles/styles'; | ||
|
||
export default function Verification() { | ||
const router = useRouter(); // Initialize useRouter | ||
const [tempEmail, setTempEmail] = useState<string | null>(null); | ||
const [resendStatus, setResendStatus] = useState<string>(''); | ||
const [isError, setIsError] = useState<boolean>(false); | ||
const { session } = useSession(); | ||
|
||
useEffect(() => { | ||
if (session) { | ||
router.push('/success'); | ||
} | ||
}, [session, router]); | ||
|
||
useEffect(() => { | ||
const email = getTempEmail(); | ||
setTempEmail(email); | ||
}, []); | ||
|
||
const handleResendLink = async () => { | ||
if (tempEmail) { | ||
const message = await resendVerificationEmail(tempEmail); | ||
setIsError(message.includes('Error')); | ||
setResendStatus(message); | ||
} else { | ||
setIsError(true); | ||
} | ||
}; | ||
|
||
const handleUseAnotherAccount = () => { | ||
router.push('/signin'); | ||
localStorage.removeItem('tempEmail'); | ||
}; | ||
|
||
// TODO: Restyle error message on lines 95-100 (the message containing link back to sign-up) | ||
|
||
return ( | ||
<Background> | ||
<Image src={Bud} alt="Bud" /> | ||
<InlineContainer> | ||
<ReviewContainer> | ||
<Title>Verification Needed</Title> | ||
<text>Thanks for signing up!</text> | ||
<text> | ||
A verification link has been sent to the email you specified, please | ||
check your inbox for next steps. | ||
</text> | ||
|
||
<EmailContainer> | ||
<EmailIconStyled src={EmailIcon} alt="Email Icon" /> | ||
<EmailText> | ||
{tempEmail ? tempEmail : 'Email address not found'} | ||
</EmailText> | ||
</EmailContainer> | ||
|
||
<RoundedCornerButton | ||
onClick={handleUseAnotherAccount} | ||
width="70%" | ||
bgColor="white" | ||
textColor="black" | ||
> | ||
Use another account | ||
</RoundedCornerButton> | ||
|
||
<Footer> | ||
Didn't receive it?{' '} | ||
<Link href="#" onClick={handleResendLink}> | ||
Resend link | ||
</Link> | ||
</Footer> | ||
|
||
{isError && !tempEmail && ( | ||
<ResendMessage $isError={isError}> | ||
Email address not found!{' '} | ||
<Link href="#" onClick={() => router.push('/signup')}> | ||
Return to the sign-up page | ||
</Link>{' '} | ||
to restart the sign-up process. | ||
</ResendMessage> | ||
)} | ||
|
||
{resendStatus && tempEmail && ( | ||
<ResendMessage $isError={isError}>{resendStatus}</ResendMessage> | ||
)} | ||
</ReviewContainer> | ||
</InlineContainer> | ||
</Background> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using
<text>
tags, import this line on the top of the fileimport { P } from '@/styles/text;
and then use the<P>
tag. you can adjust the font weight by passing in weight as a prop:<P $fontWeight={300}>
. also, since styling such asEmailContainer
,EmailText
etc. are not being used in any other files, create a separatestyles.ts
file underverification
sincestyles/styles.ts
file is only for GLOBALLY used styled components.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in latest commit!