Skip to content

Commit 440c5fc

Browse files
judging finish projects page (#469)
* feat: add pinch to zoom feature on map modal * feat: add new Flag team as missing section * lint fix and map zoom * expanded map component split * split report modal file * migrate old report modal to new --------- Co-authored-by: michelleyeoh <michellew.yeoh@gmail.com> Co-authored-by: michelleyeoh <74385095+michelleyeoh@users.noreply.github.com>
1 parent 86da265 commit 440c5fc

9 files changed

Lines changed: 242 additions & 486 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import Image from 'next/image';
2+
import closeIcon from '@public/judges/projects/x.svg';
3+
import venueMap from '@public/judges/projects/venueMap2026.svg';
4+
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
5+
6+
export default function ExpandedMapModal({
7+
setMapExpanded,
8+
}: {
9+
setMapExpanded: (expanded: boolean) => void;
10+
}) {
11+
return (
12+
<div
13+
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
14+
onClick={() => setMapExpanded(false)}
15+
>
16+
<div
17+
className="relative mx-4 h-[calc(100dvh-44px)] w-full max-w-[370px] overflow-hidden rounded-[32px]"
18+
onClick={(e) => e.stopPropagation()}
19+
>
20+
<button
21+
onClick={() => setMapExpanded(false)}
22+
className="absolute top-4 right-4 z-20 bg-black text-white rounded-full w-[36px] h-[36px] flex items-center justify-center"
23+
aria-label="Close map"
24+
>
25+
<Image src={closeIcon} alt="Close" width={15} height={15} />
26+
</button>
27+
28+
<TransformWrapper
29+
initialScale={2.25}
30+
minScale={1.5}
31+
maxScale={6}
32+
centerOnInit
33+
limitToBounds={true}
34+
panning={{ disabled: false }}
35+
>
36+
{() => (
37+
<TransformComponent
38+
wrapperStyle={{ width: '100%', height: '100%' }}
39+
contentStyle={{
40+
width: '100%',
41+
height: '100%',
42+
display: 'flex',
43+
alignItems: 'flex-start',
44+
justifyContent: 'center',
45+
}}
46+
>
47+
<div
48+
className="flex items-center justify-center"
49+
style={{
50+
width: '100%',
51+
height: '100%',
52+
}}
53+
>
54+
<div
55+
style={{
56+
transform: 'rotate(90deg)',
57+
transformOrigin: 'center',
58+
width: '100vh',
59+
height: '100vw',
60+
display: 'flex',
61+
alignItems: 'center',
62+
justifyContent: 'center',
63+
}}
64+
>
65+
<Image
66+
src={venueMap}
67+
alt="first floor map"
68+
style={{
69+
maxWidth: '100%',
70+
maxHeight: '100%',
71+
objectFit: 'contain',
72+
}}
73+
draggable={false}
74+
/>
75+
</div>
76+
</div>
77+
</TransformComponent>
78+
)}
79+
</TransformWrapper>
80+
</div>
81+
</div>
82+
);
83+
}

app/(pages)/judges/(app)/_components/Projects/ReportModal.module.scss

Lines changed: 0 additions & 55 deletions
This file was deleted.

app/(pages)/judges/(app)/_components/Projects/ReportModal.tsx

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import Image from 'next/image';
2+
import type { Dispatch, SetStateAction } from 'react';
3+
import Team from '@typeDefs/team';
4+
import ProjectTab from './ProjectTab';
5+
6+
import closeIcon from '@public/judges/projects/x.svg';
7+
import missingTeams from '@public/judges/projects/missingTeams.svg';
8+
import whiteArrow from '@public/judges/projects/whiteArrow.svg';
9+
10+
type ModalStage = 'hidden' | 'loading' | 'success' | 'error';
11+
12+
export default function ReportTeamModal({
13+
currentTeam,
14+
setExpandReportButton,
15+
handleTeamReport,
16+
modalStage,
17+
setModalStage,
18+
errorMsg,
19+
}: {
20+
currentTeam: Team;
21+
setExpandReportButton: (expand: boolean) => void;
22+
handleTeamReport: (team: Team) => void | Promise<void>;
23+
modalStage: ModalStage;
24+
setModalStage: Dispatch<SetStateAction<ModalStage>>;
25+
errorMsg: string | null;
26+
}) {
27+
const isLoading = modalStage === 'loading';
28+
const isError = modalStage === 'error';
29+
30+
return (
31+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-[15px]">
32+
<div className="relative flex w-full min-w-[370px] max-w-[500px] flex-col items-center overflow-hidden rounded-[20px] bg-[#FAFAFF] px-[15px]">
33+
{/* X button */}
34+
<button
35+
onClick={() => {
36+
setModalStage('hidden');
37+
setExpandReportButton(false);
38+
}}
39+
className="absolute right-4 top-[14px] z-10 flex h-[40px] w-[40px] items-center justify-center rounded-full bg-black text-white"
40+
aria-label="Close"
41+
>
42+
<Image src={closeIcon} alt="Close" width={14} height={14} />
43+
</button>
44+
45+
{/* Image */}
46+
<div className="h-[250px] w-[320px]">
47+
<Image src={missingTeams} alt="Missing Teams" />
48+
</div>
49+
50+
{/* Content */}
51+
<div className="mt-4 flex flex-col gap-4 px-6 pb-[32px]">
52+
{/* Team pill */}
53+
<ProjectTab key={currentTeam._id} team={currentTeam} disabled />
54+
55+
{/* Confirmation text */}
56+
<div>
57+
<p className="text-[18px] font-semibold text-[#3F3F3F]">
58+
Are you sure this team is
59+
<span className="text-[#FF8D8D]"> missing</span>?
60+
</p>
61+
<p className="mt-[4px] text-[18px] text-[#878796]">
62+
By flagging this team as missing, it will be placed in the Missing
63+
Teams section of your dashboard.
64+
</p>
65+
</div>
66+
67+
{/* Confirm button */}
68+
<button
69+
onClick={() => handleTeamReport(currentTeam)}
70+
disabled={isLoading}
71+
className="flex h-[56px] w-full items-center justify-center gap-[8px] rounded-full bg-[#FF8D8D] text-[16px] font-semibold text-white disabled:cursor-not-allowed disabled:opacity-70"
72+
>
73+
{isLoading ? (
74+
<>
75+
<span className="h-[18px] w-[18px] animate-spin rounded-full border-2 border-white/40 border-t-white" />
76+
Reporting...
77+
</>
78+
) : (
79+
<>
80+
{isError ? 'Try again' : 'Confirm missing team'}{' '}
81+
<Image
82+
src={whiteArrow}
83+
alt="White Arrow"
84+
width={24}
85+
height={24}
86+
/>
87+
</>
88+
)}
89+
</button>
90+
91+
{isError && errorMsg && (
92+
<p className="text-center text-[14px] text-[#D45858]">{errorMsg}</p>
93+
)}
94+
</div>
95+
</div>
96+
</div>
97+
);
98+
}

0 commit comments

Comments
 (0)