From 664f9e33bc30cf5c7ac57b9136a1f093f3fc2b6c Mon Sep 17 00:00:00 2001 From: kashgarg Date: Fri, 13 Dec 2024 00:13:52 -0800 Subject: [PATCH 1/3] added release liability checkbox --- pages/status.js | 15 ++++++++++++++- utility/firebase.js | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/pages/status.js b/pages/status.js index cd8d29eb..6d24943e 100644 --- a/pages/status.js +++ b/pages/status.js @@ -1,7 +1,7 @@ import { useState } from 'react' import styled from 'styled-components' import Page from '../components/page' -import { getHackathons, getApplicants, updateApplicantStatus } from '../utility/firebase' +import { getHackathons, getApplicants, updateApplicantStatus, updateReleaseLiabilityCheck } from '../utility/firebase' import Button from '../components/button' import Checkbox from '../components/checkbox' @@ -59,6 +59,7 @@ export default function Status({ hackathons }) { const [statusSelected, setStatusSelected] = useState('') const [success, setSuccess] = useState('') const [error, setError] = useState('') + const [liabilityStatusSelected, setLiabilityStatusSelected] = useState(false) const validateInputs = () => { if (!emails) { @@ -104,6 +105,9 @@ export default function Status({ hackathons }) { for (const userId of filteredApplicants) { await updateApplicantStatus(userId, statusSelected, hackathonSelected) + if (statusSelected === 'acceptedAndAttending') { + await updateReleaseLiabilityCheck(userId, liabilityStatusSelected, hackathonSelected) + } } if (filteredApplicants.length > 0) { @@ -151,6 +155,15 @@ export default function Status({ hackathons }) { ))} + {statusSelected === 'acceptedAndAttending' && ( +
+ setLiabilityStatusSelected(!liabilityStatusSelected)} + /> +
+ )}