Skip to content

Commit

Permalink
Added required opt in choice for MLH
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmonisit committed Oct 25, 2024
1 parent 4264591 commit 5b618ba
Showing 1 changed file with 50 additions and 44 deletions.
94 changes: 50 additions & 44 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,8 @@ export default function Dashboard() {
: 0,
});

if (data.error != ''){
alert(data.error.message)

if (data.error != '') {
alert(data.error.message);
}

setUserData(data.response);
Expand Down Expand Up @@ -440,6 +439,46 @@ export default function Dashboard() {
} else if (userData?.role['director']) {
return <DirectorView userData={userData} />;
} else if (userData?.role.hacker) {
if (userData?.opt_in == null) {
return (
<div className="flex flex-col items-center justify-center space-y-8 p-4">
<Card className="mt-32 w-full max-w-2xl">
<CardHeader>
<CardTitle>
Would you like to opt-in to Major League Hacking emails? You
must choose before you can proceed.
</CardTitle>
<CardDescription>
<Button
onClick={async () => {
const resp = await OptInSelf(true);
if (resp == 'GOOD') {
setUserData({ ...userData, opt_in: true });
}
}}
type="button"
className="mt-10"
>
OPT IN
</Button>
<Button
onClick={async () => {
const resp = await OptInSelf(false);
if (resp == 'GOOD') {
setUserData({ ...userData, opt_in: false });
}
}}
type="button"
className="mx-10"
>
OPT OUT
</Button>
</CardDescription>
</CardHeader>
</Card>
</div>
);
}
return (
<main>
<Navbar />
Expand Down Expand Up @@ -471,39 +510,6 @@ export default function Dashboard() {
</CardHeader>
</Card>
)}
{userData?.opt_in == null && (
<Card className="w-full max-w-2xl">
<CardHeader>
<CardTitle>Would you like to opt-in to Major League Hacking emails</CardTitle>
<CardDescription>
<Button
onClick={async () => {
const resp = await OptInSelf(true)
if (resp == "GOOD"){
setUserData({ ...userData, opt_in: true })
}
}}
type="button"
className="mt-10"
>
OPT IN
</Button>
<Button
onClick={async () => {
const resp = await OptInSelf(false)
if (resp == "GOOD"){
setUserData({ ...userData, opt_in: false })
}
}}
type="button"
className="mx-10"
>
OPT OUT
</Button>
</CardDescription>
</CardHeader>
</Card>
)}
{userData?.registration_status === 'checked_in' && false && (
<Card className="w-full max-w-2xl">
<CardHeader>
Expand Down Expand Up @@ -692,23 +698,23 @@ export default function Dashboard() {
<Card className="w-full max-w-2xl">
<CardHeader>
<CardTitle>Links</CardTitle>
<CardDescription>
Links to various things
</CardDescription>
<CardDescription>Links to various things</CardDescription>
</CardHeader>
<CardContent>

<div className="m-4">
<Button >
<Button>
<a href="/games">Go to Tetris</a>
</Button>
<Button className='mx-2'>
<a href="https://rsvp.withgoogle.com/events/coe-general-form_577b9e/sessions/rutgers-ru-hack">Google Interest Form </a>
<Button className="mx-2">
<a href="https://rsvp.withgoogle.com/events/coe-general-form_577b9e/sessions/rutgers-ru-hack">
Google Interest Form{' '}
</a>
</Button>
</div>
</CardContent>
</Card>
)}
(
<Card className="w-full max-w-2xl">
<CardHeader>
<div className="flex flex-col ">
Expand All @@ -726,7 +732,7 @@ export default function Dashboard() {
</div>
</CardContent>
</Card>

)
<Card className="w-full max-w-2xl">
<CardHeader>
<div className="flex flex-col ">
Expand Down

0 comments on commit 5b618ba

Please sign in to comment.