Skip to content

Commit

Permalink
Merge pull request #13 from NishantGupt786/master
Browse files Browse the repository at this point in the history
FAT PR
  • Loading branch information
NishantGupt786 committed Mar 9, 2024
2 parents 4a3016c + e7d760f commit c4a28b9
Show file tree
Hide file tree
Showing 9 changed files with 950 additions and 747 deletions.
518 changes: 292 additions & 226 deletions devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx

Large diffs are not rendered by default.

47 changes: 26 additions & 21 deletions devsoc24-portal-fe/src/app/edit-idea/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
"use client"

"use client";
import Image from "next/image";
import Logo from "@/components/logo";
import Dashtitle from "@/assets/images/titleDashboard.svg";
import active from "@/assets/images/active.svg"
import { ToastContainer, toast } from "react-toastify";
import { ArrowLeft } from "lucide-react";
import Link from "next/link";
import EditIdeaForm from "./edit-idea-form";

export default function Page() {
return (
<main className="flex min-[931px]:min-h-screen flex-col min-[931px]:h-[100vh] h-[200%] items-start bg-[#F4F5FA] overflow-x-hidden">
<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] max-[445px]:w-[3.7rem] items-start justify-center gap-x-8 bg-background px-6 py-2 pt-12">
<Image src={active as HTMLImageElement} alt="title" className="scale-150 max-[445px]:scale-[3.5]" />
</div>
<div className="mt-[11vh] ml-[4.7rem] max-[445px]:ml-[3.7rem] absolute pt-5 pl-5 bg-[#F4F5FA] w-[91.9vw] flex flex-col max-[931px]:justify-center ">
<p className="text-black text-4xl font-medium mb-4">Edit Your Idea For Devsoc24</p>
<EditIdeaForm />
</div>


</main>
)
}
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">
Idea Submission For Devsoc24
</p>
<EditIdeaForm />
</div>
</main>
</>
);
}
41 changes: 35 additions & 6 deletions devsoc24-portal-fe/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,52 @@
"use client";
import { ThemeProvider } from "@/components/theme-provider";
import "@/styles/globals.css";
import { Poppins } from "next/font/google";
import { useEffect } from "react";
import axios from "axios";

const inter = Poppins({
subsets: ["latin"],
weight: "200",
});

export const metadata = {
title: "Create T3 App",
description: "Generated by create-t3-app",
icons: [{ rel: "icon", url: "/favicon.ico" }],
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
useEffect(() => {
const refresh = async () => {
try {
const response = await axios.post(
`${process.env.NEXT_PUBLIC_API_URL}/refresh`,
{
nallaData: "",
},
{
withCredentials: true,
},
);
} catch (e) {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
case 401:
try {
await refresh();
} catch (e) {
console.log("REFESH: ", e);
}
default:
console.log(e);
}
}
}
};
setInterval(() => {
void refresh();
}, 270000);
}, []);

return (
<html lang="en">
<body className={`font-sans ${inter.className}`}>
Expand Down
33 changes: 24 additions & 9 deletions devsoc24-portal-fe/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";
import Image from "next/image";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import Logo from "@/components/logo";
import Dashtitle from "@/assets/images/titleDashboard.svg";
import CustomCard from "@/components/customCard";
Expand Down Expand Up @@ -50,11 +50,12 @@ interface teamProps {
}

export default function HomePage() {
const router = useRouter();
const { idea, setIdea } = useIdeaStore();
const { team, setTeam } = useTeamStore();
const { user, setUser } = useUserStore();
const [getIdea, SetIdea] = useState("");
const { teamData, setTeamData } = useTeamDataStore();


const handleLogout = async () => {
const toastId = toast.loading("Loading...", { autoClose: false });
Expand All @@ -81,7 +82,7 @@ export default function HomePage() {
isLoading: false,
autoClose: 2000,
});
router.push("/login");
void router.push("/login");
} catch (e) {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
Expand Down Expand Up @@ -110,7 +111,7 @@ export default function HomePage() {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
case 401:
router.push("/login");
void router.push("/login");
break;
case 404:
console.log("Idea Not found, but in a team");
Expand Down Expand Up @@ -140,7 +141,7 @@ export default function HomePage() {
if (axios.isAxiosError(e)) {
switch (e.response?.status) {
case 401:
router.push("/login");
void router.push("/login");
break;
case 417:
setTeam(true);
Expand All @@ -151,6 +152,7 @@ export default function HomePage() {
break;
default:
console.log(e);
SetIdea("idea found");
break;
}
}
Expand Down Expand Up @@ -202,7 +204,7 @@ export default function HomePage() {
} else {
void fetchTeam();
}
}, [user]);
}, []);

const noTeamCard = [
{
Expand All @@ -219,12 +221,25 @@ export default function HomePage() {
const ideaCard = [
{
text: "Submit An Idea",
showModal: true,
showModal: false,
modalType: idea === 409 ? "Choice" : "JoinTeam",
routeTo: "/submit-idea",
},
{
text: "Edit idea",
showModal: false,
modalType: "EditIdea",
routeTo: "/edit-idea",
},
];
const ideaTherecard = [
{
text: "Submit An Idea",
showModal: false,
modalType: idea === 409 ? "Choice" : "JoinTeam",
routeTo: "/submit-idea",
},
];
const router = useRouter();

return (
<>
Expand Down Expand Up @@ -280,7 +295,7 @@ export default function HomePage() {
cardImage="ideaSubmissionImg"
cardContent="No Idea Submitted yet"
cardDesc="Submit Your Idea Before < date > <div time >"
buttonDetails={ideaCard}
buttonDetails={getIdea === "idea found" ? ideaTherecard : ideaCard}
/>
<TrackComponent />
</div>
Expand Down
44 changes: 25 additions & 19 deletions devsoc24-portal-fe/src/app/submit-idea/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
"use client"
"use client";

import Image from "next/image";
import Logo from "@/components/logo";
import Dashtitle from "@/assets/images/titleDashboard.svg";
import active from "@/assets/images/active.svg"
import { ToastContainer, toast } from "react-toastify";
import SubmitIdeaForm from "./submit-idea-form";
import { ArrowLeft } from 'lucide-react';
import { ArrowLeft } from "lucide-react";
import Link from "next/link";

export default function Page() {
return (
<main className="flex min-[931px]:min-h-screen flex-col min-[931px]:h-[100vh] h-[200%] items-start bg-[#F4F5FA] overflow-x-hidden">
<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] max-[445px]:w-[3.7rem] items-start justify-center gap-x-8 bg-background px-6 py-2 pt-12">
<Link href="/"><ArrowLeft className="text-[#0019FF]" /></Link>
</div>
<div className="mt-[11vh] ml-[4.7rem] max-[445px]:ml-[3.7rem] absolute pt-5 pl-5 bg-[#F4F5FA] w-[91.9vw] flex flex-col max-[931px]:justify-center ">
<p className="text-black text-4xl font-medium mb-4">Submit An Idea For Devsoc24</p>
<SubmitIdeaForm />
</div>
</main>
)
}
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">
Idea Submission For Devsoc24
</p>
<SubmitIdeaForm />
</div>
</main>
</>
);
}
Loading

0 comments on commit c4a28b9

Please sign in to comment.