-
Notifications
You must be signed in to change notification settings - Fork 14
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 #17 from Pradeep-Kumar-Rebbavarapu/main
Added Events , Add and Delete in the Job Page and Made the Get Request for All Students
- Loading branch information
Showing
10 changed files
with
337 additions
and
74 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,95 @@ | ||
'use client' | ||
import { Button } from "@/components/ui/button" | ||
import Cookies from "js-cookie" | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from "@/components/ui/dialog" | ||
import { Input } from "@/components/ui/input" | ||
import { Label } from "@/components/ui/label" | ||
import axios from "axios" | ||
import { useState } from "react" | ||
import submit from "../action" | ||
|
||
|
||
interface Props{ | ||
jobId : String | ||
} | ||
|
||
export function AddEventDialog({jobId}:Props) { | ||
const [type,settype] = useState<string | null>(null); | ||
const [round,setround] = useState<string | null>(null); | ||
const [date,setdate] = useState<string | null>(null); | ||
const [loading,setloading] = useState<boolean>(false); | ||
return ( | ||
<div className="mx-2"> | ||
<Dialog > | ||
<DialogTrigger asChild> | ||
<Button >Add Event</Button> | ||
</DialogTrigger> | ||
<DialogContent className="sm:max-w-[425px]"> | ||
<DialogHeader> | ||
<DialogTitle className="text-black">Add An Event</DialogTitle> | ||
</DialogHeader> | ||
<div className="grid gap-4 py-4"> | ||
<div className="grid grid-cols-4 items-center gap-4"> | ||
<Label htmlFor="name" className="text-right text-black"> | ||
Event Type | ||
</Label> | ||
<Input | ||
id="name" | ||
onChange={(e)=>{ | ||
settype(e?.target?.value) | ||
}} | ||
className="col-span-3 text-black" | ||
/> | ||
</div> | ||
<div className="grid grid-cols-4 items-center gap-4"> | ||
<Label htmlFor="username" className="text-right w-full text-black"> | ||
Round | ||
</Label> | ||
<Input | ||
id="username" | ||
className="col-span-3 text-black" | ||
onChange={(e)=>{ | ||
setround(e?.target?.value) | ||
}} | ||
/> | ||
</div> | ||
<div className="grid grid-cols-4 items-center gap-4"> | ||
<Label htmlFor="username" className="text-right w-full text-black"> | ||
Start Date and Time | ||
</Label> | ||
<Input | ||
id="username" | ||
type="datetime-local" | ||
onChange={(e)=>{ | ||
setdate(e?.target?.value) | ||
}} | ||
className="col-span-3 text-black" | ||
/> | ||
</div> | ||
</div> | ||
<DialogFooter> | ||
<Button type="submit" disabled={loading} onClick={async ()=>{ | ||
setloading(true) | ||
await axios.post(`http://tpc.iiti.ac.in/api/v1/jobs/${jobId}/events`,{type:type,roundNumber:round,startDateTime:date},{ | ||
headers:{ | ||
Authorization:`Bearer ${Cookies.get('accessToken')}` | ||
} | ||
}).then((response)=>{ | ||
submit('AllEvents'); | ||
setloading(false) | ||
}) | ||
}}>{loading?"Submitting...":"Save changes"}</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
</div> | ||
) | ||
} |
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,94 @@ | ||
'use client' | ||
import { MdDelete } from "react-icons/md"; | ||
import { JobDeleteModal } from "./JobDeleteModal"; | ||
export default function EventCard({ ele ,jobId}: any) { | ||
var date = ele.startDateTime; | ||
date = date.substring(0, 10).split('-') | ||
date = date[1] + '-' + date[2] + '-' + date[0] | ||
return ( | ||
<div> | ||
<div className="card"> | ||
<h3 className="card__title">{ele?.type} | ||
</h3> | ||
<p className="card__content">Round Number : {ele?.roundNumber} </p> | ||
|
||
<div className="card__date"> | ||
{date} | ||
</div> | ||
|
||
<div className="card__arrow"> | ||
<JobDeleteModal jobId={jobId} eventId={ele.id} /> | ||
</div> | ||
|
||
</div> | ||
<style jsx> | ||
{` | ||
/* this card is inspired form this - https://georgefrancis.dev/ */ | ||
.card { | ||
--border-radius: 0.75rem; | ||
--primary-color: #7257fa; | ||
--secondary-color: #3c3852; | ||
width: 210px; | ||
font-family: "Arial"; | ||
padding: 1rem; | ||
cursor: pointer; | ||
border-radius: var(--border-radius); | ||
background: #f1f1f3; | ||
box-shadow: 0px 8px 16px 0px rgb(0 0 0 / 3%); | ||
position: relative; | ||
} | ||
.card > * + * { | ||
margin-top: 1.1em; | ||
} | ||
.card .card__content { | ||
color: var(--secondary-color); | ||
font-size: 0.86rem; | ||
} | ||
.card .card__title { | ||
padding: 0; | ||
font-size: 1.3rem; | ||
font-weight: bold; | ||
} | ||
.card .card__date { | ||
color: #6e6b80; | ||
font-size: 0.8rem; | ||
} | ||
.card .card__arrow { | ||
position: absolute; | ||
background: var(--primary-color); | ||
padding: 0.4rem; | ||
border-top-left-radius: var(--border-radius); | ||
border-bottom-right-radius: var(--border-radius); | ||
bottom: 0; | ||
right: 0; | ||
transition: 0.2s; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
.card svg { | ||
transition: 0.2s; | ||
} | ||
/* hover */ | ||
.card:hover .card__arrow { | ||
background: #111; | ||
} | ||
.card:hover .card__arrow svg { | ||
transform: translateX(3px); | ||
} | ||
`} | ||
</style> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.
46ecab0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
tpc-frontend – ./
tpc-frontend-tpc-frontend.vercel.app
tpc-frontend-delta.vercel.app
tpc-frontend-git-main-tpc-frontend.vercel.app