Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kayla/submissions page #415

Merged
merged 6 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 82 additions & 55 deletions src/components/MenuBar/ButtonBar.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,131 @@
import React from 'react';
import Button from '@material-ui/core/Button';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/core/styles';
import { Link as GatsbyLink } from 'gatsby';
import { Link as MUILink } from '@material-ui/core';
import React from "react"

Check failure on line 1 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote

Check failure on line 1 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
import Button from "@material-ui/core/Button"

Check failure on line 2 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote

Check failure on line 2 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
import PropTypes from "prop-types"

Check failure on line 3 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote

Check failure on line 3 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
import { makeStyles } from "@material-ui/core/styles"

Check failure on line 4 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote

Check failure on line 4 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
import { Link as GatsbyLink } from "gatsby"

Check failure on line 5 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Strings must use singlequote

Check failure on line 5 in src/components/MenuBar/ButtonBar.js

View workflow job for this annotation

GitHub Actions / eslint

Missing semicolon
import { Link as MUILink } from "@material-ui/core"

import { applicationOpen, applyDeadline } from '../constants.js';
import {
applicationOpen,
applyDeadline,
hothStart,
hothEnd,
} from "../constants.js"

const useStyles = makeStyles(theme => {
const menuBarAdaptiveThreshold = theme.breakpoints.values.sm * 1.3;
const menuBarAdaptiveThreshold = theme.breakpoints.values.sm * 1.3
return {
btn: {
fontWeight: 500
fontWeight: 500,
},
borderBtn: {
margin: 10,
color: '#FFFFFF',
transition: theme.transitions.create(['color', 'background'], {
duration: theme.transitions.duration.complex
color: "#FFFFFF",
transition: theme.transitions.create(["color", "background"], {
duration: theme.transitions.duration.complex,
}),
'&:hover': {
background: '#DB99FD'
"&:hover": {
background: "#DB99FD",
},
[theme.breakpoints.down(menuBarAdaptiveThreshold)]: {
// mobile
margin: 0
}
}
};
});
margin: 0,
},
},
}
})

function ButtonBar({ isMobile }) {
const classes = useStyles();
const classes = useStyles()

const PoppinLink = ({ ...props }) =>
<Button component={GatsbyLink} role='link' fullWidth={isMobile} className={classes.btn} {...props} />;
const PoppinLink = ({ ...props }) => (
<Button
component={GatsbyLink}
role="link"
fullWidth={isMobile}
className={classes.btn}
{...props}
/>
)

const BorderLink = ({ ...props }) =>
const BorderLink = ({ ...props }) => (
<Button
component={MUILink}
role='link'
role="link"
className={classes.borderBtn}
style={{ margin: 10, textDecoration: 'none' }}
variant='contained'
style={{ margin: 10, textDecoration: "none" }}
variant="contained"
{...props}
color='secondary'
/>;
color="secondary"
/>
)

const links = [
{
name: 'Home',
to: '/'
name: "Home",
to: "/",
},
{
name: 'Announcements',
to: '/announcements'
name: "Announcements",
to: "/announcements",
},
{
name: 'Schedule',
to: '/schedule'
name: "Schedule",
to: "/schedule",
},
{
name: 'Workshops',
to: '/workshops'
name: "Workshops",
to: "/workshops",
},
{
name: 'Prizes',
to: '/prizes'
name: "Prizes",
to: "/prizes",
},
{
name: 'Gallery',
to: '/gallery/hoth-x' // need to update this link to be latest HOTH
}
];
name: "Gallery",
to: "/gallery/hoth-x", // need to update this link to be latest HOTH
},
]

return (
<>
{links.map((link, index) =>
{links.map((link, index) => (
<PoppinLink to={link.to} key={`nav-${index}`}>
{link.name}
</PoppinLink>)}
{
</PoppinLink>
))}

{Date.now() < hothStart.getTime() ? (
<BorderLink
disabled={Date.now() < applicationOpen.getTime() || Date.now() > applyDeadline.getTime()}
href={'https://forms.gle/VMhdCzMov8RvGUfP8'}
target='_blank'
disabled={
Date.now() < applicationOpen.getTime() ||
Date.now() > applyDeadline.getTime()
}
href={"https://forms.gle/VMhdCzMov8RvGUfP8"}
target="_blank"
>
Apply
</BorderLink>
}
) : (
<BorderLink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After HOTH ends, this Submit button will show as a disabled button, which is not an issue but is that functionality you want? Imo, it might be weird to have a disabled Submit button for the rest of the year when HOTH is not running, but we can always fix that later.

disabled={
Date.now() < hothStart.getTime() || Date.now() > hothEnd.getTime()
}
href="/submissions"
>
Submit
</BorderLink>
)}
</>
);
)
}

