Skip to content

Commit 56ffe67

Browse files
anthonyych4nanthonyych4n
and
anthonyych4n
authored
Hmt 126/judging schedule page (#197)
Co-authored-by: anthonyych4n <[email protected]>
1 parent c8a7177 commit 56ffe67

File tree

9 files changed

+250
-83
lines changed

9 files changed

+250
-83
lines changed

amplify/function/BusinessLogic/AssignUsersToTeams/graphql/API.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ export type AddUserToGroupResponse = {
379379
};
380380

381381
export type ScheduleTeamsAndJudgesResponse = {
382-
__typename: "ScheduleTeamsAndJudgesResponse",
383-
body?: string | null,
384-
headers?: string | null,
385-
statusCode?: number | null,
382+
__typename: "ScheduleTeamsAndJudgesResponse";
383+
body?: string | null;
384+
headers?: string | null;
385+
statusCode?: number | null;
386386
};
387387

388388
export type ModelFoodEventConditionInput = {
@@ -1373,19 +1373,19 @@ export type ResetHackathonMutation = {
13731373
};
13741374

13751375
export type ScheduleTeamsAndJudgesMutationVariables = {
1376-
judgingSessionsPerTeam: number,
1377-
numOfJudgingRooms: number,
1378-
presentationDuration: number,
1379-
startDateAndTime: string,
1376+
judgingSessionsPerTeam: number;
1377+
numOfJudgingRooms: number;
1378+
presentationDuration: number;
1379+
startDateAndTime: string;
13801380
};
13811381

13821382
export type ScheduleTeamsAndJudgesMutation = {
1383-
ScheduleTeamsAndJudges?: {
1384-
__typename: "ScheduleTeamsAndJudgesResponse",
1385-
body?: string | null,
1386-
headers?: string | null,
1387-
statusCode?: number | null,
1388-
} | null,
1383+
ScheduleTeamsAndJudges?: {
1384+
__typename: "ScheduleTeamsAndJudgesResponse";
1385+
body?: string | null;
1386+
headers?: string | null;
1387+
statusCode?: number | null;
1388+
} | null;
13891389
};
13901390

13911391
export type SetUserAsCheckedInMutationVariables = {

amplify/function/BusinessLogic/AssignUsersToTeams/graphql/mutations.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export const ResetHackathon = /* GraphQL */ `mutation ResetHackathon(
9393
APITypes.ResetHackathonMutation
9494
>;
9595

96-
export const ScheduleTeamsAndJudges = /* GraphQL */ `mutation ScheduleTeamsAndJudges(
96+
export const ScheduleTeamsAndJudges =
97+
/* GraphQL */ `mutation ScheduleTeamsAndJudges(
9798
$judgingSessionsPerTeam: Int!
9899
$numOfJudgingRooms: Int!
99100
$presentationDuration: Int!
@@ -112,10 +113,11 @@ export const ScheduleTeamsAndJudges = /* GraphQL */ `mutation ScheduleTeamsAndJu
112113
}
113114
}
114115
` as GeneratedMutation<
115-
APITypes.ScheduleTeamsAndJudgesMutationVariables,
116-
APITypes.ScheduleTeamsAndJudgesMutation
117-
>;
118-
export const SetUserAsCheckedIn = /* GraphQL */ `mutation SetUserAsCheckedIn($userId: String!) {
116+
APITypes.ScheduleTeamsAndJudgesMutationVariables,
117+
APITypes.ScheduleTeamsAndJudgesMutation
118+
>;
119+
export const SetUserAsCheckedIn =
120+
/* GraphQL */ `mutation SetUserAsCheckedIn($userId: String!) {
119121
SetUserAsCheckedIn(userId: $userId) {
120122
JUDGE_givenScores {
121123
nextToken

src/app/judging/assigned-teams/page.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { NavBar } from "@/components/judging/Navbar";
2-
31
const AssignedTeamsPage = () => {
42
const assignedTeams = [
53
{ id: 1, name: "Team Alpha" },
@@ -9,7 +7,6 @@ const AssignedTeamsPage = () => {
97

108
return (
119
<div>
12-
<NavBar />
1310
<h1> Put assinged teams here Assigned Teams</h1>
1411
<ul>
1512
{assignedTeams.map((team) => (

src/app/judging/layout.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import NavBar from "@/components/judging/Navbar";
2+
3+
export default function JudgingLayout({
4+
children,
5+
}: {
6+
children: React.ReactNode;
7+
}) {
8+
return (
9+
<div className="flex size-full flex-col bg-dashboard-grey">
10+
<NavBar />
11+
<main className="flex flex-1 flex-col gap-4">{children}</main>
12+
</div>
13+
);
14+
}

src/app/judging/page.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { Metadata } from "next";
22

3-
import { NavBar } from "@/components/judging/Navbar";
4-
53
import JudgingDashboard from "./JudgingDashboard";
64

75
export const dynamic = "force-dynamic";
@@ -22,7 +20,6 @@ export const metadata: Metadata = {
2220
export default function Judging() {
2321
return (
2422
<main className="flex w-full flex-1 flex-col gap-4 bg-dashboard-grey">
25-
<NavBar />
2623
<JudgingDashboard />
2724
</main>
2825
);

src/app/judging/rubric/page.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import { NavBar } from "@/components/judging/Navbar";
2-
31
const RubricPage = () => {
42
return (
53
<div>
6-
<NavBar />
74
<h1>Judging Rubric here</h1>
85
<ul></ul>
96
</div>

src/app/judging/schedule/page.tsx

+6-45
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,9 @@
1-
"use client";
2-
3-
import { useEffect, useState } from "react";
4-
5-
interface Schedule {
6-
teamName: string;
7-
timeSlot: string;
8-
}
9-
10-
const SchedulePage = () => {
11-
const [schedule, setSchedule] = useState<Schedule[]>([]);
12-
13-
useEffect(() => {
14-
// Fetch schedule data from an API or define it statically
15-
// Template for when we will fetch the schedule
16-
const fetchSchedule = async () => {
17-
const response = await fetch("/api/schedule");
18-
const data = await response.json();
19-
setSchedule(data);
20-
};
21-
22-
fetchSchedule();
23-
}, []);
1+
import JudgeSchedule from "@/components/judging/Schedule/schedule";
242

3+
export default function Schedule() {
254
return (
26-
<div>
27-
<h1>Judging Schedule</h1>
28-
<table>
29-
<thead>
30-
<tr>
31-
<th>Team Name</th>
32-
<th>Time Slot</th>
33-
</tr>
34-
</thead>
35-
<tbody>
36-
{schedule.map((item, index) => (
37-
<tr key={index}>
38-
<td>{item.teamName}</td>
39-
<td>{item.timeSlot}</td>
40-
</tr>
41-
))}
42-
</tbody>
43-
</table>
44-
</div>
5+
<main className="size-full">
6+
<JudgeSchedule />
7+
</main>
458
);
46-
};
47-
48-
export default SchedulePage;
9+
}

src/components/judging/Navbar.tsx

+54-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
"use client";
22

33
import Link from "next/link";
4+
import { useState } from "react";
5+
6+
export default function NavBar() {
7+
const [isMenuOpen, setIsMenuOpen] = useState(false);
48

5-
export function NavBar() {
6-
// Will add the actual routes when the pages are
79
const navigation = [
810
{
911
name: "Dashboard",
@@ -23,17 +25,59 @@ export function NavBar() {
2325
},
2426
];
2527

28+
const toggleMenu = () => {
29+
setIsMenuOpen(!isMenuOpen);
30+
};
31+
2632
return (
27-
<nav className="border-b bg-white text-awesomer-purple">
28-
<div className="mx-auto flex h-20 items-center justify-center space-x-48 pl-8">
29-
{navigation.map((item) => {
30-
return (
31-
<Link key={item.name} href={item.href} className="text-2xl">
33+
<>
34+
{!isMenuOpen && (
35+
<button
36+
onClick={toggleMenu}
37+
className="absolute left-8 top-12 z-50 p-2 text-awesomer-purple"
38+
aria-label="Toggle menu"
39+
>
40+
<div className="relative flex size-8 flex-col justify-center space-y-1.5">
41+
<span className="block h-[2.5px] w-8 bg-current"></span>
42+
<span className="block h-[2.5px] w-8 bg-current"></span>
43+
<span className="block h-[2.5px] w-8 bg-current"></span>
44+
</div>
45+
</button>
46+
)}
47+
48+
{isMenuOpen && (
49+
<div className="fixed inset-0 z-40 bg-black/50" onClick={toggleMenu} />
50+
)}
51+
52+
<div
53+
className={`fixed left-0 top-0 z-40 h-full w-64 bg-white shadow-lg transition-transform duration-300 ease-in-out ${
54+
isMenuOpen ? "translate-x-0" : "-translate-x-full"
55+
}`}
56+
>
57+
<button
58+
onClick={toggleMenu}
59+
className="absolute left-4 top-4 z-50 p-2 text-awesomer-purple"
60+
aria-label="Close menu"
61+
>
62+
<div className="relative size-6">
63+
<span className="absolute left-0 top-1/2 h-0.5 w-6 -translate-y-1/2 rotate-45 bg-current"></span>
64+
<span className="absolute left-0 top-1/2 h-0.5 w-6 -translate-y-1/2 -rotate-45 bg-current"></span>
65+
</div>
66+
</button>
67+
68+
<div className="flex flex-col px-4 pt-20">
69+
{navigation.map((item) => (
70+
<Link
71+
key={item.name}
72+
href={item.href}
73+
className="rounded px-2 py-3 text-xl text-awesomer-purple hover:bg-gray-100"
74+
onClick={() => setIsMenuOpen(false)}
75+
>
3276
{item.name}
3377
</Link>
34-
);
35-
})}
78+
))}
79+
</div>
3680
</div>
37-
</nav>
81+
</>
3882
);
3983
}

0 commit comments

Comments
 (0)