From 3c948f6f89df82d59cc5952326c1f2c61d33ca1f Mon Sep 17 00:00:00 2001 From: NishantGupt786 Date: Thu, 14 Mar 2024 03:23:03 +0530 Subject: [PATCH] pr --- devsoc24-portal-fe/src/app/home/page.tsx | 13 ++++-- .../src/assets/images/contentstack.svg | 33 ++++++++++++++ .../src/assets/images/hallofcricket.svg | 9 ++++ .../src/assets/images/quillbot.svg | 9 ++++ .../src/components/sponsors.tsx | 43 +++++++++++++++++++ .../src/components/team/createTeam.tsx | 35 ++++++++++++--- .../src/components/team/leaveTeam.tsx | 32 +++++++++++--- .../src/components/track/TrackComponent.tsx | 5 ++- devsoc24-portal-fe/src/store/store.tsx | 12 +++++- 9 files changed, 172 insertions(+), 19 deletions(-) create mode 100644 devsoc24-portal-fe/src/assets/images/contentstack.svg create mode 100644 devsoc24-portal-fe/src/assets/images/hallofcricket.svg create mode 100644 devsoc24-portal-fe/src/assets/images/quillbot.svg create mode 100644 devsoc24-portal-fe/src/components/sponsors.tsx diff --git a/devsoc24-portal-fe/src/app/home/page.tsx b/devsoc24-portal-fe/src/app/home/page.tsx index 54d9034..a8a7f8c 100644 --- a/devsoc24-portal-fe/src/app/home/page.tsx +++ b/devsoc24-portal-fe/src/app/home/page.tsx @@ -14,6 +14,7 @@ import { useTeamStore, useUserStore, showModalStore, + IdeaStore, } from "@/store/store"; import TrackComponent from "@/components/track/TrackComponent"; import toast from "react-hot-toast"; @@ -32,6 +33,7 @@ import Link from "next/link"; import TimelineComponent from "@/components/timeline/timelineComponent"; import LeaveTeam from "@/components/team/leaveTeam"; import Kick from "@/components/team/kick"; +import Sponsors from "@/components/sponsors"; interface ideaProps { message: string; @@ -51,7 +53,7 @@ export default function HomePage() { const { idea, setIdea } = useIdeaStore(); const { team, setTeam } = useTeamStore(); const { user, setUser } = useUserStore(); - const [getIdea, SetIdea] = useState(""); + const {getIdea, SetIdea} = IdeaStore(); const { teamData, setTeamData } = useTeamDataStore(); const { isLeader, setIsLeader } = useLeaderStore(); const { showModal, setShowModal } = showModalStore(); @@ -250,7 +252,7 @@ export default function HomePage() { const ideaCard = [ { text: "Submit An Idea", - showModal: getIdea !== "idea found", + showModal: getIdea !== "idea found" && getIdea !== "", modalType: idea === 409 ? "Choice" : "JoinTeam", routeTo: "/submit-idea", }, @@ -267,7 +269,7 @@ export default function HomePage() { return ( <> -
+
@@ -337,7 +339,10 @@ export default function HomePage() { : ideaCard } /> - +
+ + +
diff --git a/devsoc24-portal-fe/src/assets/images/contentstack.svg b/devsoc24-portal-fe/src/assets/images/contentstack.svg new file mode 100644 index 0000000..7509abe --- /dev/null +++ b/devsoc24-portal-fe/src/assets/images/contentstack.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/devsoc24-portal-fe/src/assets/images/hallofcricket.svg b/devsoc24-portal-fe/src/assets/images/hallofcricket.svg new file mode 100644 index 0000000..66b5dd8 --- /dev/null +++ b/devsoc24-portal-fe/src/assets/images/hallofcricket.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/devsoc24-portal-fe/src/assets/images/quillbot.svg b/devsoc24-portal-fe/src/assets/images/quillbot.svg new file mode 100644 index 0000000..e9bcaf8 --- /dev/null +++ b/devsoc24-portal-fe/src/assets/images/quillbot.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/devsoc24-portal-fe/src/components/sponsors.tsx b/devsoc24-portal-fe/src/components/sponsors.tsx new file mode 100644 index 0000000..f111a79 --- /dev/null +++ b/devsoc24-portal-fe/src/components/sponsors.tsx @@ -0,0 +1,43 @@ +import Image from "next/image"; +import contentstack from "@/assets/images/contentstack.svg"; +import hallofcricket from "@/assets/images/hallofcricket.svg"; +import quillbot from "@/assets/images/quillbot.svg"; + +function Sponsors() { + return ( +
+
Sponsors
+
+
+ titlesponsor +

Title sponsor

+
+ +
+
+ inkind +

In Kind sponsor

+
+
+ inkind +

In Kind sponsor

+
+
+
+
+ ); +} + +export default Sponsors; diff --git a/devsoc24-portal-fe/src/components/team/createTeam.tsx b/devsoc24-portal-fe/src/components/team/createTeam.tsx index 2af30bb..b05c213 100644 --- a/devsoc24-portal-fe/src/components/team/createTeam.tsx +++ b/devsoc24-portal-fe/src/components/team/createTeam.tsx @@ -8,17 +8,39 @@ import { import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; -import axios, { AxiosError } from "axios"; +import axios, { AxiosError, AxiosResponse } from "axios"; import { useRef } from "react"; -import { useTeamDataStore, useTeamStore } from "@/store/store"; +import { + useTeamDataStore, + useTeamStore, + useIdeaStore, + useLeaderStore, + IdeaStore, +} from "@/store/store"; import { useRouter } from "next/navigation"; import { APIResponse } from "@/schemas/api"; import toast from "react-hot-toast"; +interface ideaProps { + message: string; + status: boolean; + data?: { + title: string; + description: string; + track: string; + github_link: string; + figma_link: string; + others: string; + }; +} + function CreateTeam() { const { team, setTeam } = useTeamStore(); const inputRef = useRef(null); const { teamData, setTeamData } = useTeamDataStore(); + const { idea, setIdea } = useIdeaStore(); + const { isLeader, setIsLeader } = useLeaderStore(); + const { getIdea, SetIdea } = IdeaStore(); const router = useRouter(); @@ -33,9 +55,13 @@ function CreateTeam() { withCredentials: true, }, ); - toast.success("Team created successfully!"); - await fetchTeam(); + + setIsLeader(true); + SetIdea(""); + setIdea(409); setTeam(false); + await fetchTeam(); + toast.success("Team created successfully!"); } catch (err) { if (axios.isAxiosError(err)) { switch (err.response?.status) { @@ -65,7 +91,6 @@ function CreateTeam() { }, ); setTeamData(response.data); - setTeam(true); } catch (e) { if (axios.isAxiosError(e)) { switch (e.response?.status) { diff --git a/devsoc24-portal-fe/src/components/team/leaveTeam.tsx b/devsoc24-portal-fe/src/components/team/leaveTeam.tsx index 41f55aa..81c4c7c 100644 --- a/devsoc24-portal-fe/src/components/team/leaveTeam.tsx +++ b/devsoc24-portal-fe/src/components/team/leaveTeam.tsx @@ -3,16 +3,32 @@ import { useTeamStore, useTeamDataStore, showModalStore, + IdeaStore, } from "@/store/store"; -import axios from "axios"; +import axios, { AxiosError, AxiosResponse } from "axios"; import toast from "react-hot-toast"; import { userProps } from "@/interfaces"; import { useRouter } from "next/navigation"; +import { type APIResponse } from "@/schemas/api"; + +interface ideaProps { + message: string; + status: boolean; + data?: { + title: string; + description: string; + track: string; + github_link: string; + figma_link: string; + others: string; + }; +} const LeaveTeam = () => { const { team, setTeam } = useTeamStore(); const { showModal, setShowModal } = showModalStore(); const { teamData, setTeamData } = useTeamDataStore(); + const { getIdea, SetIdea } = IdeaStore(); const router = useRouter(); @@ -26,6 +42,7 @@ const LeaveTeam = () => { }, ); setTeamData(response.data); + } catch (e) { if (axios.isAxiosError(e)) { switch (e.response?.status) { @@ -46,29 +63,30 @@ const LeaveTeam = () => { } }; + const leaveTeam = async () => { const handleClick = async () => { await axios.delete(`${process.env.NEXT_PUBLIC_API_URL}/team/leave`, { withCredentials: true, }); - setShowModal("") + console.log("left team"); + SetIdea("left team"); + void fetchTeam(); + setTeam(true); + setShowModal(""); }; await toast.promise(handleClick(), { loading: "Loading...", success: () => { - setTeam(true); - void fetchTeam(); return `Accepted`; }, error: `Something went wrong`, }); - - }; return ( -
+