Skip to content

Commit 2f93552

Browse files
authored
Merge pull request #92 from HackDavis/feat/judge-progress
images for judge portal redone
2 parents 9481064 + 4a22fe7 commit 2f93552

File tree

13 files changed

+155
-104
lines changed

13 files changed

+155
-104
lines changed

app/(api)/_actions/judgeGroups/getJudgeGroup.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
'use server';
22

3-
import { GetManyJudgeGroups } from '@datalib/judgeGroups/getJudgeGroup';
3+
import {
4+
GetJudgeGroup,
5+
GetManyJudgeGroups,
6+
} from '@datalib/judgeGroups/getJudgeGroup';
7+
8+
export async function getJudgeGroup(group_id: string) {
9+
const judgeGroupRes = await GetJudgeGroup(group_id);
10+
return judgeGroupRes.json();
11+
}
412

513
export async function getManyJudgeGroups(query: object = {}) {
614
const judgeGroupRes = await GetManyJudgeGroups(query);

app/(api)/_types/authToken.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ interface AuthTokenInt {
44
email: string;
55
password: string;
66
specialty: string;
7+
judge_group_id: string;
78
role: string;
89
iat: number;
910
exp: number;

app/(pages)/_hooks/useJudgeGroup.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use client';
2+
3+
import { useState, useEffect } from 'react';
4+
import { getJudgeGroup } from '@actions/judgeGroups/getJudgeGroup';
5+
import { useAuth } from './useAuth';
6+
7+
export function useJudgeGroup(): any {
8+
const { loading: auth_loading, user } = useAuth();
9+
const [members, setMembers] = useState<string[]>([]);
10+
const [curr_user, setUser] = useState<string>('');
11+
const [loading, setLoading] = useState<boolean>(true);
12+
useEffect(() => {
13+
if (user) {
14+
const wrapper = async () => {
15+
if (user.judge_group_id) {
16+
const group = await getJudgeGroup(user.judge_group_id);
17+
const groupData = group.body;
18+
const judges = groupData ? groupData.judges : [];
19+
const names = judges.map((judge: { name: string }) => judge.name);
20+
const other_judges = names.filter(
21+
(judge: string) => judge !== user.name
22+
);
23+
setMembers(other_judges);
24+
setUser(user.name);
25+
}
26+
setLoading(false);
27+
};
28+
wrapper();
29+
}
30+
}, [user, auth_loading]);
31+
32+
return { members, loading, user: curr_user };
33+
}

app/(pages)/judges/_components/JudgingHub/HubHero.module.scss

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@
88
gap: var(--small-spacer);
99
position: relative;
1010

11-
.shape_1{
11+
.top_blurb {
1212
position: absolute;
13-
top: 0px;
13+
right: 0;
14+
top: 0;
1415
}
15-
.shape_2 {
16+
17+
.top_left_blurb {
1618
position: absolute;
17-
top: 0px;
18-
right: 0px;
19+
left: 0;
20+
top: 0;
1921
}
20-
.shape_3{
22+
23+
.bottom_blurb {
2124
position: absolute;
22-
bottom: 0px;
23-
right: 0px;
24-
25+
right: 0;
26+
bottom: 0;
2527
}
2628

2729
.welcome_text {
@@ -53,13 +55,28 @@
5355
position: relative;
5456
display: flex;
5557
flex-direction: row;
58+
justify-content: space-between;
5659
width: 100%;
5760

5861
.cow_container {
5962
position: relative;
6063
display: flex;
6164
flex-direction: column-reverse;
62-
width: 65%;
65+
width: 60%;
66+
margin-right: -10%;
67+
68+
.cow {
69+
width: 100%;
70+
}
71+
72+
.wig {
73+
width: 100%;
74+
position: absolute;
75+
top: 0;
76+
left: 0;
77+
margin-left: -6%;
78+
}
79+
6380
}
6481

6582
.text_bubble_tail {

app/(pages)/judges/_components/JudgingHub/HubHero.tsx

Lines changed: 27 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -4,120 +4,58 @@ import styles from './HubHero.module.scss';
44

55
import Image from 'next/image';
66

7-
const Shape1 = (
8-
<svg
9-
xmlns="http://www.w3.org/2000/svg"
10-
width="242"
11-
height="254"
12-
viewBox="0 0 242 254"
13-
fill="none"
14-
className={styles.shape_1}
15-
>
16-
<path
17-
opacity="0.2"
18-
d="M94.3046 117.112C75.1245 99.4663 63.4846 74.3346 59.2546 44.0785C57.4646 31.3074 56.7845 18.126 51.8145 6.28579C46.8445 -5.56446 36.2445 -16.0635 23.7145 -16.0135C8.33455 -15.9434 -2.95545 -0.480063 -7.06545 14.7831C-15.7055 46.8809 -14.5955 84.2132 9.25455 109.695C27.8245 129.542 55.8546 139.221 72.3146 160.839C88.2546 181.768 91.1545 211.203 109.685 229.879C119.445 239.718 132.635 245.483 146.015 249.096C164.965 254.2 185.555 255.281 203.925 248.395C222.305 241.509 237.965 225.655 241.185 206.279C249.625 155.485 184.735 148.779 150.615 143.224C127.535 139.461 108.775 130.413 94.3046 117.112Z"
19-
fill="#69779B"
20-
/>
21-
</svg>
22-
);
23-
const Shape2 = (
24-
<svg
25-
xmlns="http://www.w3.org/2000/svg"
26-
width="192"
27-
height="91"
28-
viewBox="0 0 192 91"
29-
fill="none"
30-
className={styles.shape_2}
31-
>
32-
<path
33-
opacity="0.15"
34-
d="M174.458 23.8819C157.629 22.1276 144.785 7.61813 137.942 -6.60457C131.1 -20.8273 127.653 -36.3232 117.646 -49.1895C96.3817 -76.5021 48.7758 -81.2759 22.9232 -61.6358C-2.93289 -41.9864 -6.40626 -4.36767 10.2749 25.1081C26.9451 54.58 60.4343 75.7138 95.5059 84.9158C126.322 93.0047 159.542 92.619 186.77 81.1067C213.999 69.5944 268.98 42.6439 272.293 15.2473C274.234 -0.801009 262.821 -26.7544 247.405 -10.8431C235.445 1.52961 200.644 26.6144 174.458 23.8819Z"
35-
fill="#ACDBDF"
36-
fillOpacity="0.5"
37-
/>
38-
</svg>
39-
);
7+
import judgeCow from '/public/judges/hub/judge-cow.svg';
8+
import judgeWig from '/public/judges/hub/judge-wig.svg';
9+
import bg_topleft from '/public/judges/hub/topleft.svg';
10+
import bg_top from '/public/judges/hub/topright.svg';
11+
import bg_bottom from '/public/judges/hub/bottom.svg';
4012

41-
const Shape3 = (
42-
<svg
43-
xmlns="http://www.w3.org/2000/svg"
44-
width="69"
45-
height="76"
46-
viewBox="0 0 69 76"
47-
fill="none"
48-
className={styles.shape_3}
49-
>
50-
<g opacity="0.2">
51-
<path
52-
opacity="0.65"
53-
d="M90.2209 33.991C92.9093 54.7321 74.9507 73.3631 50.1097 75.6078C25.2687 77.8525 2.95489 62.8579 0.266468 42.1168C-2.42195 21.3758 15.5367 2.74478 40.3777 0.500076C65.2186 -1.74462 87.5324 13.25 90.2209 33.991Z"
54-
fill="#69779B"
55-
/>
56-
</g>
57-
</svg>
58-
);
59-
60-
const textBubbleTail = (
61-
<svg
62-
xmlns="http://www.w3.org/2000/svg"
63-
width="20"
64-
height="20"
65-
viewBox="0 0 20 20"
66-
fill="none"
67-
className={styles.text_bubble_tail}
68-
>
69-
<path
70-
fillRule="evenodd"
71-
clipRule="evenodd"
72-
d="M6.0712 8.81143C5.90657 7.95843 5.82036 7.07751 5.82036 6.17644V-0.0078125H19.644V20.0001C16.2965 20.0001 13.2268 18.8102 10.835 16.8303C8.44879 18.4199 4.62262 19.9309 0 19.0904C1.27323 18.5448 6.18426 15.2707 6.00237 8.7227C6.02438 8.75296 6.04733 8.78253 6.0712 8.81143Z"
73-
fill="white"
74-
/>
75-
</svg>
76-
);
7713
export default function HubHero({
7814
user,
7915
loading,
16+
members,
8017
}: {
8118
user: JudgeInt;
8219
loading: boolean;
20+
members: string[];
8321
}) {
8422
if (loading) {
8523
return 'loading...';
8624
}
8725
return (
8826
<div className={styles.container}>
89-
<LogoutButton />
90-
{Shape1}
91-
{Shape2}
92-
{Shape3}
93-
27+
<LogoutButton>LOGOUT BUTTON YOU CAN'T MISS THIS</LogoutButton>
9428
<div className={styles.welcome_text}>
9529
<p>Welcome to HackDavis,</p>
9630
<div className={styles.name_container}>
97-
<h1>{user.email}</h1>
31+
<h1>{user.name}</h1>
9832
</div>
9933
</div>
10034
<div className={styles.gavel_cow}>
10135
<div className={styles.cow_container}>
102-
<Image
103-
src="/judges/hub/judge-cow.png"
104-
alt=""
105-
height={1600}
106-
width={1600}
107-
quality={100}
108-
style={{
109-
maxWidth: '100%',
110-
height: 'auto',
111-
objectFit: 'contain',
112-
}}
113-
/>
36+
<Image src={judgeCow} alt="Judge Cow" className={styles.cow} />
37+
<Image src={judgeWig} alt="Judge Wig" className={styles.wig} />
11438
</div>
115-
{textBubbleTail}
11639
<div className={styles.blurb}>
11740
<p className={styles.intro_text}>You're paired with...</p>
118-
<p className={styles.name}>{user.email}</p>
41+
{members.map((member: string, index: number) => (
42+
<p key={index} className={styles.name}>
43+
{member}
44+
</p>
45+
))}
11946
</div>
12047
</div>
48+
<Image
49+
src={bg_bottom}
50+
alt="bottom blurb"
51+
className={styles.bottom_blurb}
52+
/>
53+
<Image src={bg_top} alt="top blurb" className={styles.top_blurb} />
54+
<Image
55+
src={bg_topleft}
56+
alt="top left blurb"
57+
className={styles.top_left_blurb}
58+
/>
12159
</div>
12260
);
12361
}

app/(pages)/judges/_components/JudgingHub/JudgingHub.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import HubHero from './HubHero';
55
import JudgingList from './JudgingList';
66
import TableLocations from './TableLocations';
77
import { useSubmissions } from '@hooks/useSubmissions';
8+
import { useJudgeGroup } from '@hooks/useJudgeGroup';
89

910
export default function JudgingHub() {
1011
const { user, loading } = useAuth();
12+
const { members } = useJudgeGroup();
1113
const { loading: submissionLoading, unjudgedTeams } = useSubmissions();
1214
return (
1315
<div className={styles.container}>
14-
<HubHero user={user} loading={loading} />
16+
<HubHero user={user} loading={loading} members={members} />
1517
<JudgingList loading={submissionLoading} projects={unjudgedTeams} />
1618
<TableLocations />
1719
</div>

app/(pages)/judges/_components/JudgingHub/JudgingList.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import Link from 'next/link';
22
import styles from './JudgingList.module.scss';
33
import ProjectCarousel from './ProjectCarousel';
44

5-
const numProjects = 4;
6-
75
export default function JudgingList({
86
loading,
97
projects,
@@ -16,7 +14,7 @@ export default function JudgingList({
1614
<div className={styles.top_text}>
1715
<h3>Judging has begun!</h3>
1816
<p>
19-
You have <span>{numProjects}</span> left to judge:
17+
You have <span>{projects.length}</span> left to judge:
2018
</p>
2119
</div>
2220
{loading ? 'loading...' : <ProjectCarousel projects={projects} />}

public/judges/hub/bottom.svg

Lines changed: 5 additions & 0 deletions
Loading

public/judges/hub/judge-cow.png

-11.1 KB
Binary file not shown.

public/judges/hub/judge-cow.svg

Lines changed: 32 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)