Skip to content

Commit

Permalink
Merge pull request #17 from NishantGupt786/master
Browse files Browse the repository at this point in the history
ahh
  • Loading branch information
NishantGupt786 committed Mar 10, 2024
2 parents aa133db + cc4a7af commit 96d5c7c
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 40 deletions.
54 changes: 40 additions & 14 deletions devsoc24-portal-fe/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
import { Button } from "@/components/ui/button";
import { User } from "lucide-react";
import ToastContainer from "@/components/ToastContainer";
import Link from "next/link";

interface ideaProps {
message: string;
Expand Down Expand Up @@ -58,6 +59,7 @@ export default function HomePage() {
const { user, setUser } = useUserStore();
const [getIdea, SetIdea] = useState("");
const { teamData, setTeamData } = useTeamDataStore();
const [isLeader, setIsLeader] = useState(false);

const logout = async () => {
try {
Expand Down Expand Up @@ -114,7 +116,6 @@ export default function HomePage() {
console.log("Idea Not found, but in a team");
break;
case 409:
setIdea(409);
console.log("Not in team");
break;
default:
Expand Down Expand Up @@ -163,6 +164,7 @@ export default function HomePage() {
withCredentials: true,
},
);
SetIdea("idea found");
console.log("FETCH IDEA: ", response);
} catch (e) {
if (axios.isAxiosError(e)) {
Expand All @@ -176,6 +178,8 @@ export default function HomePage() {
case 417:
console.log("team no idea");
break;
case 409:
setIdea(409);
default:
console.log(e);
break;
Expand All @@ -200,6 +204,9 @@ export default function HomePage() {
} else {
void fetchTeam();
}
if (user.data.id === teamData.team?.leader_id) {
setIsLeader(true);
}
}, []);

const noTeamCard = [
Expand All @@ -214,12 +221,11 @@ export default function HomePage() {
modalType: "JoinTeam",
},
];
const ideaCard = [
const ideaTherecard = [
{
text: "Submit An Idea",
showModal: false,
modalType: idea === 409 ? "Choice" : "JoinTeam",
routeTo: "/submit-idea",
text: "View Idea",
showModal: true,
modalType: "IdeaSubmit",
},
{
text: "Edit idea",
Expand All @@ -228,15 +234,23 @@ export default function HomePage() {
routeTo: "/edit-idea",
},
];
const ideaTherecard = [
const ideaCard = [
{
text: "Submit An Idea",
showModal: false,
showModal: true,
modalType: idea === 409 ? "Choice" : "JoinTeam",
routeTo: "/submit-idea",
},
];

const notLeader = [
{
text: "View Idea",
showModal: true,
modalType: "IdeaSubmit",
},
];

return (
<>
<ToastContainer />
Expand All @@ -258,9 +272,11 @@ export default function HomePage() {
</div>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel className="cursor-pointer">
Profile
</DropdownMenuLabel>
<Link href="/profile">
<DropdownMenuLabel className="cursor-pointer">
Profile
</DropdownMenuLabel>
</Link>
<DropdownMenuSeparator />
<DropdownMenuLabel
className="cursor-pointer text-red-500"
Expand All @@ -286,9 +302,19 @@ export default function HomePage() {
<CustomCard
title="Idea Submission"
cardImage="ideaSubmissionImg"
cardContent="No Idea Submitted yet"
cardDesc="Submit Your Idea Before < date > <div time >"
buttonDetails={getIdea === "idea found" ? ideaTherecard : ideaCard}
cardContent={
getIdea === "idea found" ? "Idea Submitted" : "No Idea Yet"
}
cardDesc={
getIdea === "idea found" ? "Edit or View Idea" : "Submit an Idea"
}
buttonDetails={
getIdea === "idea found"
? isLeader
? ideaTherecard
: notLeader
: ideaCard
}
/>
<TrackComponent />
</div>
Expand Down
32 changes: 32 additions & 0 deletions devsoc24-portal-fe/src/app/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use client";
import Image from "next/image";
import Logo from "@/components/logo";
import Dashtitle from "@/assets/images/titleDashboard.svg";
import toast, { Toaster } from 'react-hot-toast';
import Profile from "./profile-form";
import { ArrowLeft } from "lucide-react";
import Link from "next/link";

export default function Page() {
return (
<>
<main className="flex h-[200%] flex-col items-start overflow-x-hidden bg-[#F4F5FA] min-[931px]:h-[100vh] min-[931px]:min-h-screen">
<div className="flex h-[10%] w-full items-center gap-x-8 bg-background px-3 py-2">
<Logo className="h-9/10 w-auto" />
<Image src={Dashtitle as HTMLImageElement} alt="title" />
</div>
<div className="flex h-[100vh] w-[4.7rem] items-start justify-center gap-x-8 bg-background px-6 py-2 pt-12 max-[445px]:w-[3.7rem]">
<Link href="/">
<ArrowLeft className="text-[#0019FF]" />
</Link>
</div>
<div className="absolute ml-[4.7rem] mt-[11vh] flex w-[91.9vw] flex-col bg-[#F4F5FA] pl-5 pt-5 max-[931px]:justify-center max-[445px]:ml-[3.7rem] ">
<p className="mb-4 text-4xl font-medium text-black">
Profile Settings
</p>
<Profile />
</div>
</main>
</>
);
}
Loading

0 comments on commit 96d5c7c

Please sign in to comment.