Skip to content

Commit

Permalink
Merge branch 'main' into dynamic-event
Browse files Browse the repository at this point in the history
  • Loading branch information
zineanteoh committed Oct 27, 2023
2 parents 1ed2355 + f396fb5 commit 3e85309
Show file tree
Hide file tree
Showing 27 changed files with 4,921 additions and 4,857 deletions.
30 changes: 20 additions & 10 deletions components/Organizer/EventsTab/EventsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,28 @@ export default function Events() {
});

useEffect(() => {
if (eventsCountData && eventsCountData.length > 0 && eventsData && eventsData.length > 0) {
console.log(eventsCountData);
if (eventsData && eventsData.length > 0) {
setEvents(
eventsData.map((event: EventData) => {
// TODO convert startTime and endTime here so we don't have to do it in the render function
const count = eventsCountData.find((e: any) => e._id === event._id);
return {
key: event._id,
...event,
setCurEvent,
count: count ? count.count : 0,
};
if (eventsCountData && eventsCountData.length > 0) {
// check counts data exist. if so, compute count for each event
const count = eventsCountData?.find((e: any) => e._id === event._id) || 0;

return {
key: event._id,
...event,
setCurEvent,
count: count,
};
} else {
// counts data does not exist yet. set count to 0
return {
key: event._id,
...event,
setCurEvent,
count: 0,
};
}
})
);
}
Expand Down
59 changes: 4 additions & 55 deletions components/hacker/HackerDash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TextArea from 'antd/lib/input/TextArea';
import { Content } from 'antd/lib/layout/layout';
import Header from './hacking-start/Header';
import RegistrationLogo from './RegistrationLogo';
import TeamManagement from './hacking-start/TeamManagement';
import Link from 'next/link';

const DEV_DEPLOY =
Expand All @@ -25,13 +26,6 @@ type HackerProps = {
export default function HackerDash({ userApplicationStatus, setUserApplicationStatus }: HackerProps) {
const [loading, setLoading] = useState(false);
const { data: session, status } = useSession();
const { data: teamData, error: teamError } = useSWR('/api/team-management', async url => {
const res = await fetch(url, { method: 'GET' });
if (!res.ok) return;
const { members, ...rest } = await res.json();

return { members: members.map((member: any) => member.name), ...rest } as TeamProfile;
});

const { data: user } = useSWR(
'/api/user-data',
Expand Down Expand Up @@ -443,7 +437,7 @@ export default function HackerDash({ userApplicationStatus, setUserApplicationSt
<Button icon={<UploadOutlined />}>Upload résumé (PDF only)</Button>
</Upload>
</Form.Item>
{/* TODO: uncomment when application starts */}
{/* TODO: create a new time in hackathon-settings db collection for applyTravelReimbursement end date */}
{/* <Form.Item
label={
<p className={styles.Label}>
Expand Down Expand Up @@ -648,61 +642,16 @@ export default function HackerDash({ userApplicationStatus, setUserApplicationSt
<div style={{ padding: '20px' }}>
<Header user={user} signOut={signOut} setting={setting as HackathonSettingsData} />

{/* TODO: add Your Team, Leaderboard, Judging Schedule */}
<Leaderboard />
<TeamManagement />
<JudgingSchedule judgingSessionData={judgingSessionData} />
<Leaderboard />

{/* TODO: remove once ready. placeholder */}
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
textAlign: 'center',
color: 'white',
fontSize: '10px',
}}>
<h1>Stay tuned! More info will appear here closer to the Hackathon!</h1>
</div>
<div className={styles['reportABugContainer']}>
<Link href="/report">
<div className={styles['reportABugText']}>Report a bug!</div>
</Link>
<BugOutlined />
</div>

{/* TODO: these are being refactored. should remove this after complete */}
{/* <div style={{ display: 'flex', justifyContent: 'center', paddingBottom: '10px' }}>
<Button size="small" type="default" onClick={() => signOut()}>
Sign out
</Button>
<div style={{ paddingLeft: '10px', color: 'white' }}>
Signed in as {session?.user?.email}
</div>
<div style={{ paddingLeft: '20px', color: 'white' }}>
Current NFC Points: {user.nfcPoints}
</div>
</div>
{!teamData && <TeamSetup />}
{teamData && (
<div style={{ width: '60vw', margin: 'auto' }}>
<Content style={{ width: '60vw', margin: 'auto' }}>
<Table
locale={{
emptyText: (
<div style={{ paddingTop: '50px', paddingBottom: '50px' }}>
<h3>Stay tuned! You will see your schedule soon!</h3>
</div>
),
}}
columns={judgingSessionColumns}
dataSource={judgingSessionData}
/>
<Divider />
</Content>
<TeamManager profile={teamData} />
</div>
)} */}
</div>
)}

Expand Down
3 changes: 3 additions & 0 deletions components/hacker/JudgingSchedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const JudgingSchedule = ({ judgingSessionData }: JudgingScheduleProps) => {
return (
<div className={styles.Container}>
Judging Schedule
<div className={styles.Description}>
You will be assigned a table and judge for judging. Please be at your table at the time indicated below.
</div>
{judgingSessionData?.length === 0 ? (
<div className={styles.Placeholder}>Schedule will show up here when hacking ends!</div>
) : (
Expand Down
5 changes: 4 additions & 1 deletion components/hacker/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ const Leaderboard = () => {

return (
<div className={styles.Container}>
Leaderboard
Points Leaderboard
<div className={styles.Description}>
Participate and check in to events to earn points. Points can be used to redeem prizes!
</div>
{leaderboardError ? (
<div className={styles.Placeholder}>Failed to load data.</div>
) : !leaderboardData ? (
Expand Down
35 changes: 0 additions & 35 deletions components/hacker/TeamCard.tsx

This file was deleted.

112 changes: 0 additions & 112 deletions components/hacker/TeamManager.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions components/hacker/TeamSetup.tsx

This file was deleted.

18 changes: 16 additions & 2 deletions components/hacker/hacking-start/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Header = ({
}, [setting]);

return (
<>
<div>
<div className={styles.HeaderBox}>
<div className={styles.HeaderTopBox}>
<Image alt="" width={150} height={150} src={VHLogo} />
Expand All @@ -105,7 +105,21 @@ const Header = ({
</span>
</div>
</div>
</>
<div className={styles.HeaderMiddleBox}>
<span className={styles.UserName}>
<div className={styles.Greeting}>Hello,</div>
<div className={styles.Greeting}>{user.name}</div>
<div className={styles.NFCPoint}>
You currently have {user.nfcPoints} points. Participate in events to start earning more!
</div>
</span>
<span className={styles.CurEvent}>
<div className={styles.CurEventText}>Current Event</div>
<Image src={HackingBeginSoon} width={300} height={300} alt="Hacking Begin Soon" />
<div className={styles.CurEventText}>Hacking Begins Soon</div>
</span>
</div>
</div>
);
};

Expand Down
Loading

0 comments on commit 3e85309

Please sign in to comment.