Skip to content

Commit

Permalink
TartanHacks 2025 Bug Fixes (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzhou08 authored Dec 24, 2024
1 parent f7e82b7 commit 376ef1b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 75 deletions.
91 changes: 47 additions & 44 deletions pages/teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,53 +150,56 @@ export default function ViewTeams(props: SSRDataAuth<TeamData>['props']) {
<Menu />
<WaveHeader variant="light" />
<div>

<WaveFooter />
<FloatingDiv>
<ContentHeader title="Team" />
{!loading ? (
<form
className={styles.buttonForm}
onClick={async (e) => {
e.preventDefault();
router.push('/teams/create');
}}
>
<RectangleButton
type="submit"
className={styles.newTeamButton}
<div className={styles.dialog}>
<FloatingDiv>
<ContentHeader title="Team" />
{!loading ? (
<form
className={styles.buttonForm}
onClick={async (e) => {
e.preventDefault();
router.push('/teams/create');
}}
>
<RectangleButton
type="submit"
className={styles.newTeamButton}
>
Create new team
</RectangleButton>
</form>
) : null}
<Collapse in={loading}>
<div className={styles.spinnerContainer}>
<CircularProgress />
</div>
</Collapse>
<div className={styles.tableHeader}>
<Typography
variant="h4"
className={styles.tableHeaderText}
>
Create new team
</RectangleButton>
</form>
) : null}
<Collapse in={loading}>
<div className={styles.spinnerContainer}>
<CircularProgress />
Open Teams
</Typography>
</div>
</Collapse>
<div className={styles.tableHeader}>
<Typography
variant="h4"
className={styles.tableHeaderText}
>
Open Teams
</Typography>
</div>
{emptyMessage}
<table className={styles.tableData}>
<tbody>
{teams
.sort((a, b) => +a._id - +b._id)
.map((team, idx) => (
<TeamTableEntry
team={team}
key={idx}
callback={checkJoinErrorCallback}
/>
))}
</tbody>
</table>
</FloatingDiv>
{emptyMessage}
<table className={styles.tableData}>
<tbody>
{teams
.sort((a, b) => +a._id - +b._id)
.map((team, idx) => (
<TeamTableEntry
team={team}
key={idx}
callback={checkJoinErrorCallback}
/>
))}
</tbody>
</table>
</FloatingDiv>
</div>
<Snackbar
open={notify === 'error' || notify === 'success'}
autoHideDuration={5000}
Expand Down
Binary file removed public/THCodeOfConduct.pdf
Binary file not shown.
2 changes: 0 additions & 2 deletions src/actions/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export const rejectAll = (): DispatchAction => ({

export const confirm = (
signatureLiability: boolean,
signatureCodeOfConduct: boolean,
willMentor: boolean,
): DispatchAction => ({
type: DispatchActionType.USER_CONFIRM,
Expand All @@ -102,7 +101,6 @@ export const confirm = (
method: 'PUT',
body: {
signatureLiability,
signatureCodeOfConduct,
willMentor,
},
},
Expand Down
30 changes: 2 additions & 28 deletions src/components/confirmation/ConfirmationDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Collapse,
FormControlLabel,
FormGroup,
Hidden,
IconButton,
LinearProgress,
Link,
Expand All @@ -26,7 +27,6 @@ const ConfirmationDialog = (): ReactElement => {
const [loading, setLoading] = useState(false);

const [signatureLiability, setSignatureLiability] = useState(false);
const [signatureCodeOfConduct, setSignatureCodeOfConduct] = useState(false);
const [willMentor, setWillMentor] = useState(false);

const confirmTime = useSelector(
Expand All @@ -43,7 +43,6 @@ const ConfirmationDialog = (): ReactElement => {
await dispatch(
actions.user.confirm(
signatureLiability,
signatureCodeOfConduct,
willMentor,
),
);
Expand Down Expand Up @@ -75,6 +74,7 @@ const ConfirmationDialog = (): ReactElement => {
<div className={styles.dialogText}>
<FormGroup className={styles.formGroup}>
<FormControlLabel
sx={{ ".MuiFormControlLabel-asterisk": { display: "none" } }}
control={
<Checkbox
required
Expand All @@ -100,32 +100,6 @@ const ConfirmationDialog = (): ReactElement => {
</Typography>
}
/>
<FormControlLabel
control={
<Checkbox
required
checked={signatureCodeOfConduct}
onChange={(e) =>
setSignatureCodeOfConduct(
e.target.checked,
)
}
/>
}
label={
<Typography>
I agree with the{' '}
<Link
target="_blank"
href="/THCodeOfConduct.pdf"
className={styles.link}
>
TartanHacks Code of Conduct
</Link>
.*
</Typography>
}
/>
<FormControlLabel
control={
<Checkbox
Expand Down
1 change: 1 addition & 0 deletions src/components/form/ApplicationForm/BasicSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ const BasicSection = ({
error={ageErrorStatus}
helperText={ageHelper}
variant="outlined"
required
fullWidth
value={age}
onChange={(e) => {
Expand Down
16 changes: 15 additions & 1 deletion src/components/form/ApplicationForm/TravelSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,22 @@ const TravelSection = ({
const [wantsTravelReimbursement, setWantsTravelReimbursement] = useState<boolean>(false);
const [travelDetails, setTravelDetails] = useState<string>('');

// Error fields
const [travelInfoErrorStatus, setTravelInfoErrorStatus] = useState(false);
const [travelInfoHelper, setTravelInfoHelper] = useState<string>('');

const validateForm = async () => {
const data: TravelFields = { wantsTravelReimbursement, travelDetails };
await dispatch(actions.application.saveTravel(data));
setValid(true);

let valid = true;
if (wantsTravelReimbursement && travelDetails.length === 0) {
setTravelInfoErrorStatus(true);
setTravelInfoHelper('Please provide travel details if you want to apply for travel reimbursement');
valid = false;
}

setValid(valid);
setValidate(false);
};

Expand Down Expand Up @@ -81,6 +93,8 @@ const TravelSection = ({
<TextField
label="Travel details"
variant="outlined"
error={travelInfoErrorStatus}
helperText={travelInfoHelper}
fullWidth
multiline
value={travelDetails}
Expand Down
8 changes: 8 additions & 0 deletions styles/ViewTeams.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
@import './variables.scss';
@import './mixins.scss';

.dialog {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.newTeamButton {
padding: 1em 5em !important;
font-size: large !important;
Expand Down

0 comments on commit 376ef1b

Please sign in to comment.