+
{eventName} {" " + eventYear}
-
+
{eventBlurb}
diff --git a/src/components/LandingPage/JudgingCriteria.tsx b/src/components/LandingPage/JudgingCriteria.tsx
index 4029a87..4f56c9d 100644
--- a/src/components/LandingPage/JudgingCriteria.tsx
+++ b/src/components/LandingPage/JudgingCriteria.tsx
@@ -1,10 +1,10 @@
import Image from "next/image";
const judgingCriteriaStyles =
- "relative flex -mt-5 justify-between bg-[#BAFBE4] py-20 px-10 md:px-24 lg:px-40 drop-shadow-lg md:drop-shadow-none";
+ "relative flex -mt-5 justify-between bg-[#BAFBE4] py-20 px-[5%] md:px-24 lg:px-40 drop-shadow-lg md:drop-shadow-none";
const itemStyles =
- "flex justify-start p-4 lg:px-10 lg:text-[1.0rem] items-start";
+ "flex justify-start p-4 lg:px-6 lg:text-[1.0rem] items-start";
const checkMarkSvg = "/svgs/landingPage/check_mark_bkg.svg";
diff --git a/src/components/UserProfile/TeamForm.tsx b/src/components/UserProfile/TeamForm.tsx
index c35fdfc..56c3b55 100644
--- a/src/components/UserProfile/TeamForm.tsx
+++ b/src/components/UserProfile/TeamForm.tsx
@@ -1,4 +1,9 @@
+"use client";
+
+import { generateClient } from "aws-amplify/api";
+
import { type Schema } from "@/amplify/data/resource";
+import { useQuery } from "@tanstack/react-query";
const INPUT_STYLES =
"rounded-full border-4 placeholder-black border-white bg-[#FFFFFF] bg-white/30 ps-3 py-2 my-2 text-sm md:text-md backdrop-opacity-30";
@@ -17,7 +22,23 @@ export default function TeamForm({ data, teamMutation }: TeamFormProp) {
teamMutation.mutate(data);
};
+ const client = generateClient();
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const { data: teamData, isFetching } = useQuery({
+ initialData: null,
+ initialDataUpdatedAt: 0,
+ queryKey: ["TeamWithMembers"],
+ queryFn: async () => {
+ const { data: teamWithMembers } = await client.models.Team.get(
+ { id: data.id },
+ { selectionSet: ["id", "members.*"] },
+ );
+
+ return teamWithMembers;
+ },
+ enabled: !!data,
+ });
return (
<>
@@ -40,16 +61,24 @@ export default function TeamForm({ data, teamMutation }: TeamFormProp) {
/>
- {Array.isArray(data.members) &&
- data.members.map((member: Schema["User"]["type"]) => (
-
- ))}
+ {isFetching ? (
+ Loading...
+ ) : (
+ <>
+ {Array.isArray(teamData?.members) &&
+ teamData?.members.map(
+ (member: Partial) => (
+
+ ),
+ )}
+ >
+ )}
diff --git a/src/components/UserProfile/TeamProfile.tsx b/src/components/UserProfile/TeamProfile.tsx
index 36c10e2..a50544d 100644
--- a/src/components/UserProfile/TeamProfile.tsx
+++ b/src/components/UserProfile/TeamProfile.tsx
@@ -16,25 +16,13 @@ const TEAM_INSTRUCTION_STYLES =
const TeamProfile = () => {
const queryClient = useQueryClient();
- const userId = useUser().currentUser.username as string;
+ const userTeamId = useUser().currentUser.teamId as string;
const { data, isFetching } = useQuery({
initialData: {} as Schema["Team"]["type"],
initialDataUpdatedAt: 0,
- queryKey: ["Team", userId],
+ queryKey: ["Team", userTeamId],
queryFn: async () => {
- const userResponse = await client.models.User.get({
- id: userId,
- });
-
- if (userResponse.errors) throw new Error(userResponse.errors[0].message);
-
- const userTeamId = userResponse.data?.teamId as string;
-
- if (!userTeamId) {
- return {} as Schema["Team"]["type"];
- }
-
const teamResponse = await client.models.Team.get({
id: userTeamId,
});
@@ -43,12 +31,13 @@ const TeamProfile = () => {
return teamResponse.data;
},
+ enabled: !!userTeamId,
});
const teamMutation = useMutation({
mutationFn: async () => {
try {
- await client.models.User.update({ id: userId, teamId: null });
+ await client.models.User.update({ id: userTeamId, teamId: null });
} catch (error) {
console.error("Error updating ids", error);
throw error;
@@ -56,14 +45,14 @@ const TeamProfile = () => {
},
onSuccess: () => {
queryClient.invalidateQueries({
- queryKey: ["Team", userId],
+ queryKey: ["Team", userTeamId],
});
},
});
return (
<>
- {isFetching ? (
+ {isFetching || !userTeamId ? (
diff --git a/src/components/admin/Judging/JudgingTimeline.tsx b/src/components/admin/Judging/JudgingTimeline.tsx
index 58d156d..7bd8f22 100644
--- a/src/components/admin/Judging/JudgingTimeline.tsx
+++ b/src/components/admin/Judging/JudgingTimeline.tsx
@@ -41,9 +41,9 @@ export default function JudgingTimeline({
colorField: "color",
}}
day={{
- startHour: 15, // will have to be edited when we know what times to capture
- endHour: 18,
- step: 15,
+ startHour: 12, // will have to be edited when we know what times to capture
+ endHour: 17,
+ step: 10,
}}
deletable={false}
viewerExtraComponent={(fields, event) => {
diff --git a/src/components/contexts/UserContext.tsx b/src/components/contexts/UserContext.tsx
index 6d3d0c4..19e5459 100644
--- a/src/components/contexts/UserContext.tsx
+++ b/src/components/contexts/UserContext.tsx
@@ -96,6 +96,7 @@ export function UserContextProvider({ children }: Props) {
populated: true,
completedProfile: response.data?.completedRegistration ?? false,
email: response.data?.email ?? "",
+ teamId: response.data?.teamId ?? "",
firstName: response.data?.firstName ?? "",
lastName: response.data?.lastName ?? "",
JUDGE_roomId: response.data?.JUDGE_roomId,
diff --git a/src/components/judging/ScoresTable.tsx b/src/components/judging/ScoresTable.tsx
index d0ea94a..fc046b3 100644
--- a/src/components/judging/ScoresTable.tsx
+++ b/src/components/judging/ScoresTable.tsx
@@ -1,22 +1,18 @@
import { generateClient } from "aws-amplify/api";
import Image from "next/image";
import { useState } from "react";
+import { twMerge } from "tailwind-merge";
import { type Schema } from "@/amplify/data/resource";
import { useQuery } from "@tanstack/react-query";
+import Card from "../Dashboard/Card";
import { useUser } from "../contexts/UserContext";
import { type ScoreObject } from "./ModalPopup";
const edit_icon = "/svgs/judging/edit_icon.svg";
const filter_icon = "/svgs/judging/filter_arrows.svg";
-const JUDGE_TABLE_SECTION_STYLES =
- "h-full rounded-lg bg-white p-6 drop-shadow-md";
-
-const JUDGE_TABLE_CONTENT_STYLES =
- "w-full border-separate border-spacing-x-0.5";
-const JUDGE_TABLE_HEADER_CELL_STLYES = "text-white text-xl font-medium py-4";
const JUDGE_TABLE_CELL_STYLES = "text-center text-lg py-4";
const SCORE_BUTTON_STYLES =
"rounded-full border-2 px-2 py-1 text-sm font-medium";
@@ -39,33 +35,50 @@ const COLOR_SCHEMES = {
const client = generateClient();
interface JudgingTableProps {
- tableHeaders: Array<{
- columnHeader: string | JSX.Element;
- className: string;
- }>;
tableData: Schema["Team"]["type"][];
onCreateScoreClick: (teamName: string) => void;
onEditScoreClick: (teamName: string) => void;
colorScheme: "pink" | "purple";
entriesPerPage: number;
+ hackathonData: Pick<
+ Schema["Hackathon"]["type"],
+ "scoringComponents" | "scoringSidepots"
+ >;
}
-const JudgingTable = (props: JudgingTableProps) => {
+export default function JudgingTable(props: JudgingTableProps) {
const { currentUser } = useUser();
const {
- tableHeaders,
tableData,
onCreateScoreClick,
onEditScoreClick,
colorScheme,
entriesPerPage,
+ hackathonData,
} = props;
+
const [currentPage, setCurrentPage] = useState(1);
const [sortedData, setSortedData] = useState(tableData);
const [sortDirection, setSortDirection] = useState<"asc" | "desc">("asc");
const entries_per_page = entriesPerPage;
+ const tableHeaders = [
+ { columnHeader: "Team Name", className: "px-6 rounded-tl-lg" },
+ ...hackathonData.scoringComponents.map((component) => ({
+ columnHeader: component.friendlyName,
+ className: "w-fit",
+ })),
+ ...hackathonData.scoringSidepots.map((component) => ({
+ columnHeader: (
+
+ Sidepot:
+ {component.friendlyName}
+
+ ),
+ className: "w-fit bg-pastel-pink",
+ })),
+ ];
const handleNextPage = () => {
setCurrentPage((prevPage) =>
Math.min(prevPage + 1, Math.ceil(tableData.length / entries_per_page)),
@@ -101,22 +114,26 @@ const JudgingTable = (props: JudgingTableProps) => {
const colorStyles = COLOR_SCHEMES[colorScheme];
return (
-
-
-
+
+
+
{tableHeaders.map((header, index) => (
{header.columnHeader}
))}
+ className={` rounded-tr-lg p-12 ${colorStyles.headerCellBg}`}
+ />
@@ -130,7 +147,6 @@ const JudgingTable = (props: JudgingTableProps) => {
teamId: team.id,
});
if (errors) throw Error(errors[0].message);
- console.log(data);
return data;
} catch (error) {
console.error(error);
@@ -187,44 +203,36 @@ const JudgingTable = (props: JudgingTableProps) => {
})}
-
-
+
+
+
+
+
-
-
-
-
-
+
);
-};
-
-export default JudgingTable;
+}
diff --git a/src/components/judging/StatsPanel.tsx b/src/components/judging/StatsPanel.tsx
index 6fbfba8..95786b5 100644
--- a/src/components/judging/StatsPanel.tsx
+++ b/src/components/judging/StatsPanel.tsx
@@ -1,11 +1,6 @@
import Image from "next/image";
-const STATS_PANEL_TILE_STYLES =
- "flex h-full flex-col items-center justify-center rounded-lg bg-white px-6 py-8 drop-shadow-md";
-const STATS_PANEL_ICON_CONTAINER_STYLES =
- "flex size-12 items-center justify-center rounded-full bg-pastel-pink";
-const STATS_PANEL_NUMBER_STYLES = "my-2 text-5xl font-semibold";
-const STATS_PANEL_SUBHEADER_STYLES = "max-w-[150px] text-center";
+import Card from "../Dashboard/Card";
interface StatsPanelProps {
icon: string;
@@ -18,15 +13,19 @@ const StatsPanel = (props: StatsPanelProps) => {
const { icon, stat, alt, subheader } = props;
return (
-
-
+
+
-
+
{stat}
-
{subheader}
-
+ {subheader}
+
);
};
Loading...
+ ) : ( + <> + {Array.isArray(teamData?.members) && + teamData?.members.map( + (member: PartialSidepot:
+ {component.friendlyName} +{header.columnHeader} | ))}+ className={` rounded-tr-lg p-12 ${colorStyles.headerCellBg}`} + /> |
---|
+
{stat}
-
{subheader}
-{subheader}
+ ); };