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

Production 2024-02-20_00 #90

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/app/(account)/forgot-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ export default function ForgotPasswordPage() {
resolver: zodResolver(resetPasswordSchema),
});

const [sendCodeLoading, setSendCodeLoading] = useState(false);
const [resetPasswordLoading, setResetPasswordLoading] = useState(false);

const handleSendCode = sendCodeForm.handleSubmit(async ({ email }) => {
if (!isLoaded) return;

setSendCodeLoading(true);

try {
const result = await signIn.create({
strategy: 'reset_password_email_code',
Expand All @@ -70,10 +76,15 @@ export default function ForgotPasswordPage() {
},
]);
}

setSendCodeLoading(false);
});

const handleResetPassword = resetPasswordForm.handleSubmit(async ({ code, password }) => {
if (!isLoaded) return;

setResetPasswordLoading(true);

try {
const resetResult = await signIn.attemptFirstFactor({
strategy: 'reset_password_email_code',
Expand Down Expand Up @@ -105,6 +116,8 @@ export default function ForgotPasswordPage() {
},
]);
}

setResetPasswordLoading(false);
});

return (
Expand All @@ -120,7 +133,12 @@ export default function ForgotPasswordPage() {
control={sendCodeForm.control}
name="email"
/>
<Button colour="orange" width="w-[19rem] md:w-[25rem]" type="submit">
<Button
colour="orange"
width="w-[19rem] md:w-[25rem]"
type="submit"
loading={sendCodeLoading}
>
Send Code
</Button>
</form>
Expand All @@ -145,7 +163,12 @@ export default function ForgotPasswordPage() {
control={resetPasswordForm.control}
name="code"
/>
<Button colour="orange" width="w-[19rem] md:w-[25rem]" type="submit">
<Button
colour="orange"
width="w-[19rem] md:w-[25rem]"
type="submit"
loading={resetPasswordLoading}
>
Reset Password
</Button>
</form>
Expand Down
28 changes: 26 additions & 2 deletions src/app/(account)/join/steps/StepOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ function VerifyEmail() {

const { isLoaded, signUp, setActive } = useSignUp();

const [verifyEmailLoading, setVerifyEmailLoading] = useState(false);

const handleVerify = form.handleSubmit(async ({ code }) => {
if (!isLoaded) return;

setVerifyEmailLoading(true);

try {
const completeSignUp = await signUp.attemptEmailAddressVerification({
code,
Expand All @@ -53,13 +58,20 @@ function VerifyEmail() {
},
]);
}

setVerifyEmailLoading(false);
});

return (
<div className="mt-4">
<form onSubmit={handleVerify}>
<ControlledField label="Code" control={form.control} name="code" />
<Button colour="orange" width="w-[19rem] md:w-[25.5rem]" type="submit">
<Button
colour="orange"
width="w-[19rem] md:w-[25.5rem]"
type="submit"
loading={verifyEmailLoading}
>
Verify Email
</Button>
</form>
Expand Down Expand Up @@ -88,8 +100,13 @@ export default function StepOne() {
const { signUp, isLoaded } = useSignUp();
const [pendingVerification, setPendingVerification] = useState(false);

const [emailJoinLoading, setEmailJoinLoading] = useState(false);

const handleSignUp = form.handleSubmit(async (formData) => {
if (!isLoaded) return;

setEmailJoinLoading(true);

try {
await signUp.create(formData);
await signUp.prepareEmailAddressVerification({ strategy: 'email_code' });
Expand All @@ -111,6 +128,8 @@ export default function StepOne() {
},
]);
}

setEmailJoinLoading(false);
});

const handleGoogleSignUp = async () => {
Expand Down Expand Up @@ -152,7 +171,12 @@ export default function StepOne() {
name="password"
/>
<div className="mt-8 flex justify-center space-x-4">
<Button colour="orange" width="w-[19rem] md:w-[25.5rem]" type="submit">
<Button
colour="orange"
width="w-[19rem] md:w-[25.5rem]"
type="submit"
loading={emailJoinLoading}
>
Continue
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(account)/join/steps/StepTwo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function StepTwo() {
<ControlledField label="First Name" control={form.control} name="firstName" />
<ControlledField label="Last Name" control={form.control} name="lastName" />
<ControlledField
label="Are you an university student?"
label="Are you a university student?"
control={form.control}
name="studentStatus"
options={STUDENT_STATUSES}
Expand Down
15 changes: 14 additions & 1 deletion src/app/(account)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FancyRectangle from '@/components/FancyRectangle';
import { useSignIn } from '@clerk/clerk-react';
import { zodResolver } from '@hookform/resolvers/zod';
import Link from 'next/link';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { FcGoogle } from 'react-icons/fc';
import { z } from 'zod';
Expand All @@ -25,8 +26,13 @@ export default function SignInPage() {
resolver: zodResolver(signInSchema),
});

const [signInLoading, setSignInLoading] = useState(false);

const handleSignIn = form.handleSubmit(async ({ email, password }) => {
if (!isLoaded) return;

setSignInLoading(true);

try {
const result = await signIn.create({
identifier: email,
Expand Down Expand Up @@ -59,6 +65,8 @@ export default function SignInPage() {
},
]);
}

setSignInLoading(false);
});

const handleGoogleSignIn = async () => {
Expand Down Expand Up @@ -110,7 +118,12 @@ export default function SignInPage() {
>
Forgot password?
</Link>
<Button type="submit" colour="orange" width="w-[19rem] md:w-[25rem]">
<Button
type="submit"
colour="orange"
width="w-[19rem] md:w-[25rem]"
loading={signInLoading}
>
Sign In
</Button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/app/sponsors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function SponsorsPage() {
<Duck colour="yellow" size={80} className="hidden md:block" />
</div>
<div className="max-w-3xl border-x-4 border-white p-2 text-center text-lg md:p-5 md:text-2xl">
The <b>University of Adelaide Computer Science Club</b> are proudly supported by our{' '}
The <b>University of Adelaide Computer Science Club</b> is proudly supported by our{' '}
<b>generous sponsors</b>. Their unwavering support make events and workshops
possible, fostering an environment for aspiring tech enthusiasts to excel within our
community.
Expand Down
Loading