generated from CodeChefVIT/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from NishantGupt786/master
pr
- Loading branch information
Showing
10 changed files
with
189 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
"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 active from "@/assets/images/active.svg"; | ||
import SubmitProjectForm from "./submit-project-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">Project Submission For Devsoc24</p> | ||
<SubmitProjectForm /> | ||
</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="/home"> | ||
<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"> | ||
Project Submission For Devsoc24 | ||
</p> | ||
<SubmitProjectForm /> | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import { | ||
Dialog, | ||
DialogClose, | ||
DialogContent, | ||
DialogTitle, | ||
} from "@radix-ui/react-dialog"; | ||
import { Label } from "@radix-ui/react-label"; | ||
import React, { useState } from "react"; | ||
import { Button } from "../ui/button"; | ||
import { DialogHeader, DialogFooter } from "../ui/dialog"; | ||
import { type APIResponse } from "@/schemas/api"; | ||
import { | ||
useTeamStore, | ||
useUserStore, | ||
useIdeaStore, | ||
useTeamEditStore, | ||
useLeaderStore, | ||
showModalStore, | ||
showkickStore, | ||
useTeamDataStore, | ||
} from "@/store/store"; | ||
import axios from "axios"; | ||
import toast from "react-hot-toast"; | ||
import { userProps } from "@/interfaces"; | ||
import router from "next/navigation"; | ||
import { useRouter } from "next/navigation"; | ||
|
||
const Kick = () => { | ||
const { team, setTeam } = useTeamStore(); | ||
const { showModal, setShowModal } = showModalStore(); | ||
const { kickMate, setKickMate } = showkickStore(); | ||
const { teamData, setTeamData } = useTeamDataStore(); | ||
|
||
const router = useRouter(); | ||
|
||
const fetchTeam = async () => { | ||
try { | ||
console.log("fetch team"); | ||
const response = await axios.get<APIResponse>( | ||
`${process.env.NEXT_PUBLIC_API_URL}/team`, | ||
{ | ||
withCredentials: true, | ||
}, | ||
); | ||
setTeamData(response.data); | ||
} catch (e) { | ||
if (axios.isAxiosError(e)) { | ||
switch (e.response?.status) { | ||
case 401: | ||
void router.push("/"); | ||
break; | ||
case 404: | ||
console.log("Idea Not found, but in a team"); | ||
break; | ||
case 409: | ||
console.log("Not in team"); | ||
break; | ||
default: | ||
console.log(e); | ||
break; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
const leaveTeam = async () => { | ||
const handleClick = async () => { | ||
await axios.post( | ||
`${process.env.NEXT_PUBLIC_API_URL}/team/kick`, | ||
{ id: kickMate }, | ||
{ | ||
withCredentials: true, | ||
}, | ||
); | ||
setShowModal(""); | ||
}; | ||
|
||
await toast.promise(handleClick(), { | ||
loading: "Loading...", | ||
success: (temp) => { | ||
return `Accepted`; | ||
}, | ||
error: `Something went wrong`, | ||
}); | ||
await fetchTeam(); | ||
}; | ||
|
||
return ( | ||
<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" | ||
onClick={() => setShowModal("")} | ||
> | ||
<svg | ||
className="h-6 w-6" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
stroke="currentColor" | ||
> | ||
<path | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
strokeWidth="2" | ||
d="M6 18L18 6M6 6l12 12" | ||
/> | ||
</svg> | ||
</button> | ||
<h2 className="text-xl font-semibold text-gray-800"> | ||
Are you sure you want to kick your team mate? | ||
</h2> | ||
<div className="mt-4 flex justify-center"> | ||
<button | ||
onClick={leaveTeam} | ||
className="mr-4 rounded-md bg-[#458B71] px-4 py-2 text-white" | ||
> | ||
Yes | ||
</button> | ||
<button | ||
onClick={() => setShowModal("")} | ||
className="rounded-md bg-[#458B71] px-4 py-2 text-white" | ||
> | ||
No | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Kick; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters