From 9abfd4305167ccc7a0d843389d15920fc9f46891 Mon Sep 17 00:00:00 2001 From: rishitkamboj Date: Wed, 26 Jun 2024 09:07:53 +0530 Subject: [PATCH 1/3] Incorporated Rudra's changes a bit and made the UI better and responsive --- apps/web/src/app/page.tsx | 60 ++++++++++--------- apps/web/src/components/navbar.tsx | 2 +- apps/web/src/components/pre-register-form.tsx | 28 ++++++--- packages/ui/package.json | 1 + 4 files changed, 54 insertions(+), 37 deletions(-) diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 2d690f5..4d9d6f7 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -54,36 +54,38 @@ export default function Page(): JSX.Element { ] return (
-
- -

- The Most Awaited Cohort! -

-
+
+ +

+ The Most Awaited Cohort! +

+
+ +
+
+

Upcoming Cohorts

+
+ {courses.map(course => course.status === "Upcoming" ? () : null)} +
+
+
+ +
+

Available Cohorts

+
+ {courses.map(course => course.status !== "Upcoming" ? () : null)} +
+
-
-
-

Upcoming Cohorts

-
- {courses.map(course => course.status === "Upcoming" ? () : null)} -
-
-
-
-

Available Cohorts

-
- {courses.map(course => course.status !== "Upcoming" ? () : null)} -
-
); } diff --git a/apps/web/src/components/navbar.tsx b/apps/web/src/components/navbar.tsx index 0f656d1..48ae64f 100644 --- a/apps/web/src/components/navbar.tsx +++ b/apps/web/src/components/navbar.tsx @@ -6,7 +6,7 @@ export default function Navbar() { return ( < nav className="fixed top-0 z-50 flex h-12 w-full items-center gap-2 border-b shadow-sm bg-white dark:bg-gray-900" > < div className="mx-auto flex w-full items-center justify-between md:max-w-screen-2xl" > -

100xDevs

+

100xDevs

+ @@ -63,10 +76,11 @@ export function PreRegForm() { } }) }} /> + {warning &&

{warning}

} - +
); -} +} \ No newline at end of file diff --git a/packages/ui/package.json b/packages/ui/package.json index 3f28866..86bbe65 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -17,6 +17,7 @@ "./input": "./src/components/ui/input.tsx", "./label": "./src/components/ui/label.tsx", "./dialog": "./src/components/ui/dialog.tsx" + }, "license": "MIT", "scripts": { From 453f6d5282f5f171965b78b1fb0f4887e45ac928 Mon Sep 17 00:00:00 2001 From: rishitkamboj Date: Wed, 26 Jun 2024 09:21:20 +0530 Subject: [PATCH 2/3] more changes --- apps/web/src/components/pre-register-form.tsx | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/apps/web/src/components/pre-register-form.tsx b/apps/web/src/components/pre-register-form.tsx index a7876d5..936721b 100644 --- a/apps/web/src/components/pre-register-form.tsx +++ b/apps/web/src/components/pre-register-form.tsx @@ -2,7 +2,6 @@ import React, { useState } from "react"; import { Label } from "@repo/ui/label"; import { Input } from "@repo/ui/input"; - import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@repo/ui/components/ui/dialog"; import { Button } from "@repo/ui/components/ui/button"; @@ -13,24 +12,15 @@ export function PreRegForm() { email: "" }) const [isOpen, setIsOpen] = useState(false) - const [warning, setWarning] = useState(""); const [button,setButton]=useState("Register"); - - const handleSubmit = async () => { - if (!formData.email.endsWith("@gmail.com")) { - setWarning("Email must end with @gmail.com");//adjust it later as per requirements - return; - } - setWarning(""); + const handleSubmit = async () => { setButton("Registering..."); await fetch("/api", { - method: "POST", - body: JSON.stringify(formData) - }); - setIsOpen(false); + method: "POST", body: JSON.stringify(formData) + }) setButton("Register"); + setIsOpen(false) }; - return ( setIsOpen(prev => !prev)}> @@ -76,11 +66,10 @@ export function PreRegForm() { } }) }} /> - {warning &&

{warning}

}
); -} \ No newline at end of file +} From c044ea0c5e62a10c39fad84c83cf499815e82604 Mon Sep 17 00:00:00 2001 From: rishitkamboj Date: Wed, 26 Jun 2024 09:27:08 +0530 Subject: [PATCH 3/3] added warning --- apps/web/src/components/pre-register-form.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/web/src/components/pre-register-form.tsx b/apps/web/src/components/pre-register-form.tsx index 936721b..9862350 100644 --- a/apps/web/src/components/pre-register-form.tsx +++ b/apps/web/src/components/pre-register-form.tsx @@ -14,6 +14,10 @@ export function PreRegForm() { const [isOpen, setIsOpen] = useState(false) const [button,setButton]=useState("Register"); const handleSubmit = async () => { + if (!formData.firstName || !formData.lastName || !formData.email) { + alert("Fields cannot be empty"); + return; + } setButton("Registering..."); await fetch("/api", { method: "POST", body: JSON.stringify(formData)