Skip to content

Commit

Permalink
pr
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantGupt786 committed Mar 13, 2024
1 parent 4d5976f commit 3c948f6
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 19 deletions.
13 changes: 9 additions & 4 deletions devsoc24-portal-fe/src/app/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
useTeamStore,
useUserStore,
showModalStore,
IdeaStore,
} from "@/store/store";
import TrackComponent from "@/components/track/TrackComponent";
import toast from "react-hot-toast";
Expand All @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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",
},
Expand All @@ -267,7 +269,7 @@ export default function HomePage() {
return (
<>
<ToastContainer />
<main className="flex h-fit flex-col items-start overflow-x-hidden bg-[#F4F5FA] lg:h-screen max-w-screen">
<main className="max-w-screen flex h-fit flex-col items-start overflow-x-hidden bg-[#F4F5FA] lg:h-screen">
<div className="flex h-[10%] w-full items-center justify-between gap-x-8 bg-background px-6 py-2">
<div className="flex flex-row gap-8">
<Logo className="h-9/10 w-auto" />
Expand Down Expand Up @@ -337,7 +339,10 @@ export default function HomePage() {
: ideaCard
}
/>
<TrackComponent />
<div>
<Sponsors />
<TrackComponent />
</div>
</div>
</div>
</main>
Expand Down
33 changes: 33 additions & 0 deletions devsoc24-portal-fe/src/assets/images/contentstack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions devsoc24-portal-fe/src/assets/images/hallofcricket.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions devsoc24-portal-fe/src/assets/images/quillbot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions devsoc24-portal-fe/src/components/sponsors.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="mb-4 h-full w-full overflow-auto rounded-xl bg-white md:w-[32vw] lg:h-[36vh]">
<div className="pl-6 pt-4 font-semibold text-[#45464E]">Sponsors</div>
<div className="flex flex-col items-center justify-center pt-3">
<div className="flex flex-col items-center justify-center">
<Image
src={contentstack as HTMLImageElement}
alt="titlesponsor"
width={200}
/>
<p className="text-lg font-semibold">Title sponsor</p>
</div>

<div className="flex w-full justify-between pl-12 pr-8">
<div className="flex flex-col items-center justify-center pt-3">
<Image
src={hallofcricket as HTMLImageElement}
alt="inkind"
width={100}
/>
<p className="text-lg font-semibold">In Kind sponsor</p>
</div>
<div className="flex flex-col items-center justify-end pt-3">
<Image
src={quillbot as HTMLImageElement}
alt="inkind"
width={150}
/>
<p className="text-lg font-semibold">In Kind sponsor</p>
</div>
</div>
</div>
</div>
);
}

export default Sponsors;
35 changes: 30 additions & 5 deletions devsoc24-portal-fe/src/components/team/createTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>(null);
const { teamData, setTeamData } = useTeamDataStore();
const { idea, setIdea } = useIdeaStore();
const { isLeader, setIsLeader } = useLeaderStore();
const { getIdea, SetIdea } = IdeaStore();

const router = useRouter();

Expand All @@ -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) {
Expand Down Expand Up @@ -65,7 +91,6 @@ function CreateTeam() {
},
);
setTeamData(response.data);
setTeam(true);
} catch (e) {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
Expand Down
32 changes: 25 additions & 7 deletions devsoc24-portal-fe/src/components/team/leaveTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -26,6 +42,7 @@ const LeaveTeam = () => {
},
);
setTeamData(response.data);

} catch (e) {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
Expand All @@ -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 (
<div className="fixed inset-0 flex items-center justify-center backdrop-blur-sm backdrop-filter backdrop-brightness-50 z-[60]">
<div className="fixed inset-0 z-[60] flex items-center justify-center backdrop-blur-sm backdrop-brightness-50 backdrop-filter">
<div className="rounded-lg bg-white p-8">
<button
className="absolute right-0 top-0 p-2 text-gray-500"
Expand Down
5 changes: 3 additions & 2 deletions devsoc24-portal-fe/src/components/track/TrackComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ const tracks = [
];
const TrackComponent = () => {
return (
<div className="trackComponent h-full w-full rounded-xl bg-white px-6 md:w-[32vw] lg:h-[51vh] overflow-auto">
<div className="trackComponent h-full w-full rounded-xl bg-white px-6 md:w-[32vw] lg:h-[57vh] overflow-auto">

<div className="pt-3 font-semibold text-[#45464E]">Track Details</div>
<div className="my-6 flex w-full flex-row md:flex-col items-center gap-6 -z-10 overflow-auto trackComponent">
<div className="my-6 flex w-full flex-row md:flex-col items-center gap-6 -z-10 overflow-auto trackComponent">
{tracks.map((item, index) => (
<Dialog>
<DialogTrigger key={index} className="w-full">
Expand Down
12 changes: 11 additions & 1 deletion devsoc24-portal-fe/src/store/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,14 @@ interface kickStore {
export const showkickStore = create<kickStore>((set) => ({
kickMate: "",
setKickMate: (kickMate: string) => set({ kickMate }),
}));
}));

interface ideaInterface {
getIdea: string;
SetIdea: (idea: string) => void;
}

export const IdeaStore = create<ideaInterface>((set) => ({
getIdea: "",
SetIdea: (getIdea: string) => set({ getIdea }),
}));

0 comments on commit 3c948f6

Please sign in to comment.