Skip to content

Commit

Permalink
Merge pull request #629 from nwplus/peer-judging-bug
Browse files Browse the repository at this point in the history
Wrap getAndAssignProjects with db.runTransaction
  • Loading branch information
tdanielles authored Oct 29, 2024
2 parents 8d2a178 + 8140c9a commit 038b124
Show file tree
Hide file tree
Showing 13 changed files with 764 additions and 148 deletions.
521 changes: 521 additions & 0 deletions src/assets/hc2024qrcode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/assets/hc_background.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 50 additions & 22 deletions src/components/ApplicationDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,14 @@ const Dashboard = ({
setMediaConsentCheck,
ageOfMajoritySelect,
setAgeOfMajoritySelect,
willBeAttendingSelect,
setWillBeAttendingSelect,
willBeAttendingCheck,
setWillBeAttendingCheck,
safewalkSelect,
setSafewalkSelect,
nwMentorshipSelect,
setNwMentorshipSelect,
// nwMentorshipSelect,
// setNwMentorshipSelect,
hcFeatureSelect,
setHcFeatureSelect,
username,
editApplication,
relevantDates,
Expand All @@ -395,9 +397,10 @@ const Dashboard = ({
const [releaseLiability, setReleaseLiability] = useState(releaseLiabilityCheck || undefined)
const [mediaConsent, setMediaConsent] = useState(mediaConsentCheck || undefined)
// const [ageOfMajority, setAgeOfMajority] = useState(ageOfMajoritySelect || undefined)
const [willBeAttending, setWillBeAttending] = useState(willBeAttendingSelect || undefined)
const [willBeAttending, setWillBeAttending] = useState(willBeAttendingCheck || false)
const [safewalk, setSafewalk] = useState(safewalkSelect || undefined)
const [nwMentorship, setNwMentorship] = useState(nwMentorshipSelect || undefined)
// const [nwMentorship, setNwMentorship] = useState(nwMentorshipSelect || undefined)
const [hcFeature, setHcFeature] = useState(hcFeatureSelect || false)

const hackerRSVPStatus = hackerStatuses()[hackerStatus]?.sidebarText

Expand Down Expand Up @@ -430,19 +433,24 @@ const Dashboard = ({
// setAgeOfMajoritySelect(e.target.value)
// }

const handleWillBeAttendingSelectChange = e => {
setWillBeAttending(e.target.value)
setWillBeAttendingSelect(e.target.value)
const handleWillBeAttendingChange = () => {
setWillBeAttending(!willBeAttending)
setWillBeAttendingCheck(!willBeAttendingCheck)
}

const handleSafewalkSelectChange = e => {
setSafewalk(e.target.value)
setSafewalkSelect(e.target.value)
}

const handleNwMentorshipSelectChange = e => {
setNwMentorship(e.target.value)
setNwMentorshipSelect(e.target.value)
// const handleNwMentorshipSelectChange = e => {
// setNwMentorship(e.target.value)
// setNwMentorshipSelect(e.target.value)
// }

const handleHcFeatureChange = value => {
setHcFeature(value)
setHcFeatureSelect(value)
}

const handleRSVPClick = () => {
Expand Down Expand Up @@ -495,15 +503,11 @@ const Dashboard = ({
{relevantDates.hackathonWeekend}? <Required />
</QuestionLabel>
<SelectOptionContainer>
<input
type="radio"
id="willBeAttendingYes"
name="willBeAttendingYes"
value="willBeAttendingYes"
checked={willBeAttending === 'willBeAttendingYes'}
onChange={handleWillBeAttendingSelectChange}
<Checkbox
checked={willBeAttending}
onChange={handleWillBeAttendingChange}
label="Yes, I will be attending"
/>
<label htmlFor="willBeAttendingYes">Yes</label>
</SelectOptionContainer>
</SelectContainer>

Expand Down Expand Up @@ -594,7 +598,7 @@ const Dashboard = ({
width="130px"
target="_blank"
rel="noopener noreferrer"
href={waiversAndForms.COVID}
href={waiversAndForms.covid}
>
Read Full Waiver.
</A>{' '}
Expand Down Expand Up @@ -632,6 +636,30 @@ const Dashboard = ({
</QuestionContainer>

<SelectContainer>
<QuestionLabel>HackCamp 2024 Feature Preference</QuestionLabel>
<P>
We are looking for people to be featured in interview videos about their experience
at HackCamp. Filming will take ~10 mins and will take place during Build Day
(Sunday, November 10th). If chosen, our team will reach out with further
instructions. Are you interested in participating?{' '}
</P>
<SelectOptionContainer>
<Checkbox
checked={hcFeature}
onChange={() => handleHcFeatureChange(true)}
label="Yes"
/>
</SelectOptionContainer>
<SelectOptionContainer>
<Checkbox
checked={!hcFeature}
onChange={() => handleHcFeatureChange(false)}
label="No"
/>
</SelectOptionContainer>
</SelectContainer>

{/* <SelectContainer>
<QuestionLabel>nwMentorship Program</QuestionLabel>
<P>
I would like to participate in the nwMentorship program to connect with an industry
Expand Down Expand Up @@ -669,7 +697,7 @@ const Dashboard = ({
/>
<label htmlFor="nwMentorshipNo">No</label>
</SelectOptionContainer>
</SelectContainer>
</SelectContainer> */}
</>
)}

Expand Down
19 changes: 8 additions & 11 deletions src/components/MobileMenuBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,22 @@ const MobileMenuBarContainer = styled.div`
display: none;
z-index: 100;
${p => p.theme.mediaQueries.mobile} {
padding: 15px;
display: inline-block;
text-align: center;
padding: 15px 0;
width: 100%;
box-sizing: border-box;
// -webkit-box-shadow: 0 6px 8px -8px #000;
// -moz-box-shadow: 0 6px 8px -8px #000;
// box-shadow: 0 6px 8px -8px #000;
display: flex;
justify-content: center;
align-items: center;
}
`

const Logo = styled.img`
display: inline-block;
margin-left: -50px;
width: 40px;
height: 60px;
`

const Menu = styled.img`
float: left;
position: absolute;
left: 20px;
width: 30px;
cursor: pointer;
`
Expand Down
129 changes: 73 additions & 56 deletions src/components/QrCode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import styled from 'styled-components'
import { useQRCode } from 'next-qrcode'
// import JsPDF from 'jspdf'
// import html2canvas from 'html2canvas'
import qrcodeBackground from '../assets/cmdf2024qrcode.svg'
import qrcodeBackground from '../assets/hc2024qrcode.svg'
import AppleWalletButtonImage from '../assets/apple_wallet_button.svg'

const QRContainer = styled.div`
display: flex;
z-index: 98;
${p => p.theme.mediaQueries.mobile} {
justify-content: space-around;
${p => p.theme.mediaQueries.tabletLarge} {
flex-direction: column;
align-items: center;
justify-content: center;
}
`

Expand All @@ -20,21 +23,43 @@ const QRContainer = styled.div`
// display: flex;
// `

const QRCodeDesignContainer = styled.div``
const QRTicketContainer = styled.div`
position: relative;
width: 442.8px;
height: 583.2px;
margin-top: 30px;
${p => p.theme.mediaQueries.mobile} {
width: 354.24px;
height: 464.4px;
}
`

const QRCodeBackground = styled.img`
position: absolute;
width: 442.8px;
height: 583.2px;
${p => p.theme.mediaQueries.mobile} {
width: 354.24px;
height: 464.4px;
}
`

const QRCodeDesign = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
position: relative;
width: 300px;
height: 500px;
background-size: 100% auto;
background-repeat: no-repeat;
padding: 45px;
left: 50px;
top: 80px;
border-radius: 20px;
z-index: 10;
background-image: url(${qrcodeBackground});
margin: 0 auto;
display: block;
margin-top: 30px;
${p => p.theme.mediaQueries.mobile} {
left: 30px;
top: 40px;
}
`

const HackerName = styled.h1`
Expand All @@ -43,12 +68,20 @@ const HackerName = styled.h1`
margin-top: 60px;
position: relative;
color: ${p => p.theme.colors.cardText};
${p => p.theme.mediaQueries.mobile} {
font-size: 1.5em;
}
`

const HackerEmail = styled.p`
color: #2e2e2e !important;
font-size: 1.2em;
margin-top: -10px;
${p => p.theme.mediaQueries.mobile} {
font-size: 1em;
}
`

const QRTags = styled.div`
Expand Down Expand Up @@ -78,14 +111,6 @@ const QRTags = styled.div`
// display: block;
// `

const QRTicketContainer = styled.div`
float: left;
width: 50%;
${p => p.theme.mediaQueries.mobile} {
float: none;
width: 100%;
}
`
const QRInfo = styled.div`
float: right;
width: 45%;
Expand All @@ -94,7 +119,7 @@ const QRInfo = styled.div`
${p => p.theme.mediaQueries.mobile} {
float: none;
margin-top: 0;
margin-top: 20px;
width: 100%;
padding-left: 0px;
}
Expand Down Expand Up @@ -125,9 +150,6 @@ const QRInfoName = styled.h1`
const QRInfoDes = styled.p``

const AppleWalletButton = styled.button`
position: absolute;
left: 40px;
bottom: 100px;
width: 110px;
height: 35px;
padding: 10px;
Expand All @@ -136,7 +158,9 @@ const AppleWalletButton = styled.button`
background-size: auto auto;
background-color: transparent;
cursor: pointer;
margin-top: 30px;
`

// temporary comment out for lint fix
// const generatePDF = () => {
// // const report = new JsPDF('portrait', 'pt', [300, 500.01])
Expand Down Expand Up @@ -171,48 +195,41 @@ const QrCode = ({ userInfo, userId }) => {
<QRInfoMobileWelcome>Welcome, {userInfo.displayName}!</QRInfoMobileWelcome>

<QRTicketContainer>
<QRCodeDesignContainer>
<QRCodeDesign id="QRCodeContainer">
<HackerName>{userInfo.displayName}</HackerName>
<HackerEmail>{userInfo.email}</HackerEmail>
<QRCodeBackground src={qrcodeBackground} />
<QRCodeDesign id="QRCodeContainer">
<HackerName>{userInfo.displayName}</HackerName>
<HackerEmail>{userInfo.email}</HackerEmail>

<QRTags>
{/* {userInfo.safewalkNote ? <SafeWalk>SafeWalk: Yes</SafeWalk> : <SafeWalk >SafeWalk: No</SafeWalk>}
<QRTags>
{/* {userInfo.safewalkNote ? <SafeWalk>SafeWalk: Yes</SafeWalk> : <SafeWalk >SafeWalk: No</SafeWalk>}
<ShirtSize></ShirtSize>
<Allergies></Allergies> */}
</QRTags>

<Canvas
text={userId}
options={{
level: 'M',
margin: 2,
scale: 3,
width: 140,
color: {
dark: '#000000',
light: '#FFFFFF',
},
}}
/>

{/* <QRInstructions>Please hold onto this QR Code for check-in, meals, etc</QRInstructions> */}
<AppleWalletButton onClick={() => downloadAppleWalletPass()} />
</QRCodeDesign>
</QRCodeDesignContainer>

{/* <SavePDFBtn color="secondary" onClick={generatePDF}>
{' '}
Save as PDF
</SavePDFBtn> */}
</QRTags>

<Canvas
text={userId}
options={{
level: 'M',
margin: 2,
scale: 4.5,
// width: '100%',
color: {
dark: '#000000',
light: '#FFFFFF',
},
}}
/>

{/* <AppleWalletButton onClick={() => downloadAppleWalletPass()} /> */}
</QRCodeDesign>
</QRTicketContainer>

<QRInfo>
<QRInfoWelcome>Welcome,</QRInfoWelcome>
<QRInfoName>{userInfo.displayName}!</QRInfoName>
<QRInfoDes>
This ticket contains your personal QR code which will be scanned throughout the event.
Please add this ticket to your mobile wallet or take a screenshot.
Please take a screenshot or otherwise have your QR code ready to scan.
</QRInfoDes>
</QRInfo>
</QRContainer>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ const Sidebar = ({
links.tools.push({ location: '/judging/admin', text: 'Judging Admin' })
}

if (import.meta.env.NODE_ENV !== 'production') {
links.information.push({ location: '/charcuterie', text: 'CHARCUTERIE' })
}
// if (import.meta.env.NODE_ENV !== 'production') {
// links.information.push({ location: '/charcuterie', text: 'CHARCUTERIE' })
// }

if (isApplicationOpen) {
// List the application as the last item on the menu
Expand Down
Loading

0 comments on commit 038b124

Please sign in to comment.