ButtonBar.propTypes = {
isMobile: PropTypes.bool
};
isMobile: PropTypes.bool,
}

ButtonBar.defaultProps = {
isMobile: false
};
isMobile: false,
}

export default ButtonBar;
export default ButtonBar
91 changes: 91 additions & 0 deletions src/components/SubmissionsPage/Submissions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { useState } from "react"
import { makeStyles } from "@material-ui/core/styles"
import Typography from "@material-ui/core/Typography"
import Container from "@material-ui/core/Container"

const useStyles = makeStyles(theme => ({
title: {
fontWeight: theme.typography.fontWeightBold,
paddingTop: theme.spacing(11),
[theme.breakpoints.down("sm")]: {
paddingTop: theme.spacing(4),
},
paddingBottom: theme.spacing(4),
},
info: {
paddingTop: theme.spacing(4),
},
link: {
color: theme.palette.secondary.main,
},
linkClicked: {
color: theme.palette.secondary.dark,
},
}))

const SubmissionsPage = () => {
const classes = useStyles()

const [formClicked, setFormClicked] = useState(false)
const [devPostClicked, setDevPostClicked] = useState(false)

const handleFormClick = () => {
setFormClicked(true)
}

const handleDevPostClick = () => {
setDevPostClicked(true)
}

return (
<Container maxWidth="md">
<Typography
align="left"
variant="h4"
component="h1"
className={classes.title}
>
Submission Info
</Typography>

<Typography align="left" variant="h5" component="h2">
Follow These 2 Final Steps to Submit Your Project:
</Typography>

<Typography className={classes.info}>
1{")"} Submit the project on the HOTH XI{" "}
<a
Copy link
Member

@maggieelli maggieelli Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason we used the <a> tag here instead of MUI's <Link> tag? If not, maybe switch to <Link>

There's an example of this tag's usage in src/components/HomePage/HothDescription.js

href="https://hoth-xi.devpost.com/?ref_feature=challenge&ref_medium=discover"
target="_blank"
className={devPostClicked ? classes.linkClicked : classes.link}
onClick={handleDevPostClick}
>
devpost
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: can we capitalize "Devpost"

</a>
</Typography>

<Typography className={classes.info}>
2{")"} Fill out the{" "}
<a
Copy link
Member

@maggieelli maggieelli Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to <Link> tag here too potentially?

href="https://forms.gle/VPBHtLTyPo1pn7pn9"
target="_blank"
className={formClicked ? classes.linkClicked : classes.link}
onClick={handleFormClick}
>
HOTH XI Submission Form
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another small nit: can we add "Google" before "Form" and make it so that the link only includes "Submission Google Form"

So it would say "2) Fill out the HOTH XI Submission Google Form" with the link being for "Submission Google Form"

</a>
</Typography>

<Typography
className={classes.info}
align="left"
variant="h6"
component="h3"
>
Thank You for Participating in HOTH XI!
</Typography>
</Container>
)
}

export default SubmissionsPage
6 changes: 3 additions & 3 deletions src/components/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const hothStart = new Date('2024-03-02T08:00:00-08:00');
export const hothEnd = new Date('2024-03-02T23:00:00-08:00');
export const applyDeadline = new Date('2024-02-26T23:59:59-08:00');
export const hothStart = new Date('2024-03-03T08:00:00-08:00');
export const hothEnd = new Date('2024-03-03T23:00:00-08:00');
export const applyDeadline = new Date('2024-02-28T23:59:59-08:00');
export const applicationOpen = new Date('2024-01-29T08:00:00-08:00');
export const scheduleAvailableTime = new Date('2024-02-26T08:00:00-08:00');
15 changes: 15 additions & 0 deletions src/pages/submissions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';

import Layout from '../components/layout';
import SEO from '../components/seo';
import Submissions from '../components/SubmissionsPage/Submissions';


const SubmissionsPage = () => {
return <Layout>
<SEO title='Submissions' />
<Submissions/>
</Layout>;
};

export default SubmissionsPage;
Loading