Skip to content
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: Configured extra check for waitlisted users already in the list and created toast message for them #492

23 changes: 22 additions & 1 deletion apps/web/src/components/hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ function Hero(): React.JSX.Element {
return
}

const dataInStorage: string | null = localStorage.getItem('waitlistData')
const emailsInWaitlist: string[] = dataInStorage ? (JSON.parse(dataInStorage) as string[]) : []

// actual logic where we are checking if this email is already in waitlisted users or not
if (emailsInWaitlist.includes(email)) {
toast.custom(() => (
<div className="text-brandBlue border-brandBlue/20 w-[90vw] rounded-lg border bg-[#852b2c] p-2 shadow-2xl backdrop-blur-3xl md:w-[20vw]">
kriptonian1 marked this conversation as resolved.
Show resolved Hide resolved
<p className="text-sm">
You have been already added to the waitlist. We will notify you once
we launch.
</p>
</div>
))
return
}

const url =
'https://xyz.us18.list-manage.com/subscribe/post?u=2e44b940cafe6e54d8b9e0790&amp;id=bd382dd7c5&amp;f_id=00e5c2e1f0'

Expand All @@ -44,8 +60,13 @@ function Hero(): React.JSX.Element {
launch
</p>
</div>
))

))

emailsInWaitlist.push(email)
localStorage.setItem('waitlistData', JSON.stringify(emailsInWaitlist))
setEmail('')

} catch (error) {
// eslint-disable-next-line no-console -- chill
console.error(error)
Expand Down
Loading