Skip to content

Commit

Permalink
Merge pull request #637 from nwplus/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
martincai8 authored Nov 7, 2024
2 parents 5f785b2 + 96d2ac6 commit 4f5ab7c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/components/Input/ToggleSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const ToggleSwitchContainer = styled.div`
const ToggleSwitchGraphic = styled.div`
width: 35px;
height: 30px;
background: ${p => p.theme.colors.border};
background: ${p => p.theme.colors.input.border};
z-index: 0;
cursor: pointer;
position: relative;
Expand Down
8 changes: 5 additions & 3 deletions src/components/Judging/Admin/SponsorSubmissions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Accordion from '../../Accordion'
import { CardLike } from '../../Common'
import { Button } from '../../Input'
import { H1 } from '../../Typography'
import { useHackathon } from '../../../utility/HackathonProvider'

const SponsorPrize = styled.div`
${CardLike};
Expand All @@ -23,13 +24,14 @@ const LinkContainer = styled.div`
`

const SponsorSubmissions = ({ sponsorPrizes }) => {
const { activeHackathon } = useHackathon()
const getCsvFriendlyData = projects => {
const formattedProjects = projects.map(project => {
const portalLink = window.location.origin // to support local development as well
const projectInfo = {
Title: project.title,
Link: `${portalLink}/projects/${project.id}`,
Devpost: project.links.devpost,
'Title': project.title,
'Link': `${portalLink}/app/${activeHackathon}/projects/${project.id}`,
'Devpost': project.links.devpost,
'Charity choice': project.charityChoice,
}
project.teamMembers.forEach((member, index) => {
Expand Down
43 changes: 27 additions & 16 deletions src/components/Judging/SubmissionForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const StyledHr = styled.hr`
border-color: ${p => p.theme.colors.border};
`

const HeadingLabel = styled(Label)`
color: ${p => p.theme.colors.text};
`

const MemberList = styled.div`
display: flex;
flex-wrap: wrap;
Expand All @@ -44,6 +48,7 @@ const StyledH3 = styled(H3)`
`

