Skip to content

Commit 8dc91bd

Browse files
authored
Merge pull request #319 from HackRU/dev
Dev
2 parents 86dd7a9 + d0a4aa9 commit 8dc91bd

File tree

4 files changed

+175
-82
lines changed

4 files changed

+175
-82
lines changed

app/(pre-dashboard)/(landing)/sections/Sponsors.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import Link from 'next/link';
44
export default async function Sponsors() {
55
const sponsors = ['/sponsors/wakefern2.png', '/sponsors/cloudflare.png', "/sponsors/Pure-Buttons-Blue-Gradient-Logo-RGB.png",
66
"/sponsors/RNBCES_H_RED_BLACK_RGB.png", "/sponsors/GoogleCloud.png", "/sponsors/nexos-ai-logo-MAIN-black-horizontal.png",
7-
"/sponsors/RHNIC_RED_WHITE_RBG.png", "/sponsors/saily-logo-yellow_2.png", "/sponsors/NordVPN_Logo_RGB_Primary_Blue_Black.png"];
7+
"/sponsors/RHNIC_RED_WHITE_RBG.png", "/sponsors/saily-logo-yellow_2.png", "/sponsors/NordVPN_Logo_RGB_Primary_Blue_Black.png",
8+
"/sponsors/Bloomberg_Engineering_black.png"];
89

910
const sponsorsLinks = ['https://www2.wakefern.com/', 'https://www.cloudflare.com/',
1011
'https://www.purebuttons.com/', "https://careers.rutgers.edu/", "https://cloud.google.com/", "https://nexos.ai/",
11-
"https://brainhealthinstitute.rutgers.edu/", "https://saily.com/", "https://nordvpn.com/"];
12+
"https://brainhealthinstitute.rutgers.edu/", "https://saily.com/", "https://nordvpn.com/", "https://www.bloomberg.com/company/what-we-do/engineering-cto/"];
1213

