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_01 #93

Merged
merged 9 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"redis": "^4.6.13",
"square": "^34.0.1",
"swr": "^2.2.5",
"usehooks-ts": "^2.14.0",
"zod": "^3.22.4",
"zustand": "^4.4.7"
},
Expand Down
17 changes: 17 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/app/(account)/forgot-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { z } from 'zod';
import { handleClerkErrors } from '../helpers';
import { codeSchema, emailSchema, passwordSchema } from '../schemas';

// export const metadata: Metadata = {
// title: 'Forgot Password',
// robots: { index: false, follow: false },
// };

const sendCodeSchema = z.object({
email: emailSchema,
});
Expand Down
6 changes: 5 additions & 1 deletion src/app/(account)/join/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import StepThree from './steps/StepThree';
import StepTwo from './steps/StepTwo';
import { useJoinUsHeading, useJoinUsStep } from './store';

export default function JoinUsPage() {
// export const metadata: Metadata = {
// title: 'Join',
// };

export default function JoinPage() {
const { step, setStep } = useJoinUsStep();
const { heading } = useJoinUsHeading();

Expand Down
1 change: 1 addition & 0 deletions src/app/(account)/join/steps/StepFour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function StepFour() {
},
onSuccess: () => {
router.push('/settings');
router.refresh();
},
});

Expand Down
3 changes: 3 additions & 0 deletions src/app/(account)/join/steps/StepOne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ControlledField from '@/components/ControlledField';
import { useSignUp } from '@clerk/nextjs';
import { zodResolver } from '@hookform/resolvers/zod';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { FcGoogle } from 'react-icons/fc';
Expand Down Expand Up @@ -33,6 +34,7 @@ function VerifyEmail() {

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

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

Expand All @@ -48,6 +50,7 @@ function VerifyEmail() {
return;
}
await setActive({ session: completeSignUp.createdSessionId });
router.refresh();
} catch (error) {
handleClerkErrors(error, form, [
{ code: 'form_param_nil', field: 'code', message: 'Please enter the the code.' },
Expand Down
6 changes: 6 additions & 0 deletions src/app/(account)/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import Title from '@/components/Title';
import { checkUserExists } from '@/server/check-user-exists';
import { verifyMembershipPayment } from '@/server/verify-membership-payment';
import { currentUser } from '@clerk/nextjs';
import type { Metadata } from 'next';
import Link from 'next/link';
import { notFound } from 'next/navigation';
import Settings from './Settings';

export const metadata: Metadata = {
title: 'Settings',
robots: { index: false, follow: false },
};

export default async function SettingsPage() {
const user = await currentUser();
if (!user) return notFound();
Expand Down
7 changes: 6 additions & 1 deletion src/app/(account)/settings/tabs/MembershipSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ export default function MembershipSettings({
</p>
<h2 className="mt-8 text-2xl font-bold">Pay Membership Fee</h2>
<div className="mb-6 border-b-2 border-black"></div>
<Button type="submit" colour="orange" onClick={handlePayment}>
<Button
type="submit"
colour="orange"
onClick={handlePayment}
loading={pay.isMutating}
>
Pay Online
</Button>
</>
Expand Down
9 changes: 8 additions & 1 deletion src/app/(account)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ import FancyRectangle from '@/components/FancyRectangle';
import { useSignIn } from '@clerk/clerk-react';
import { zodResolver } from '@hookform/resolvers/zod';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { FcGoogle } from 'react-icons/fc';
import { z } from 'zod';
import { handleClerkErrors } from '../helpers';
import { emailSchema } from '../schemas';

// export const metadata: Metadata = {
// title: 'Sign In',
// };

const signInSchema = z.object({
email: emailSchema,
password: z.string().min(1, { message: 'Please enter your password' }),
Expand All @@ -28,6 +33,7 @@ export default function SignInPage() {

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

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

Expand All @@ -41,7 +47,8 @@ export default function SignInPage() {

if (result.status === 'complete') {
await setActive({ session: result.createdSessionId });
location.href = '/';
router.push('/');
router.refresh();
} else {
console.log(result);
}
Expand Down
7 changes: 6 additions & 1 deletion src/app/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import Paragraph from '@/components/Paragraph';
import Title from '@/components/Title';
import { COMMITTEE_MEMBERS } from '@/data/committee-members';
import { LINKS } from '@/data/links';
import type { Metadata } from 'next';
import Image from 'next/image';
import FAQ from './FAQ';

export default function AboutUs() {
export const metadata: Metadata = {
title: 'About',
};

export default function AboutPage() {
return (
<main className="relative">
<div className="h-full">
Expand Down
6 changes: 6 additions & 0 deletions src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import FancyRectangle from '@/components/FancyRectangle';
import Title from '@/components/Title';
import { db } from '@/db';
import { currentUser } from '@clerk/nextjs';
import type { Metadata } from 'next';
import { notFound } from 'next/navigation';
import MemberForm from './MemberForm';

export const metadata: Metadata = {
title: 'Admin Panel',
robots: { index: false, follow: false },
};

const queryMembers = async () => {
const dbMembers = await db.query.memberTable.findMany({
columns: {
Expand Down
12 changes: 0 additions & 12 deletions src/app/api/payment/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { env } from '@/env.mjs';
import { redisClient } from '@/lib/redis';
import { squareClient } from '@/lib/square';
import { updateMemberExpiryDate } from '@/server/update-member-expiry-date';
import { verifyMembershipPayment } from '@/server/verify-membership-payment';
import { currentUser } from '@clerk/nextjs';
import { eq } from 'drizzle-orm';
import type { CreatePaymentLinkRequest } from 'square';
Expand Down Expand Up @@ -115,14 +114,3 @@ export async function PUT(request: Request) {
}
return Response.json({ success: true });
}

// Get membership payment status
export async function GET() {
const user = await currentUser();
if (!user) {
return new Response(null, { status: 401 });
}

const { paid } = await verifyMembershipPayment(user.id);
return Response.json({ paid });
}
12 changes: 0 additions & 12 deletions src/app/api/user-existence/route.ts

This file was deleted.

5 changes: 5 additions & 0 deletions src/app/contact/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Title from '@/components/Title';
import type { Metadata } from 'next';
import Contact from './Contact';
import Form from './Form';
import Sponsorship from './Sponsorship';

export const metadata: Metadata = {
title: 'Contact',
};

export default function ContactPage() {
return (
<div className="h-full bg-[url('/images/rectangle-grid.svg')] bg-repeat-y md:bg-[length:90%_90%] md:bg-center md:bg-no-repeat">
Expand Down
5 changes: 5 additions & 0 deletions src/app/events/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import type { Metadata } from 'next';
import Image from 'next/image';
import Events from './Events';
import FridayNight from './FridayNight';
import Info from './Info';

export const metadata: Metadata = {
title: 'Events',
};

export default function EventsPage() {
return (
<main className="relative grid grid-cols-5 gap-y-12 text-lg md:text-xl">
Expand Down
5 changes: 4 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { Archivo } from 'next/font/google';

export const metadata: Metadata = {
icons: '/favicon.ico',
title: 'Computer Science Club',
title: {
template: '%s | Computer Science Club',
default: 'Computer Science Club',
},
description:
'The University of Adelaide Computer Science Club is a student-run club for those with an interest in computer science or computing in general.',
};
Expand Down
5 changes: 5 additions & 0 deletions src/app/sponsors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import Duck from '@/components/Duck';
import Paragraph from '@/components/Paragraph';
import Title from '@/components/Title';
import { YEAR } from '@/data/sponsors';
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Sponsors',
};

export default function SponsorsPage() {
return (
Expand Down
Loading
Loading