const StyledA = styled(A)`
font-weight: bold;
&:hover {
color: ${p => p.theme.colors.tertiaryHover};
}
Expand All @@ -63,12 +68,18 @@ const ButtonContainer = styled.div`
`

const charities = [
{ value: "GiveWell's Top Charities Fund", label: "GiveWell's Top Charities Fund" },
{
value: 'British Columbia Centre for Ability Association',
label: 'British Columbia Centre for Ability Association',
value: 'BC Children’s Hospital',
label: 'BC Children’s Hospital',
},
{
value: 'Alzheimer Society of Canada',
label: 'Alzheimer Society of Canada',
},
{
value: 'Nature Trust of British Columbia',
label: 'Nature Trust of British Columbia',
},
{ value: 'Covenant House', label: 'Covenant House' },
]

const TextInputWithField = ({
Expand Down Expand Up @@ -273,7 +284,7 @@ const SubmissionForm = ({
<H1>Project Submission</H1>
<FormSection>
<div>
<Label color="white">Project title</Label>
<HeadingLabel>Project title</HeadingLabel>
<Required />
</div>
<StyledTextInput
Expand All @@ -285,7 +296,7 @@ const SubmissionForm = ({
</FormSection>
<FormSection>
<div>
<Label color="white">Project description</Label>
<HeadingLabel>Project description</HeadingLabel>
<Required />
</div>
<TextArea
Expand All @@ -297,7 +308,7 @@ const SubmissionForm = ({
/>
</FormSection>
<FormSection>
<Label color="white">Links</Label>
<HeadingLabel>Links</HeadingLabel>
<TextInputWithField
fieldName="Source code (GitHub/BitBucket/GitLab)"
value={links?.sourceCode}
Expand All @@ -306,10 +317,10 @@ const SubmissionForm = ({
errorMsg={errors?.sourceCode}
onChange={e => setLinks({ ...links, sourceCode: e.target.value })}
/>
<P>
{/* <P>
<b>Please note</b>: only code projects can be eligible for prizes. If you built a no-code
project, please enter your prototype link.
</P>
</P> */}
<TextInputWithField
fieldName="Devpost URL"
value={links?.devpost}
Expand All @@ -335,7 +346,7 @@ const SubmissionForm = ({
/>
</FormSection>
<FormSection>
<Label color="white">Mentor Nomination</Label>
<HeadingLabel>Mentor Nomination</HeadingLabel>
<TextInputWithField
fieldName="Nominate the most helpful mentor that assisted you or your team"
value={mentorNomination}
Expand All @@ -344,13 +355,13 @@ const SubmissionForm = ({
</FormSection>
<FormSection>
<div>
<Label color="white">Charity Choice</Label>
<HeadingLabel>Charity Choice</HeadingLabel>
<Required />
</div>
<div>
<P>
Every project submitted at HackCamp 2023, regardless of completion, will be eligible for
a $10 donation to the charity of your choice from a curated list by the HackCamp team!
Every project submitted at HackCamp 2024, regardless of completion, will be eligible for
a $5 donation to the charity of your choice from a curated list by the HackCamp team!
This is done so as to emphasize HackCamp's mission of focusing on the learning and
growth aspect of hackathons!
</P>
Expand All @@ -359,7 +370,7 @@ const SubmissionForm = ({
<StyledA
target="_blank"
rel="noreferrer noopener"
href="https://nwplus.notion.site/PUBLIC-Charities-2716e8e72c7742b082ec06c8c463965f?pvs=4"
href="https://nwplus.notion.site/PUBLIC-Charities-4ec11b0a63e843d7bf7d681576caecd1"
>
here
</StyledA>
Expand All @@ -380,7 +391,7 @@ const SubmissionForm = ({
</FormSection>
{sponsorPrizes && (
<FormSection>
<Label color="white">Sponsor Prizes</Label>
<HeadingLabel>Sponsor Prizes</HeadingLabel>
<div>
{sponsorPrizes.map(prize => {
return (
Expand All @@ -398,7 +409,7 @@ const SubmissionForm = ({
)}
<StyledHr />
<FormSection>
<Label color="white">Add up to 4 team members</Label>
<HeadingLabel>Add up to 4 team members</HeadingLabel>
<MemberList>
{members.map((member, index) => (
<TeamMember>
Expand Down
6 changes: 3 additions & 3 deletions src/containers/JudgingPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const JudgingPanel = () => {
numProjects: 0,
})
const [toggle, setToggle] = useState({})
const { dbHackathonName } = useHackathon()
const { activeHackathon, dbHackathonName } = useHackathon()

const removeGrade = async row => {
const { id, gradeId, ...score } = row
Expand Down Expand Up @@ -242,7 +242,7 @@ const JudgingPanel = () => {

const setProjectsAndStats = async () => {
setLoading(true)
setGradedProjects(await getGradedProjects(dbHackathonName))
setGradedProjects(await getGradedProjects(2, dbHackathonName))
setGrades(await getGrades(dbHackathonName))
getStats(dbHackathonName).then(data => setStats(data))
setLoading(false)
Expand Down Expand Up @@ -298,7 +298,7 @@ const JudgingPanel = () => {
const portalLink = window.location.origin // to support local development as well
const projectInfo = {
'Title': project.title,
'Link': `${portalLink}/projects/${project.id}`,
'Link': `${portalLink}/app/${activeHackathon}/projects/${project.id}`,
'Devpost': project.links.devpost,
'Charity choice': project.charityChoice,
}
Expand Down
6 changes: 4 additions & 2 deletions src/pages/Judging/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ const Judging = () => {
: false

if (!isValidProject) {
console.error('User cannot access judging: No valid submitted project found')
console.log('User:', user.uid, 'Submitted Project:', submittedProject)
setIsBlocked(true)
} else {
setProjects(await getProjects(user.uid, submittedProject, dbHackathonName))
Expand All @@ -138,8 +140,8 @@ const Judging = () => {
if (isBlocked) {
return (
<HeroPage>
<h2>Error, permission denied</h2>
<p>To access judging you must have submitted a project</p>
<h2>There was an error</h2>
<p>Please contact an organizer to resolve this issue!</p>
</HeroPage>
)
}
Expand Down

0 comments on commit 4f5ab7c

Please sign in to comment.