1314
return (
1415
<div

app/dashboard/page.tsx

Lines changed: 129 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default function Dashboard() {
154154
team_id: '',
155155
isLeader: false,
156156
});
157-
const [pendingTeamInvites, setpendingTeamInvites] = useState<any>()
157+
const [pendingTeamInvites, setpendingTeamInvites] = useState<any>();
158158
const [pointsData, setPointsData] = useState<{
159159
balance: number;
160160
total_points: number;
@@ -172,6 +172,8 @@ export default function Dashboard() {
172172
const [teamMember3Errors, setTeamMember3Errors] = useState<string>();
173173
const [teamMemberErrors, setTeamMemberErrors] = useState<string>();
174174
const [pendingteam, setpendingteam] = useState<string>();
175+
const [showStagePopup, setShowStagePopup] = useState(false);
176+
const [prevStage, setPrevStage] = useState<number>(0);
175177

176178
const [
177179
displayTeamFormFinalSubmissionWarning,
@@ -411,23 +413,23 @@ export default function Dashboard() {
411413
};
412414

413415
async function fetchTeam() {
414-
try {
415-
setpendingteam(userData?.team_info?.pending_invites[0]?.team_id);
416-
const resp = await ReadConfirmed();
417-
console.log('TEAM');
418-
setTeamInfo(resp.response);
419-
console.log(teamInfo);
420-
const l = await isLeaderCheck(teamInfo?.leader_email)
421-
setTeamStatus({
422-
...teamStatus,
423-
isLeader: l,
424-
});
425-
const resp2 = await ReadPendingOnTeam();
426-
setpendingTeamInvites(resp2.response)
427-
} catch (error) {
428-
console.error('Error fetching or parsing schools data:', error);
429-
}
416+
try {
417+
setpendingteam(userData?.team_info?.pending_invites[0]?.team_id);
418+
const resp = await ReadConfirmed();
419+
console.log('TEAM');
420+
setTeamInfo(resp.response);
421+
console.log(teamInfo);
422+
const l = await isLeaderCheck(teamInfo?.leader_email);
423+
setTeamStatus({
424+
...teamStatus,
425+
isLeader: l,
426+
});
427+
const resp2 = await ReadPendingOnTeam();
428+
setpendingTeamInvites(resp2.response);
429+
} catch (error) {
430+
console.error('Error fetching or parsing schools data:', error);
430431
}
432+
}
431433

432434
const updateTeam = async () => {
433435
let memberstoadd: string[] = [];
@@ -451,7 +453,7 @@ export default function Dashboard() {
451453

452454
if (resp.response != '') {
453455
// Only update the display data after successful submission
454-
fetchTeam()
456+
fetchTeam();
455457
setSubmittingPreEventTeamForm('Saved!');
456458
setTeamMemberErrors("")
457459
} else {
@@ -468,8 +470,6 @@ export default function Dashboard() {
468470
}
469471
};
470472

471-
472-
473473
useEffect(() => {
474474
fetchTeam();
475475
}, [userData]);
@@ -588,6 +588,25 @@ export default function Dashboard() {
588588
}
589589
}, [teamInfo]);
590590

591+
useEffect(() => {
592+
if (typeof window !== 'undefined') {
593+
const saved = localStorage.getItem('stagePopup');
594+
if (saved) {
595+
setPrevStage(parseInt(saved));
596+
}
597+
}
598+
}, []);
599+
600+
useEffect(() => {
601+
if (typeof window !== 'undefined' && userData?.stage != null) {
602+
if (userData.stage > prevStage) {
603+
setShowStagePopup(true);
604+
localStorage.setItem('stagePopup', userData.stage.toString());
605+
}
606+
setPrevStage(userData.stage);
607+
}
608+
}, [userData?.stage, prevStage]);
609+
591610
if (!userData || !userData.role) {
592611
return <HackerDashboardSkeleton />;
593612
}
@@ -827,19 +846,21 @@ export default function Dashboard() {
827846
<Button
828847
onClick={() => {
829848
TeamDisband(teamInfo?.team_id);
830-
fetchTeam()
849+
fetchTeam();
831850
}}
832851
type="button"
833852
className="text-red-400"
834853
>
835854
Disband Team
836855
</Button>
837856
)}
838-
{
839-
pendingTeamInvites && <p>Pending invites sent to
840-
{" " + pendingTeamInvites} </p>
841-
}
842-
{false && teamInfo?.team_id && !(teamStatus.isLeader) && (
857+
{pendingTeamInvites && (
858+
<p>
859+
Pending invites sent to
860+
{' ' + pendingTeamInvites}{' '}
861+
</p>
862+
)}
863+
{false && teamInfo?.team_id && !teamStatus.isLeader && (
843864
<Button
844865
onClick={() => {
845866
LeaveTeam(teamInfo.team_id);
@@ -874,8 +895,7 @@ export default function Dashboard() {
874895
<Button
875896
onClick={() => {
876897
removeMember(teamInfo.members[0]);
877-
fetchTeam()
878-
898+
fetchTeam();
879899
}}
880900
type="button"
881901
className="text-red-400"
@@ -893,8 +913,7 @@ export default function Dashboard() {
893913
<Button
894914
onClick={() => {
895915
removeMember(teamInfo.members[1]);
896-
fetchTeam()
897-
916+
fetchTeam();
898917
}}
899918
type="button"
900919
className="text-red-400"
@@ -912,8 +931,7 @@ export default function Dashboard() {
912931
<Button
913932
onClick={() => {
914933
removeMember(teamInfo.members[2]);
915-
fetchTeam()
916-
934+
fetchTeam();
917935
}}
918936
type="button"
919937
className="text-red-400"
@@ -963,7 +981,7 @@ export default function Dashboard() {
963981
id="team_member_2"
964982
value={teamFormData.team_member_2}
965983
className={teamMember2Errors ? 'border-red-500' : ''}
966-
disabled={!teamStatus.isLeader && teamInfo?.team_id}
984+
disabled={!teamStatus.isLeader && teamInfo?.team_id}
967985
onChange={(e) => {
968986
const email = e.target.value;
969987
setTeamFormData({
@@ -993,7 +1011,7 @@ export default function Dashboard() {
9931011
id="team_member_3"
9941012
value={teamFormData.team_member_3}
9951013
className={teamMember3Errors ? 'border-red-500' : ''}
996-
disabled={!teamStatus.isLeader && teamInfo?.team_id}
1014+
disabled={!teamStatus.isLeader && teamInfo?.team_id}
9971015
onChange={(e) => {
9981016
const email = e.target.value;
9991017
setTeamFormData({
@@ -1081,34 +1099,35 @@ export default function Dashboard() {
10811099
</Card>
10821100
) : (
10831101
<Card>
1084-
<CardHeader>
1085-
<CardTitle>Pending invite {userData?.team_info?.pending_invites[0]?.invited_by}</CardTitle>
1102+
<CardHeader>
1103+
<CardTitle>
1104+
Pending invite{' '}
1105+
{userData?.team_info?.pending_invites[0]?.invited_by}
1106+
</CardTitle>
10861107
</CardHeader>
10871108
<CardContent>
1088-
<Button
1089-
onClick={() => {
1090-
InviteAccept(pendingteam ?? '');
1091-
setpendingteam('');
1092-
fetchTeam()
1093-
1094-
}}
1095-
type="button"
1096-
className="text-green-400"
1097-
>
1098-
Accept invite
1099-
</Button>
1100-
<Button
1101-
onClick={() => {
1102-
InviteDecline(pendingteam ?? '');
1103-
setpendingteam('');
1104-
fetchTeam()
1105-
1106-
}}
1107-
type="button"
1108-
className="text-red-400"
1109-
>
1110-
Decline invite
1111-
</Button>
1109+
<Button
1110+
onClick={() => {
1111+
InviteAccept(pendingteam ?? '');
1112+
setpendingteam('');
1113+
fetchTeam();
1114+
}}
1115+
type="button"
1116+
className="text-green-400"
1117+
>
1118+
Accept invite
1119+
</Button>
1120+
<Button
1121+
onClick={() => {
1122+
InviteDecline(pendingteam ?? '');
1123+
setpendingteam('');
1124+
fetchTeam();
1125+
}}
1126+
type="button"
1127+
className="text-red-400"
1128+
>
1129+
Decline invite
1130+
</Button>
11121131
</CardContent>
11131132
</Card>
11141133
)}
@@ -1134,23 +1153,41 @@ export default function Dashboard() {
11341153
)}
11351154

11361155
{!(userData?.registration_status === 'unregistered') && (
1137-
<Card className="w-full max-w-2xl">
1138-
<CardHeader>
1139-
<div className="flex flex-col ">
1140-
<div className="flex flex-col">
1141-
<CardTitle>{`QR Code - Shirt Size ${userData?.shirt_size}`}</CardTitle>
1142-
<CardDescription>
1143-
Use this QR code to check-in or scan-in for events!
1144-
</CardDescription>
1156+
<>
1157+
<Card className="w-full max-w-2xl">
1158+
<CardHeader>
1159+
<div className="flex flex-col ">
1160+
<div className="flex flex-col">
1161+
<CardTitle>{`QR Code - Shirt Size ${userData?.shirt_size}`}</CardTitle>
1162+
<CardDescription>
1163+
Use this QR code to check-in or scan-in for events!
1164+
</CardDescription>
1165+
</div>
11451166
</div>
1146-
</div>
1147-
</CardHeader>
1148-
<CardContent>
1149-
<div className="flex flex-col items-center justify-center space-y-4 rounded-md bg-white p-4">
1150-
<QRCode value={userData?.email} size={256} />
1151-
</div>
1152-
</CardContent>
1153-
</Card>
1167+
</CardHeader>
1168+
<CardContent>
1169+
<div className="flex flex-col items-center justify-center space-y-4 rounded-md bg-white p-4">
1170+
<QRCode value={userData?.email} size={256} />
1171+
</div>
1172+
</CardContent>
1173+
</Card>
1174+
1175+
{/* Clue Counter Card */}
1176+
<Card className="mt-6 w-full max-w-2xl">
1177+
<CardHeader>
1178+
<CardTitle>Clue Progress</CardTitle>
1179+
<CardDescription>
1180+
Your current clue count and stage progress
1181+
</CardDescription>
1182+
</CardHeader>
1183+
<CardContent>
1184+
<div className="flex justify-between text-lg font-semibold">
1185+
<span>Clue Count: {userData?.clue_count ?? 0}</span>
1186+
<span>Stage: {userData?.stage ?? 0}</span>
1187+
</div>
1188+
</CardContent>
1189+
</Card>
1190+
</>
11541191
)}
11551192

11561193
<Card className="w-full max-w-2xl">
@@ -1726,6 +1763,22 @@ export default function Dashboard() {
17261763
)}
17271764
</form>
17281765
</Card>
1766+
{showStagePopup && (
1767+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
1768+
<div className="max-w-sm rounded-xl bg-white p-6 text-center shadow-xl">
1769+
<h2 className="mb-2 text-xl font-bold">Stage Updated!</h2>
1770+
<p className="mb-4">
1771+
You’ve advanced to stage {userData?.stage}.
1772+
</p>
1773+
<button
1774+
className="rounded-md bg-blue-600 px-4 py-2 text-white"
1775+
onClick={() => setShowStagePopup(false)}
1776+
>
1777+
Got it
1778+
</button>
1779+
</div>
1780+
</div>
1781+
)}
17291782
</div>
17301783
</main>
17311784
);

0 commit comments

Comments
 (0)