+ );
+}
From cfa24cf5b1474452498d4547b2c67c8dcf306478 Mon Sep 17 00:00:00 2001
From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com>
Date: Fri, 15 Nov 2024 22:00:32 +0530
Subject: [PATCH 03/40] refactor: reorganize registration form schemas
---
src/app/page.tsx | 2 +-
src/components/common/registration-form.tsx | 89 +++++++--------------
src/utils/zod-schemas.ts | 29 +++++++
3 files changed, 59 insertions(+), 61 deletions(-)
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 2d22d1e..310e450 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -3,7 +3,7 @@
import React, { useState, useEffect } from "react";
// import ParallaxFooter from "@/components/common/Footer";
import Speakers from "@/components/common/speakers";
-import { PreviousEdition } from "@/components/common/Container-Scroll";
+import { PreviousEdition } from "@/components/common/container-scroll";
import About from "@/components/common/About";
import Team from "@/components/common/Team-Section";
// import { CtaSection } from "@/components/common/cta-section";
diff --git a/src/components/common/registration-form.tsx b/src/components/common/registration-form.tsx
index bace413..71d5958 100644
--- a/src/components/common/registration-form.tsx
+++ b/src/components/common/registration-form.tsx
@@ -1,18 +1,17 @@
"use client";
-import React, { useEffect, useState } from "react";
-import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import * as z from "zod";
+import { getPrice } from "@/app/actions/get-price";
+import { invalidateCouponCode } from "@/app/actions/invalidate-coupon";
+import { submitForm } from "@/app/actions/submit-form";
import { Button } from "@/components/ui/button";
-import { Input } from "@/components/ui/input";
import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
+ Card,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
import {
Form,
FormControl,
@@ -22,30 +21,32 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
-import {
- Card,
- CardContent,
- CardDescription,
- CardFooter,
- CardHeader,
- CardTitle,
-} from "@/components/ui/card";
+import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import { getPrice } from "@/app/actions/get-price";
-import { toast } from "sonner";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { basePrice, initialdiscount, sjecFacultyPrice, sjecStudentPrice } from "@/constants";
+import { getSjecMemberType } from "@/lib/helper";
+import { FormDataInterface } from "@/types";
import getErrorMessage from "@/utils/getErrorMessage";
-import { basePrice, initialdiscount, sjecStudentPrice,sjecFacultyPrice } from "@/constants";
-import { invalidateCouponCode } from "@/app/actions/invalidate-coupon";
+import { useUploadThing } from "@/utils/uploadthing";
+import { baseSchema, studentFormSchema, studentSchema } from "@/utils/zod-schemas";
+import { zodResolver } from "@hookform/resolvers/zod";
import { useSession } from "next-auth/react";
import Script from "next/script";
-import { useUploadThing } from "@/utils/uploadthing";
-import { submitForm } from "@/app/actions/submit-form";
+import { useEffect, useState } from "react";
+import { useForm } from "react-hook-form";
+import { toast } from "sonner";
+import * as z from "zod";
import { PaymentLoading } from "../payment/payment-loading";
import { PaymentSuccessfulComponent } from "../payment/payment-successful";
-import { RadioGroup, RadioGroupItem } from "../ui/radio-group";
import { FileUpload } from "../ui/file-upload";
-import { getSjecMemberType } from "@/lib/helper";
-import { FormDataInterface } from "@/types";
+import { RadioGroup, RadioGroupItem } from "../ui/radio-group";
declare global {
interface Window {
@@ -53,24 +54,6 @@ declare global {
}
}
-const baseSchema = z.object({
- designation: z.enum(["student", "faculty", "employee"]),
- name: z.string().min(2, { message: "Name must be at least 2 characters." }),
- email: z.string().email({ message: "Invalid email address." }),
- phone: z
- .string()
- .regex(/^\d{10}$/, { message: "Phone number must be 10 digits." }),
- photo: z.string(),
- entityName: z.string().optional(),
- couponCode: z.string().optional(),
- foodPreference: z.enum(["veg", "non-veg"]),
-});
-
-const studentSchema = baseSchema.extend({
- usn: z.string().min(1, { message: "USN is required for students." }),
- idCard: z.string().min(1, { message: "ID Card is required for students." }),
-});
-
type FormSchema = z.infer;
type UploadedFile = {
@@ -254,20 +237,6 @@ export default function RegistrationForm() {
const designation = form.getValues("designation");
if (designation === "student") {
form.clearErrors();
- const studentFormSchema = z.object({
- name: z
- .string()
- .min(2, { message: "Name must be at least 2 characters." }),
- email: z.string().email({ message: "Invalid email address." }),
- phone: z
- .string()
- .regex(/^\d{10}$/, { message: "Phone number must be 10 digits." }),
- usn: z.string().min(1, { message: "USN is required for students." }),
- idCard: z
- .string()
- .min(1, { message: "ID Card is required for students." }),
- photo: z.string().min(1, { message: "Photo is required." }),
- });
const validationResult = await studentFormSchema.safeParseAsync(
form.getValues(),
);
diff --git a/src/utils/zod-schemas.ts b/src/utils/zod-schemas.ts
index 31542b6..044167a 100644
--- a/src/utils/zod-schemas.ts
+++ b/src/utils/zod-schemas.ts
@@ -23,3 +23,32 @@ export const emailSchema = z.object({
email: z.string().email(),
name: z.string().min(1),
});
+
+export const baseSchema = z.object({
+ designation: z.enum(["student", "faculty", "employee"]),
+ name: z.string().min(2, { message: "Name must be at least 2 characters." }),
+ email: z.string().email({ message: "Invalid email address." }),
+ phone: z
+ .string()
+ .regex(/^\d{10}$/, { message: "Phone number must be 10 digits." }),
+ photo: z.string(),
+ entityName: z.string().optional(),
+ couponCode: z.string().optional(),
+ foodPreference: z.enum(["veg", "non-veg"]),
+});
+
+export const studentSchema = baseSchema.extend({
+ usn: z.string().min(1, { message: "USN is required for students." }),
+ idCard: z.string().min(1, { message: "ID Card is required for students." }),
+});
+
+export const studentFormSchema = z.object({
+ name: z.string().min(2, { message: "Name must be at least 2 characters." }),
+ email: z.string().email({ message: "Invalid email address." }),
+ phone: z
+ .string()
+ .regex(/^\d{10}$/, { message: "Phone number must be 10 digits." }),
+ usn: z.string().min(1, { message: "USN is required for students." }),
+ idCard: z.string().min(1, { message: "ID Card is required for students." }),
+ photo: z.string().min(1, { message: "Photo is required." }),
+});
From 2021227d0e8ff39188d4bc8bc9af357b8445eba7 Mon Sep 17 00:00:00 2001
From: Joywin Bennis <107112207+joywin2003@users.noreply.github.com>
Date: Fri, 15 Nov 2024 22:52:22 +0530
Subject: [PATCH 04/40] refactor: rename components to kebab case and update
registration form options
---
src/app/page.tsx | 4 +-
src/components/common/Team-Section.tsx | 2 +-
src/components/common/about.tsx | 61 ++++++++
src/components/common/footer.tsx | 132 ++++++++++++++++++
src/components/common/registration-form.tsx | 4 +-
.../common/{TeamCard.tsx => team-card.tsx} | 0
src/components/common/team-section.tsx | 69 +++++++++
7 files changed, 267 insertions(+), 5 deletions(-)
create mode 100644 src/components/common/about.tsx
create mode 100644 src/components/common/footer.tsx
rename src/components/common/{TeamCard.tsx => team-card.tsx} (100%)
create mode 100644 src/components/common/team-section.tsx
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 310e450..94893ba 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -4,8 +4,8 @@ import React, { useState, useEffect } from "react";
// import ParallaxFooter from "@/components/common/Footer";
import Speakers from "@/components/common/speakers";
import { PreviousEdition } from "@/components/common/container-scroll";
-import About from "@/components/common/About";
-import Team from "@/components/common/Team-Section";
+import About from "@/components/common/about";
+import Team from "@/components/common/team-section";
// import { CtaSection } from "@/components/common/cta-section";
import Performers from "@/components/widget/performers";
import HeroHighlight from "@/components/widget/hero";
diff --git a/src/components/common/Team-Section.tsx b/src/components/common/Team-Section.tsx
index 848fa95..3a02b69 100644
--- a/src/components/common/Team-Section.tsx
+++ b/src/components/common/Team-Section.tsx
@@ -1,5 +1,5 @@
import { tedxsjecAssetsPrefix } from "@/lib/utils";
-import TeamCard from "./TeamCard";
+import TeamCard from "./team-card";
const team = [
{
diff --git a/src/components/common/about.tsx b/src/components/common/about.tsx
new file mode 100644
index 0000000..1bacb48
--- /dev/null
+++ b/src/components/common/about.tsx
@@ -0,0 +1,61 @@
+import { motion } from "framer-motion";
+
+const AboutSection: React.FC = () => {
+ return (
+
+ {/* Background decorative layers */}
+
+ {/* */}
+ {/*
+ */}
+
+
+ {/* About content */}
+
+
+ About TEDx
+ SJEC
+
+
+ TEDx
+ SJEC is an independently organized event
+ bringing together innovators, thinkers, and visionaries from around
+ the world. Our goal is to inspire change, provoke deep discussions,
+ and foster creativity through groundbreaking ideas. Our goal is to
+ inspire change, provoke deep discussions, and foster creativity
+ through groundbreaking ideas.
+