From 93cf294f8c174cc009ba93dbb46b9198041c13c2 Mon Sep 17 00:00:00 2001 From: suvanbanerjee Date: Sat, 17 Aug 2024 00:26:34 +0530 Subject: [PATCH 01/17] fix whit gradient issue --- app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/layout.tsx b/app/layout.tsx index 99f590e..9c9e084 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -25,7 +25,7 @@ export default function RootLayout({ children: React.ReactNode }) { return ( - +
From ff274e868889922175ad3c506840798017b0b0a6 Mon Sep 17 00:00:00 2001 From: TusharMohapatra07 Date: Sat, 17 Aug 2024 12:12:39 +0530 Subject: [PATCH 02/17] Add form overlay to achievements page --- app/(default)/achievements/page.tsx | 238 +++++++++++++++++++++++++++- 1 file changed, 234 insertions(+), 4 deletions(-) diff --git a/app/(default)/achievements/page.tsx b/app/(default)/achievements/page.tsx index 5856a5a..786231c 100644 --- a/app/(default)/achievements/page.tsx +++ b/app/(default)/achievements/page.tsx @@ -29,12 +29,11 @@ function AchievementCard({ achiever }: { achiever: Achiever }) { {achiever.Name}
    - {achiever?.CompanyPosition ? ( + {achiever?.CompanyPosition && (
  • - {" "} {achiever.CompanyPosition}
  • - ) : null} + )} {achiever.achievements.map((achievement, index) => (
  • {achievement} @@ -48,6 +47,10 @@ function AchievementCard({ achiever }: { achiever: Achiever }) { export default function AchievementsPage() { const [achievers, setAchievers] = useState([]); + const [isModalOpen, setIsModalOpen] = useState(false); + const [newAchievement, setNewAchievement] = useState>({ + achievements: [""], + }); useEffect(() => { async function fetchAchievers() { @@ -63,9 +66,33 @@ export default function AchievementsPage() { fetchAchievers(); }, []); + const handleAddAchievement = () => { + setNewAchievement((prev) => ({ + ...prev, + achievements: [...(prev.achievements || []), ""], + })); + }; + + const handleChangeAchievement = (index: number, value: string) => { + const updatedAchievements = [...(newAchievement.achievements || [])]; + updatedAchievements[index] = value; + setNewAchievement((prev) => ({ + ...prev, + achievements: updatedAchievements, + })); + }; + + const handleCloseModal = () => { + setIsModalOpen(false); + }; + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + }; + return (
    -

    Achievements

    +

    Achievements

    {[...Array(3)].map((_, colIndex) => (
    @@ -77,6 +104,209 @@ export default function AchievementsPage() {
    ))}
    +
    + +
    + {isModalOpen && ( +
    +
    +

    Add Achievement

    +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + Email: e.target.value, + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add Email" + /> +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + Name: e.target.value, + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add Name" + /> +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + Batch: Number(e.target.value), + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add Year" + /> +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + Portfolio: e.target.value, + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add GitHub Link" + /> +
    +
    + +
    + + +
    +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + CompanyPosition: e.target.value, + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Position, Company" + /> +
    +
    + + + setNewAchievement((prev) => ({ + ...prev, + Stipend: Number(e.target.value), + })) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add Stipend" + /> +
    +
    + + { + const file = e.target.files?.[0]; + if (file) { + setNewAchievement((prev) => ({ + ...prev, + imageUrl: URL.createObjectURL(file), + })); + } + }} + className="w-full p-3 bg-gray-800 rounded" + /> +
    +
    + + {newAchievement.achievements?.map((achievement, index) => ( +
    + + handleChangeAchievement(index, e.target.value) + } + className="w-full p-3 bg-gray-800 rounded" + placeholder="Add an achievement" + /> +
    + ))} + +
    +
    + + +
    +
    +
    +
    + )}
    ); } From 2298f00eb1a20369436d7e45fa03e44171f63f2c Mon Sep 17 00:00:00 2001 From: TusharMohapatra07 Date: Sat, 17 Aug 2024 12:59:29 +0530 Subject: [PATCH 03/17] removed stipend field --- app/(default)/achievements/page.tsx | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/(default)/achievements/page.tsx b/app/(default)/achievements/page.tsx index 786231c..d5f2b96 100644 --- a/app/(default)/achievements/page.tsx +++ b/app/(default)/achievements/page.tsx @@ -10,7 +10,6 @@ interface Achiever { Portfolio: string; Internship: string; CompanyPosition: string; - Stipend: number; achievements: string[]; } @@ -235,22 +234,9 @@ export default function AchievementsPage() { />
- - - setNewAchievement((prev) => ({ - ...prev, - Stipend: Number(e.target.value), - })) - } - className="w-full p-3 bg-gray-800 rounded" - placeholder="Add Stipend" - /> -
-
- + { From 5e92e756cb998277ac19c1d1b816a6f772fa377e Mon Sep 17 00:00:00 2001 From: 2004yash <2004agarwalyash@gmail.com> Date: Sat, 17 Aug 2024 15:49:07 +0530 Subject: [PATCH 04/17] Leads page frontend --- app/(default)/leads/page.tsx | 6 +- components/leads.tsx | 267 ++++++++++++++++++++++++++++------- 2 files changed, 222 insertions(+), 51 deletions(-) diff --git a/app/(default)/leads/page.tsx b/app/(default)/leads/page.tsx index 7ab37b0..107ed92 100644 --- a/app/(default)/leads/page.tsx +++ b/app/(default)/leads/page.tsx @@ -1,12 +1,16 @@ +import Leads from '../../../components/leads'; + + export const metadata = { title: 'Leads', description: 'Leads page', } -export default function Leads() { +export default function leads() { return ( <> + ) } \ No newline at end of file diff --git a/components/leads.tsx b/components/leads.tsx index a435433..0434b75 100644 --- a/components/leads.tsx +++ b/components/leads.tsx @@ -1,55 +1,222 @@ -import "../app/css/additional-styles/landing.css"; - -const leads = [ - { - id: 0, - text: "Akash Singh", - subtext: "CloudSek, Gsoc 24 ", - url: "/images/lead1.jpg", - }, - { - id: 1, - text: "Saalim Quadri", - subtext: "Raptee, LFX 23", - url: "/images/Lead2.jpg", - }, - { - id: 2, - text: "Pratyush Singh", - subtext: "Ultrahuman, Gsoc 23,24", - url: "/images/lead3.jpg", - }, -]; - -const Leads = () => { +// import "../app/css/additional-styles/landing.css"; + +// const leads = [ +// { +// id: 0, +// text: "Akash Singh", +// subtext: "CloudSek, Gsoc 24 ", +// url: "/images/lead1.jpg", +// }, +// { +// id: 1, +// text: "Saalim Quadri", +// subtext: "Raptee, LFX 23", +// url: "/images/Lead2.jpg", +// }, +// { +// id: 2, +// text: "Pratyush Singh", +// subtext: "Ultrahuman, Gsoc 23,24", +// url: "/images/lead3.jpg", +// }, +// ]; + +// const Leads = () => { +// return ( +// <> +//
+//

Leads

+//
+// Our Leadership Position are held by the best minds in and across the +// campus +//
+//
+//
+// {leads.map((lead) => ( +//
+//
+//

+// {lead.text} +//

+//

{lead.subtext}

+//
+//
+// ))} +//
+// +// ); +// }; + +// export default Leads; + + +import React from 'react'; + +interface Lead { + id: string; + name: string; + position: string; + organization: string; + additionalInfo: string; + imageUrl: string; +} + +const Leads: React.FC = () => { + const currentLeads: Lead[] = [ + { + id: '10', + name: 'Akash Singh', + position: '3rd year', + organization: 'CloudSek', + additionalInfo: 'Gsoc 24', + imageUrl: "https://media.licdn.com/dms/image/v2/D5603AQFeShMi1sbKLg/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1718481763562?e=1729123200&v=beta&t=60HO7YQ53F44tUfCHikuDNYHZPojS2SJD0msO1Sm3eY", + }, + { + id: '1', + name: 'Saalim Quadri', + position: '4th year', + organization: 'Raptee', + additionalInfo: 'LFX 23', + imageUrl: 'https://ik.imagekit.io/qx5kklh3ls/WhatsApp%20Image%202023-10-29%20at%2011.12.20%20AM.jpeg?updatedAt=1698558279266', + }, + { + id: '3', + name: 'Pratyush Singh', + position: 'Alumni', + organization: 'Ultrahuman', + additionalInfo: 'Gsoc 23, 24', + imageUrl: 'https://github-production-user-asset-6210df.s3.amazonaws.com/90026952/279694915-c7693363-6623-4bd2-9503-ee092b0e3593.jpeg', + }, + ]; + + const alumniLeads: Lead[] = [ + { + id: '2', + name: 'Prathik Singh', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://ik.imagekit.io/qx5kklh3ls/index.jpeg?updatedAt=1678781533632', + }, + { + id: '4', + name: 'Ashutosh Pandey', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/36353507?v=4', + }, + { + id: '5', + name: 'Bapu Pruthvidhar', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/37359679?v=4', + }, + { + id: '6', + name: 'Anukul Anand', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/64669326?v=4', + }, + { + id: '7', + name: 'Madhur Mehta', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/77354138?v=4', + }, + { + id: '8', + name: 'Debayan Ghosh Dastider', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/77199373?v=4', + }, + { + id: '9', + name: 'Rithik Raj Pandey', + position: '', + organization: '', + additionalInfo: '', + imageUrl: 'https://avatars.githubusercontent.com/u/83706503?s=400&u=2d00114433bc28b8e28252e41bbc919229b9a7f4&v=4', + }, + ]; + return ( - <> -
-

Leads

-
- Our Leadership Position are held by the best minds in and across the - campus -
-
-
- {leads.map((lead) => ( -
-
-

- {lead.text} -

-

{lead.subtext}

-
-
- ))} -
- +
+ + +
); }; +interface LeadSectionProps { + title: string; + leads: Lead[]; +} + +const LeadSection: React.FC = ({ title, leads }) => ( +
+

+ {title} +

+
+ {leads.map((lead) => ( +
+
+

{lead.name}

+

{lead.position}

+

{lead.organization}

+

{lead.additionalInfo}

+
+
+ ))} +
+
+); + export default Leads; + From 4cec80e9465da6b46614d9922e2a2007ab3d0dfa Mon Sep 17 00:00:00 2001 From: Akash Date: Sat, 17 Aug 2024 16:02:12 +0530 Subject: [PATCH 05/17] Added Auth Check for /sihregistraion and /recruitment routes and login page redirect Signed-off-by: Akash --- app/(default)/recruitment/page.tsx | 16 +++++++++++++- app/(default)/sihregistration/page.tsx | 13 ++++++++++- app/login/page.tsx | 14 ++++++++++-- components/Signup.tsx | 4 +++- components/forms/sihForm.tsx | 17 +++++++++------ components/ui/header.tsx | 30 +++++++++++++++++++++++--- 6 files changed, 80 insertions(+), 14 deletions(-) diff --git a/app/(default)/recruitment/page.tsx b/app/(default)/recruitment/page.tsx index 7a1e1c2..65763af 100644 --- a/app/(default)/recruitment/page.tsx +++ b/app/(default)/recruitment/page.tsx @@ -1,9 +1,23 @@ - +'use client' import RecruitmentForm from "@/components/forms/recruitmentForm"; import DotPattern from "@/components/magicui/dot-pattern"; import "../../css/additional-styles/form.css"; import { cn } from "@/lib/utils"; +import { onAuthStateChanged } from "firebase/auth"; +import { auth } from "@/Firebase"; +import { useEffect } from "react"; +import { useRouter } from "next/navigation"; + const RegisterPage = () => { + const router = useRouter(); + + useEffect(() => { + onAuthStateChanged(auth, (user) => { + if (!user) { + router.push("/login"); + } + }); + }); return (
diff --git a/app/(default)/sihregistration/page.tsx b/app/(default)/sihregistration/page.tsx index e5357bf..6190b38 100644 --- a/app/(default)/sihregistration/page.tsx +++ b/app/(default)/sihregistration/page.tsx @@ -1,10 +1,21 @@ - +'use client' import SIHRegistrationForm from "@/components/forms/sihForm"; import { FormProvider } from "@/components/forms/formContext"; import DotPattern from "@/components/magicui/dot-pattern"; import "../../css/additional-styles/form.css"; import { cn } from "@/lib/utils"; +import { onAuthStateChanged } from "firebase/auth"; +import { auth } from "@/Firebase"; +import { useRouter } from "next/navigation"; const RegisterPage = () => { + const router = useRouter(); + + onAuthStateChanged(auth, (user) => { + if (!user) { + router.push("/login"); + } + }); + return (
diff --git a/app/login/page.tsx b/app/login/page.tsx index 3c21c78..ba9276f 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -1,11 +1,21 @@ "use client"; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import Login from '../../components/Login'; import Signup from '../../components/Signup'; - +import { onAuthStateChanged } from 'firebase/auth'; +import { auth } from '@/Firebase'; +import { useRouter } from 'next/navigation'; export default function Home() { const [isLogin, setIsLogin] = useState(true); + const router = useRouter(); + useEffect(() => { + onAuthStateChanged(auth, (user) => { + if (user) { + router.push('/'); + } + }); + }); return (
diff --git a/components/Signup.tsx b/components/Signup.tsx index ca6f93e..f7481f4 100644 --- a/components/Signup.tsx +++ b/components/Signup.tsx @@ -149,7 +149,9 @@ const Signup = () => { id="secret-code" placeholder=" " value={secretCode} - onChange={(e) => setSecretCode(e.target.value)} + onChange={(e) => { + console.log(e.target.value); + setSecretCode(e.target.value)}} className="peer w-full bg-transparent border-0 border-b-2 border-green-500 text-white placeholder-transparent focus:border-green-400 focus:outline-none focus:ring-0 autofill:shadow-[inset_0_0_0px_1000px_rgba(0,0,0,0.8)] autofill:text-white pt-2 m-1" required /> diff --git a/components/forms/sihForm.tsx b/components/forms/sihForm.tsx index 078b408..e150ab8 100644 --- a/components/forms/sihForm.tsx +++ b/components/forms/sihForm.tsx @@ -1,7 +1,7 @@ "use client"; import "../../app/css/additional-styles/utility-patterns.css"; import "../../app/css/additional-styles/theme.css"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import Accordion from "./accordion"; import { useForm, SubmitHandler } from "react-hook-form"; import { useFormContext } from "../forms/formContext"; @@ -13,12 +13,22 @@ import { problems, } from "@/lib/constants/dropdownOptions"; import { useRouter } from "next/navigation"; +import { onAuthStateChanged } from "firebase/auth"; +import { auth } from "@/Firebase"; const SIHMultiStepForm: React.FC = () => { const { formData, setFormData } = useFormContext(); const [step, setStep] = useState(1); const [isSuccess, setSuccess] = useState(false); const [recaptchaToken, setRecaptchaToken] = useState(null); + const router = useRouter(); + useEffect(() => { + onAuthStateChanged(auth, (user) => { + if (!user) { + router.push("/login"); + } + }); + }); const { register, @@ -122,11 +132,6 @@ const SIHMultiStepForm: React.FC = () => { return (
- SIH
{/* Step 1: Team Information */} {step === 1 && ( diff --git a/components/ui/header.tsx b/components/ui/header.tsx index b29d0e3..dcfb7b9 100644 --- a/components/ui/header.tsx +++ b/components/ui/header.tsx @@ -5,11 +5,29 @@ import { usePathname } from 'next/navigation' import Link from 'next/link' import Logo from './logo' import MobileMenu from './mobile-menu' +import { onAuthStateChanged } from 'firebase/auth' +import { auth } from '@/Firebase' + export default function Header() { const [top, setTop] = useState(true) const pathname = usePathname() + const [loggedIn, setLoggedIn] = useState(false); + + const handleLogout = async () => { + await auth.signOut(); + setLoggedIn(false); + } + + useEffect(() => { + onAuthStateChanged(auth, (user) => { + if (user) { + setLoggedIn(true); + } + }); + }); + // Detect whether the user has scrolled the page down by 10px const scrollHandler = () => { window.pageYOffset > 10 ? setTop(false) : setTop(true) @@ -56,9 +74,15 @@ export default function Header() { */}
  • - -

    Login

    - + {loggedIn ? ( + + ) : ( + +

    Login

    + + )}
  • From 23bd8475c9c1dea02d3f54f599117808444d9734 Mon Sep 17 00:00:00 2001 From: Sky Singh <114267538+Akash-Singh04@users.noreply.github.com> Date: Sat, 17 Aug 2024 16:06:24 +0530 Subject: [PATCH 06/17] Revert "Leads page frontend" --- app/(default)/leads/page.tsx | 6 +- components/leads.tsx | 267 +++++++---------------------------- 2 files changed, 51 insertions(+), 222 deletions(-) diff --git a/app/(default)/leads/page.tsx b/app/(default)/leads/page.tsx index 107ed92..7ab37b0 100644 --- a/app/(default)/leads/page.tsx +++ b/app/(default)/leads/page.tsx @@ -1,16 +1,12 @@ -import Leads from '../../../components/leads'; - - export const metadata = { title: 'Leads', description: 'Leads page', } -export default function leads() { +export default function Leads() { return ( <> - ) } \ No newline at end of file diff --git a/components/leads.tsx b/components/leads.tsx index 0434b75..a435433 100644 --- a/components/leads.tsx +++ b/components/leads.tsx @@ -1,222 +1,55 @@ -// import "../app/css/additional-styles/landing.css"; - -// const leads = [ -// { -// id: 0, -// text: "Akash Singh", -// subtext: "CloudSek, Gsoc 24 ", -// url: "/images/lead1.jpg", -// }, -// { -// id: 1, -// text: "Saalim Quadri", -// subtext: "Raptee, LFX 23", -// url: "/images/Lead2.jpg", -// }, -// { -// id: 2, -// text: "Pratyush Singh", -// subtext: "Ultrahuman, Gsoc 23,24", -// url: "/images/lead3.jpg", -// }, -// ]; - -// const Leads = () => { -// return ( -// <> -//
    -//

    Leads

    -//
    -// Our Leadership Position are held by the best minds in and across the -// campus -//
    -//
    -//
    -// {leads.map((lead) => ( -//
    -//
    -//

    -// {lead.text} -//

    -//

    {lead.subtext}

    -//
    -//
    -// ))} -//
    -// -// ); -// }; - -// export default Leads; - - -import React from 'react'; - -interface Lead { - id: string; - name: string; - position: string; - organization: string; - additionalInfo: string; - imageUrl: string; -} - -const Leads: React.FC = () => { - const currentLeads: Lead[] = [ - { - id: '10', - name: 'Akash Singh', - position: '3rd year', - organization: 'CloudSek', - additionalInfo: 'Gsoc 24', - imageUrl: "https://media.licdn.com/dms/image/v2/D5603AQFeShMi1sbKLg/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1718481763562?e=1729123200&v=beta&t=60HO7YQ53F44tUfCHikuDNYHZPojS2SJD0msO1Sm3eY", - }, - { - id: '1', - name: 'Saalim Quadri', - position: '4th year', - organization: 'Raptee', - additionalInfo: 'LFX 23', - imageUrl: 'https://ik.imagekit.io/qx5kklh3ls/WhatsApp%20Image%202023-10-29%20at%2011.12.20%20AM.jpeg?updatedAt=1698558279266', - }, - { - id: '3', - name: 'Pratyush Singh', - position: 'Alumni', - organization: 'Ultrahuman', - additionalInfo: 'Gsoc 23, 24', - imageUrl: 'https://github-production-user-asset-6210df.s3.amazonaws.com/90026952/279694915-c7693363-6623-4bd2-9503-ee092b0e3593.jpeg', - }, - ]; - - const alumniLeads: Lead[] = [ - { - id: '2', - name: 'Prathik Singh', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://ik.imagekit.io/qx5kklh3ls/index.jpeg?updatedAt=1678781533632', - }, - { - id: '4', - name: 'Ashutosh Pandey', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/36353507?v=4', - }, - { - id: '5', - name: 'Bapu Pruthvidhar', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/37359679?v=4', - }, - { - id: '6', - name: 'Anukul Anand', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/64669326?v=4', - }, - { - id: '7', - name: 'Madhur Mehta', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/77354138?v=4', - }, - { - id: '8', - name: 'Debayan Ghosh Dastider', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/77199373?v=4', - }, - { - id: '9', - name: 'Rithik Raj Pandey', - position: '', - organization: '', - additionalInfo: '', - imageUrl: 'https://avatars.githubusercontent.com/u/83706503?s=400&u=2d00114433bc28b8e28252e41bbc919229b9a7f4&v=4', - }, - ]; - +import "../app/css/additional-styles/landing.css"; + +const leads = [ + { + id: 0, + text: "Akash Singh", + subtext: "CloudSek, Gsoc 24 ", + url: "/images/lead1.jpg", + }, + { + id: 1, + text: "Saalim Quadri", + subtext: "Raptee, LFX 23", + url: "/images/Lead2.jpg", + }, + { + id: 2, + text: "Pratyush Singh", + subtext: "Ultrahuman, Gsoc 23,24", + url: "/images/lead3.jpg", + }, +]; + +const Leads = () => { return ( -
    - - -
    + <> +
    +

    Leads

    +
    + Our Leadership Position are held by the best minds in and across the + campus +
    +
    +
    + {leads.map((lead) => ( +
    +
    +

    + {lead.text} +

    +

    {lead.subtext}

    +
    +
    + ))} +
    + ); }; -interface LeadSectionProps { - title: string; - leads: Lead[]; -} - -const LeadSection: React.FC = ({ title, leads }) => ( -
    -

    - {title} -

    -
    - {leads.map((lead) => ( -
    -
    -

    {lead.name}

    -

    {lead.position}

    -

    {lead.organization}

    -

    {lead.additionalInfo}

    -
    -
    - ))} -
    -
    -); - export default Leads; - From 85b032456a2455b92d68ebd7527750ae7d5a16f7 Mon Sep 17 00:00:00 2001 From: 2004yash <2004agarwalyash@gmail.com> Date: Sat, 17 Aug 2024 16:26:52 +0530 Subject: [PATCH 07/17] bg color changed --- components/leads.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/leads.tsx b/components/leads.tsx index 0434b75..016de11 100644 --- a/components/leads.tsx +++ b/components/leads.tsx @@ -154,7 +154,7 @@ const Leads: React.FC = () => { ]; return ( -
    +
    From 5fbd18d2cebe91bfa011e4f1b0c693c829dd8492 Mon Sep 17 00:00:00 2001 From: 2004yash <2004agarwalyash@gmail.com> Date: Sat, 17 Aug 2024 16:35:31 +0530 Subject: [PATCH 08/17] updated leads page --- app/(default)/leads/page.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/(default)/leads/page.tsx b/app/(default)/leads/page.tsx index 7ab37b0..3776cb8 100644 --- a/app/(default)/leads/page.tsx +++ b/app/(default)/leads/page.tsx @@ -1,12 +1,16 @@ +import Leads from "@/components/leads" + + export const metadata = { title: 'Leads', description: 'Leads page', } -export default function Leads() { +export default function leads() { return ( <> + ) } \ No newline at end of file From 442882908f825def7f3420b8b8b818560157aed2 Mon Sep 17 00:00:00 2001 From: mohit-nagaraj Date: Sat, 17 Aug 2024 17:52:36 +0530 Subject: [PATCH 09/17] integration --- app/(default)/achievements/page.tsx | 89 +++++++++++++++++-------- app/(default)/api/achievements/route.ts | 53 +++++++++------ package-lock.json | 74 +++++++++++++++++++- package.json | 3 +- 4 files changed, 168 insertions(+), 51 deletions(-) diff --git a/app/(default)/achievements/page.tsx b/app/(default)/achievements/page.tsx index d5f2b96..54e429e 100644 --- a/app/(default)/achievements/page.tsx +++ b/app/(default)/achievements/page.tsx @@ -1,15 +1,17 @@ "use client"; import { useEffect, useState } from "react"; +import axios from "axios"; interface Achiever { - imageUrl: string; - Email: string; - Name: string; - Batch: number; - Portfolio: string; - Internship: string; - CompanyPosition: string; + imageUrl?: string; + image?: File; + email: string; + name: string; + batch: number; + portfolio: string; + internship: string; + companyPosition: string; achievements: string[]; } @@ -19,18 +21,18 @@ function AchievementCard({ achiever }: { achiever: Achiever }) {
    {`${achiever.Name}'s

    - {achiever.Name} + {achiever.name}

      - {achiever?.CompanyPosition && ( + {achiever?.companyPosition && (
    • - {achiever.CompanyPosition} + {achiever.companyPosition}
    • )} {achiever.achievements.map((achievement, index) => ( @@ -87,6 +89,22 @@ export default function AchievementsPage() { const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); + try{ + const formData = new FormData(); + formData.append("image", newAchievement.image || ""); + formData.append("email", newAchievement.email || ""); + formData.append("name", newAchievement.name || ""); + formData.append("batch", String(newAchievement.batch || "")); + formData.append("portfolio", newAchievement.portfolio || ""); + formData.append("internship", newAchievement.internship || ""); + formData.append("companyPosition", newAchievement.companyPosition || ""); + formData.append("achievements", JSON.stringify(newAchievement.achievements || [])); + const response = await axios.post("/api/achievements", formData); + setAchievers((prev) => [...prev, response.data]); + setIsModalOpen(false); + } catch (error) { + console.error("Error saving data:", error); + } }; return ( @@ -98,7 +116,7 @@ export default function AchievementsPage() { {achievers .filter((_, index) => index % 3 === colIndex) .map((achiever) => ( - + ))}
    ))} @@ -123,11 +141,13 @@ export default function AchievementsPage() { setNewAchievement((prev) => ({ ...prev, - Email: e.target.value, + email: e.target.value, })) } className="w-full p-3 bg-gray-800 rounded" @@ -138,11 +158,13 @@ export default function AchievementsPage() { setNewAchievement((prev) => ({ ...prev, - Name: e.target.value, + name: e.target.value, })) } className="w-full p-3 bg-gray-800 rounded" @@ -153,11 +175,13 @@ export default function AchievementsPage() { setNewAchievement((prev) => ({ ...prev, - Batch: Number(e.target.value), + batch: Number(e.target.value), })) } className="w-full p-3 bg-gray-800 rounded" @@ -168,11 +192,13 @@ export default function AchievementsPage() { setNewAchievement((prev) => ({ ...prev, - Portfolio: e.target.value, + portfolio: e.target.value, })) } className="w-full p-3 bg-gray-800 rounded" @@ -187,13 +213,13 @@ export default function AchievementsPage() {