File tree Expand file tree Collapse file tree 5 files changed +128
-0
lines changed
Expand file tree Collapse file tree 5 files changed +128
-0
lines changed Original file line number Diff line number Diff line change 1+ "use client" ;
2+ import Link from "next/link" ;
3+ import { useState } from "react" ;
4+ import * as z from "zod" ;
5+ import { default as PartyRegistrationForm , default as partyFormSchema } from "../../components/PartyRegistrationForm" ;
6+
7+ export default function RegistrationForm ( ) {
8+ type partyFormValues = z . infer < typeof partyFormSchema > ;
9+ const [ data , setData ] = useState < partyFormValues | null > ( null ) ;
10+ const handleSubmit = async ( values : partyFormValues ) => {
11+ try {
12+ const res = await fetch ( "http://localhost:8000/party/" , {
13+ method : "POST" ,
14+ headers : {
15+ "Content-Type" : "application/json" ,
16+ } ,
17+ // credentials: "include",
18+ body : JSON . stringify ( values ) ,
19+ } ) ;
20+
21+ if ( ! res . ok ) {
22+ console . error ( "Failed to create a party" ) ;
23+ return ;
24+ }
25+
26+ const createdParty = await res . json ( ) ;
27+ console . log ( "Party created:" , createdParty ) ;
28+
29+ } catch ( error ) {
30+ console . error ( "Error submitting form:" , error ) ;
31+ }
32+ } ;
33+
34+ return (
35+ < div className = "px-128 py-8" >
36+ < Link href = "/StudentDashboard" >
37+ Back
38+ </ Link >
39+ < div className = "font-bold pb-4" > Off Campus Student Life Party Registration Form</ div >
40+ < PartyRegistrationForm onSubmit = { handleSubmit } />
41+ </ div >
42+ ) ;
43+ }
Original file line number Diff line number Diff line change 1+ import RegistrationTracker from "@/components/RegistrationTracker" ;
2+ import StatusComponent from "@/components/StatusComponent" ;
3+ import { PARTIES } from "@/lib/mockData" ;
4+ import Link from "next/link" ;
5+ export default function StudentDashboard ( ) {
6+ return (
7+ < div className = "px-20 py-2 flex flex-col gap-8 max-w-4xl mx-auto" >
8+ < div className = "font-semibold text-2xl" > Events</ div >
9+ < Link href = "/RegistrationForm" >
10+ < button className = "px-4 py-2 rounded-lg bg-black text-white" >
11+ Registration Form
12+ </ button >
13+ </ Link >
14+ < RegistrationTracker parties = { PARTIES . filter ( party => party . contactOne . id === 4 ) } />
15+ < div > Party Smart Course </ div >
16+ < StatusComponent completion_date = { null } expiration_date = { null } />
17+ </ div >
18+ ) ;
19+ }
Original file line number Diff line number Diff line change 1+ import alertTriangleIcon from "@/components/icons/alert-triangle.svg" ;
2+ import checkIcon from "@/components/icons/check-circle.svg" ;
3+ import { Card , CardContent } from "@/components/ui/card" ;
4+ import Image from "next/image" ;
5+
6+ type CompletionCardProps = {
7+ completion_date : string | null ;
8+ expiration_date : string | null ;
9+ } ;
10+
11+ export default function StatusComponent ( { completion_date, expiration_date } : CompletionCardProps ) {
12+ const isCompleted = completion_date && expiration_date ;
13+
14+ return (
15+ < Card className = "p-4 rounded-2xl shadow-sm w-full bg-white" >
16+ < CardContent className = "p-0 flex flex-col gap-1 text-sm" >
17+
18+ { isCompleted ? (
19+ < >
20+ < div className = "flex items-center gap-2 text-gray-800" >
21+ < Image src = { checkIcon } alt = "check icon" />
22+ < span >
23+ Completed on < strong > { completion_date } </ strong >
24+ </ span >
25+ </ div >
26+
27+ < div className = "italic text-[#09294E]" >
28+ Expires { expiration_date }
29+ </ div >
30+
31+ </ >
32+ ) : (
33+ < div >
34+ < div className = "flex items-center gap-2 text-gray-800" >
35+ < Image src = { alertTriangleIcon } alt = "alert icon" />
36+ < span >
37+ Course not completed
38+ </ span >
39+ </ div >
40+ < a href = "#" className = "text-blue-600 underline text-sm" >
41+ Schedule a meeting
42+ </ a >
43+ </ div >
44+ ) }
45+
46+ </ CardContent >
47+ </ Card >
48+ ) ;
49+ }
50+
You can’t perform that action at this time.
0 commit comments