Skip to content

Commit

Permalink
Merge pull request #578 from ubc-biztech/dev
Browse files Browse the repository at this point in the history
hello-hacks 2024 companion update
  • Loading branch information
AllanT102 authored Sep 19, 2024
2 parents 781941a + 21f73c3 commit 8493302
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/pages/admin/Event/EventStats/EventStatsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ const EventStatsTable = (props) => {
color="primary"
onClick={() => toggleMassUpdateModal()}
>
Mass Update Status
Mass Update Application Status
</Button>

<MassUpdateModal
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/Event/EventStats/MassUpdateModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const MassUpdateModal = ({

return (
<Dialog open={open} onClose={onClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Mass Update User Status</DialogTitle>
<DialogTitle id="form-dialog-title">Mass Update Application Status</DialogTitle>
<DialogContent>
<TextField
autoFocus
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/Event/EventStats/MassUpdateUserStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const MassUpdateModal = ({

return (
<Dialog open={open} onClose={onClose} aria-labelledby="form-dialog-title">
<DialogTitle id="form-dialog-title">Mass Update User Status</DialogTitle>
<DialogTitle id="form-dialog-title">Mass Update Application Status</DialogTitle>
<DialogContent>
<TextField
autoFocus
Expand Down
22 changes: 8 additions & 14 deletions src/pages/public/Companion/components/CompanionLayout.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, {
useState, useEffect, useRef
} from "react";
// import Lottie from "lottie-react"
import {
motion, useAnimation
} from "framer-motion";
import {
useInView
} from "react-intersection-observer";
import {
// TextField,
// Button,
TextField,
Button,
makeStyles, Typography, useMediaQuery
} from "@material-ui/core";
import {
Expand Down Expand Up @@ -140,7 +139,7 @@ const CompanionLayout = (params) => {
landing
},
email,
// setEmail,
setEmail,
isLoading,
error,
userRegistration,
Expand Down Expand Up @@ -305,7 +304,7 @@ const CompanionLayout = (params) => {
...extraStyles
};

// const [input, setInput] = useState("");
const [input, setInput] = useState("");
const [transition, setShowTransition] = useState(false);
const [showVideo, setShowVideo] = useState(false);
const [showBackground, setShowBackground] = useState(false);
Expand Down Expand Up @@ -405,13 +404,8 @@ const CompanionLayout = (params) => {
}}>Welcome!</Typography>
<Typography className={classes.centerText} style={{
color: constantStyles.textColor
// HOT FIX old -> Please enter the email you used to register for {title}
}}>Thanks for applying to Hello Hacks 2024</Typography>
<Typography className={classes.centerText} style={{
color: constantStyles.textColor
// HOT FIX
}}>Check back later for your application status! </Typography>
{/* <TextField
}}>Please enter the email you used to register for {title}</Typography>
<TextField
className={classes.textfield}
onChange={(e) => setInput(e.target.value)}
value={input}
Expand All @@ -434,7 +428,7 @@ const CompanionLayout = (params) => {
}}
>
Confirm
</Button> */}
</Button>
<Typography className={classes.errorText} style={{
color: constantStyles.textColor
}}>{error}</Typography>
Expand All @@ -455,7 +449,7 @@ const CompanionLayout = (params) => {
paddingBottom: "0.75rem"
}}>
<LogoutButton />
<img src={Logo} alt={`${title} Logo`} style={renderMobileOnly ? styles.mobileHomeLogo : styles.homeLogo} />
{!event && !registrations && <img src={Logo} alt={`${title} Logo`} style={renderMobileOnly ? styles.mobileHomeLogo : styles.homeLogo} />}
<nav role="navigation" style={{
...styles.nav,
...(renderMobileOnly && {
Expand Down
176 changes: 176 additions & 0 deletions src/pages/public/Companion/events/HelloHacks2024.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
import React, {
useState
} from "react";
import {
Button
} from "@material-ui/core";
import {
constantStyles
} from "../../../../constants/_constants/companion";
import {
COLORS
} from "../../../../constants/_constants/theme";
import {
fetchBackend
} from "utils";

const customStyles = {
container: {
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column",
gap: "5px"
},
options: {
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column",
width: "100%",
marginBottom: "15px"
},
footer: {
left: "-10px",
width: "120%",
right: "-10px",
bottom: "0"
},
background: {
width: "120%",
height: "100%"
},
backgroundMobile: {
width: "150%",
height: "100%",
},
registerButton: {
textTransform: "none",
backgroundColor: COLORS.BIZTECH_GREEN,
color: COLORS.BACKGROUND_COLOR,
"&:disabled": {
backgroundColor: COLORS.FONT_GRAY,
color: COLORS.WHITE
}
},
mailToLink: {
color: COLORS.WHITE,
textDecoration: "none",
"&:hover": {
color: COLORS.WHITE,
}
}

};

const HelloHacks2024 = (params) => {
const {
event, registrations, styles, renderMobileOnly, userRegistration
} = params;
const [isWithdrawing, setIsWithdrawing] = useState(false);

const withdrawApplication = async () => {
try {
const body = {
eventID: event.id,
year: Number(event.year),
registrationStatus: "cancelled",
applicationStatus: "rejected"
};
setIsWithdrawing(true);
const isConfirmed = confirm("Are you sure? Once you've withdrawn you cannot resubmit your application");
if (isConfirmed) {
const result = await fetchBackend(`/registrations/${userRegistration.id}/${userRegistration.fname}`, "PUT", body, false);
if (result) {
console.log(result);
setIsWithdrawing(false);
location.reload();
}
} else {
setIsWithdrawing(false);
}
} catch (e) {
alert("an error has occured");
console.log(e);
setIsWithdrawing(false);
}
};


const renderStatus = () => {
const status = userRegistration.applicationStatus;
if (status === "reviewing") {
return (
<div style={{
color: "white"
}}>
<h1>Your application is in review, please check back for more details!</h1>
</div>
);
} else if (status === "waitlist") {
return (
<div style={{
color: "white"
}}>
<h1>Your application is currently waitlisted, you will be contacted if spots open up!</h1>
</div>
);
} else if (status === "accepted") {
return (
<div style={{
color: "white"
}}>
<h1>You have been accepted! Stay tuned for more details :)</h1>
</div>
);
} else if (status === "rejected") {
return (
<div style={{
color: "white"
}}>
<h1>Your application is withdrawn, we're sad to see you go :(</h1>
</div>
);
}
};

return (<div style={customStyles.container}>
{event && registrations &&
<>
{renderStatus()}
{userRegistration.applicationStatus !== "rejected" && <span style={{
...styles.text,
...(renderMobileOnly && {
fontSize: constantStyles.mobileFontSize
})
}}>Want to withdraw your application?<Button
style={{
...customStyles.registerButton,
marginLeft: "5px"
}}
variant="contained"
color="primary"
type="submit"
onClick={() => withdrawApplication()}
disabled={isWithdrawing}
>
Click here
</Button></span>}
<div style={{
...styles.text,
width: "100%",
marginBottom: "0px",
...(renderMobileOnly && {
fontSize: constantStyles.mobileFontSize
})
}}>
Contact <a href="mailto:[email protected]" style={customStyles.mailToLink}>[email protected]</a> for any questions or concerns.
</div>
</>
}
</div>
);
};

export default HelloHacks2024;

58 changes: 16 additions & 42 deletions src/pages/public/Companion/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import PHLogo from "../../../../assets/2024/produhacks/btlogo.png";
import TechStyleLogo from "../../../../assets/2024/techstyle/techstyle_logo.png";
import TechStyleTexture from "../../../../assets/2024/techstyle/techstyle_grid.png";
import TSLogo from "../../../../assets/2024/techstyle/techstyle_biztech_logo.png";
import HelloHacks2024 from "./HelloHacks2024";

export default [
{
Expand Down Expand Up @@ -393,66 +394,39 @@ export default [
},
{
/* Date indicating when event ends, this also indicates which app the companion app will render, to be safe, but a couple days after event ends */
activeUntil: new Date(new Date("2024-10-10").getTime() + (7 * 24 * 60 * 60 * 1000)),
activeUntil: new Date(new Date("09-18-2024").getTime() + (7 * 24 * 60 * 60 * 1000)), // change 3 days after date
/* id of event in dynamodb, used for queries */
eventID: "hello-hacks",
/* year of event in dynamodb, used for queries */
year: 2023,
/* component for event body */
ChildComponent: DataAndBeyond2023,
year: 2024,
/* component for event body */ // keep the same
ChildComponent: HelloHacks2024,
/* options defining params for the companionLayout */
options: {
disableWelcomeHeader: true,
/* Biztech logo for event */
BiztechLogo: BizTechDBLogo,
BiztechLogo: BiztechLogo,
/* Logo for event */
Logo: DBLogo,
Logo: BiztechLogo,
/* Displayed title of event */
title: "Hello Hacks 2024",
title: "HelloHacks 2024",
/* Displayed date of event */
date: "Saturday, October 5th",
date: "October 5-6, 2024",
/* Displayed location of event */
location: "Henry Angus Building",
location: "Sauder Henry Angus",
/* color theme of event */
colors: {
primary: "linear-gradient(180deg, #614AD7, #719DF8)",
background: "linear-gradient(180deg, #e3edf7, #e3edf7)",
primary: "linear-gradient(180deg, white, white)",
background: "linear-gradient(0.5turn, #98BEA2, #98BEA2, #98BEA2)",
},
/* function to return schedule of event, schedule is an array of date and title, regData is the responses of a registration */
getScheduleData: (regData) => [
{
date: "5:30 pm - 6:00 pm",
title: "Registration & Check in",
},
{
date: "6:00 pm - 6:15 pm",
title: "Opening (BizTech and BOLT Introduction)",
},
{
date: "6:15 pm - 6:30 pm",
title: "Keynote Speech",
},
{
date: "6:30 pm - 7:00 pm",
title: `Workshop: ${regData.dynamicResponses["a3f58578-219c-4e8f-b4be-8af8f6b9e1fb"]}`,
},
{
date: "7:30 pm - 8:00 pm",
title: "Data Challenge",
},
{
date: "8:00 pm - 9:00 pm",
title: "Boothing and Networking Session",
}
],
getScheduleData: () => [],
/* Array of welcome paragraphs for event, each new index is a new paragraph */
welcomeData: [
"Welcome to Hello Hacks 2024!"
],
/* Array of header tabs to navigate for event, id is the id of the div in app, and text is the heaidng text */
headers: [{
text: "Partners",
id: "Partners"
}]
headers: [
]
}
}
];

0 comments on commit 8493302

Please sign in to comment.