Skip to content

Commit

Permalink
Merge pull request #163 from HackHPI/feature/activate-registration
Browse files Browse the repository at this point in the history
Feature/activate registration
  • Loading branch information
DerCed authored Jan 15, 2025
2 parents ab6a6d0 + 0e51613 commit 2c1d06f
Show file tree
Hide file tree
Showing 14 changed files with 29,762 additions and 577 deletions.
7 changes: 4 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Jury from "../components/Jury/Jury";
import {Features} from "../components/Features/Features";
import LandingImage from "../components/LandingImage/LandingImage";
import {Gallery} from "../components/Gallery/Gallery";
import Registration from "../components/Registration/Registration";

export default function Page() {
return (
Expand All @@ -20,8 +21,8 @@ export default function Page() {
<Sponsors25/>
<Gallery/>
<Newsletter/>
{/*<Registration />
<Location />*/}
<Registration />
{/* <Location />*/}
<Speakers/>
<Jury/>
{/*
Expand All @@ -31,4 +32,4 @@ export default function Page() {
<Team/>
</>
)
}
}
10 changes: 6 additions & 4 deletions src/app/verify/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useEffect} from "react";
import {RegistrationRest} from "../../rest/RegistrationRest";
import {Box, CircularProgress, Typography} from "@mui/material";
import {useRouter} from "next/navigation";
import {ParticipantRest} from "../../rest/ParticipantRest";

export default function Page() {

Expand All @@ -11,9 +12,10 @@ export default function Page() {
useEffect(() => {
if (typeof window !== 'undefined') {
const queryParameters = new URLSearchParams(window?.location?.search)
const type = queryParameters.get("token")
const registrationRest = new RegistrationRest()
registrationRest.verifyToken(type).then(() => router.push("/?isVerified=true"))
const token = queryParameters.get("t")
const participant = queryParameters.get("p")
const participantRest = new ParticipantRest()
participantRest.verifyToken(participant, token).then(() => router.push("/?isVerified=true"))
}

}, []);
Expand All @@ -23,4 +25,4 @@ export default function Page() {
<Typography>Verifying your Token</Typography>
</Box>
</Box>
}
}
188 changes: 106 additions & 82 deletions src/components/LandingImage/LandingImage.jsx
Original file line number Diff line number Diff line change
@@ -1,89 +1,113 @@
'use client'
import {Box, Button, Card, Container, Stack, Typography} from "@mui/material";
import {TypeAnimation} from "react-type-animation";
import Countdown from "./Countdown.jsx";
import {CalendarMonthOutlined, Camera, CameraAlt, LocationOn} from "@mui/icons-material";
import {useEffect, useState} from "react";
import {MeshContainer} from "./MeshContainer/MeshContainer";
"use client";
import { Button, Card, Container, Stack, Typography } from "@mui/material";
import { TypeAnimation } from "react-type-animation";
import { Article, CalendarMonthOutlined } from "@mui/icons-material";
import { useEffect, useState } from "react";
import { MeshContainer } from "./MeshContainer/MeshContainer";

function LandingImage() {
const [timeLeft, setTimeLeft] = useState(calculateTimeDiff());

const [timeLeft, setTimeLeft] = useState(calculateTimeDiff())
function calculateTimeDiff() {
return new Date(new Date(2025, 2, 21) - new Date());
}

function calculateTimeDiff() {
return new Date(new Date(2025, 2, 21) - new Date())
}

useEffect(() => {
const i = setInterval(() => {
setTimeLeft(calculateTimeDiff())
}, 1000);
return () => clearInterval(i);
}, []); //dependency, if end changes remount

return (
<MeshContainer>

<Container sx={{height: "100%", width: "100%", display: "flex", flexDirection: "column", justifyContent: "space-around", minHeight: "60vh"}}>
<img src={"/HackHPI_white.svg"} width={"150rem"} alt={"HackHPI Logo"}/>
<div>
<Typography sx={{color: "white"}} variant={"h2"} component={"h1"}>
Medical Edition
</Typography>
<Typography variant={"h4"} component={"h2"}>
<TypeAnimation
preRenderFirstString={true}
sequence={[
500,
'For better',
500,
'For better health', // initially rendered starting point
1000,
'For better diagnosis', // initially rendered starting point,
1000,
'For better treatments', // initially rendered starting point
1000,
`See you in ${Math.round(timeLeft / (24 * 60 * 60 * 1000))} Days!`,
10000,
]}
speed={50}
repeat={Infinity}
/>
</Typography>
</div>
<Stack direction={"row"} spacing={3} useFlexGap flexWrap="wrap">
<Button
variant={"contained"}
sx={{
borderWidth: "1rem",
width: "13rem",
height: "3.5rem",
fontSize: "1rem",
}}
color={"primary"}
startIcon={<CameraAlt/>}
onClick={() => document.getElementById("images").scrollIntoView({
behavior: "smooth",
block: "start",
inline: "nearest"
})}
>
Images
</Button>
<Card sx={{height: "3.5rem", justifyContent: "center", display: "flex"}}>
<Stack direction={"row"} alignItems={"center"} display={"flex"}
sx={{height: "100%", paddingRight: "1.25rem", paddingLeft: "1.25rem",}} spacing={2}>
<CalendarMonthOutlined sx={{fontSize: "1.5rem", color: "text.disabled"}}/>
<Typography sx={{fontSize: "1rem"}} color={"text.disabled"} noWrap>
21th - 22th March 2025
</Typography>
</Stack>
</Card>
</Stack>
</Container>
</MeshContainer>
)
useEffect(() => {
const i = setInterval(() => {
setTimeLeft(calculateTimeDiff());
}, 1000);
return () => clearInterval(i);
}, []); //dependency, if end changes remount

return (
<MeshContainer>
<Container
sx={{
height: "100%",
width: "100%",
display: "flex",
flexDirection: "column",
justifyContent: "space-around",
minHeight: "60vh",
}}
>
<img src={"/HackHPI_white.svg"} width={"150rem"} alt={"HackHPI Logo"} />
<div>
<Typography sx={{ color: "white" }} variant={"h2"} component={"h1"}>
Medical Edition
</Typography>
<Typography variant={"h4"} component={"h2"}>
<TypeAnimation
preRenderFirstString={true}
sequence={[
500,
"For better",
500,
"For better health", // initially rendered starting point
1000,
"For better diagnosis", // initially rendered starting point,
1000,
"For better treatments", // initially rendered starting point
1000,
`See you in ${Math.round(timeLeft / (24 * 60 * 60 * 1000))} Days!`,
10000,
]}
speed={50}
repeat={Infinity}
/>
</Typography>
</div>
<Stack direction={"row"} spacing={3} useFlexGap flexWrap="wrap">
<Button
variant={"contained"}
sx={{
borderWidth: "1rem",
width: "13rem",
height: "3.5rem",
fontSize: "1rem",
}}
color={"primary"}
startIcon={<Article />}
onClick={() =>
document.getElementById("signupForm").scrollIntoView({
behavior: "smooth",
block: "start",
inline: "nearest",
})
}
>
Registration
</Button>
<Card
sx={{ height: "3.5rem", justifyContent: "center", display: "flex" }}
>
<Stack
direction={"row"}
alignItems={"center"}
display={"flex"}
sx={{
height: "100%",
paddingRight: "1.25rem",
paddingLeft: "1.25rem",
}}
spacing={2}
>
<CalendarMonthOutlined
sx={{ fontSize: "1.5rem", color: "text.disabled" }}
/>
<Typography
sx={{ fontSize: "1rem" }}
color={"text.disabled"}
noWrap
>
21th - 22th March 2025
</Typography>
</Stack>
</Card>
</Stack>
</Container>
</MeshContainer>
);
}

export default LandingImage
export default LandingImage;
117 changes: 117 additions & 0 deletions src/components/Registration/GroupManager/GroupManager.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import {
Box,
Button,
Divider,
Grid,
Stack,
TextField,
Typography,
} from "@mui/material";
import { LoadingButton } from "@mui/lab";
import {useEffect, useMemo, useState} from "react";
import { GroupRest } from "../../../rest/GroupRest";

export function GroupManager(props) {
const [loadingNewTeam, setLoadingNewTeam] = useState(false);
const [fetchingExistingTeam, setFetchingExistingTeam] = useState(false);
const [group, setGroup] = useState(false);
const [groupInput, setGroupInput] = useState("");
const [groupInputError, setGroupInputError] = useState(false);
const groupRest = useMemo(() => new GroupRest(), []);


function createNewGroup() {
setLoadingNewTeam(true);
setGroupInputError(false)
groupRest.createGroup(props.eventId).then((response) => {
setLoadingNewTeam(false);
setGroup(response.data);
});
}

function getGroup() {
setFetchingExistingTeam(true);
setGroupInputError(false)
groupRest
.getGroup(props.eventId, groupInput)
.then((response) => {
setFetchingExistingTeam(false);
setGroup(response.data);
})
.catch((error) => {
setFetchingExistingTeam(false);
setGroupInput("");
setGroupInputError(true);
});
}

useEffect(() => {
props.onGroupChange(group)
}, [group]);

function renderGroupSelection() {
return (
<Box sx={{ pt: 5, pb: 5 }}>
<Stack direction="row" spacing={2}>
<TextField
fullWidth
label={"Enter team name (e.g. chalk-increase-vague)"}
value={groupInput}
onChange={(event) => setGroupInput(event.target.value)}
error={groupInputError}
helperText={
groupInputError ? "Did not find specified group" : undefined
}
/>
<LoadingButton
variant={"outlined"}
disabled={loadingNewTeam}
loading={fetchingExistingTeam}
onClick={getGroup}
>
Join
</LoadingButton>
</Stack>
<Divider sx={{ pt: 2, pb: 2 }}> or </Divider>
<Box sx={{ width: "100%", display: "flex", justifyContent: "center" }}>
<LoadingButton
variant={"outlined"}
color={"primary"}
onClick={createNewGroup}
loading={loadingNewTeam}
disabled={fetchingExistingTeam}
>
Create new Team
</LoadingButton>
</Box>
</Box>
);
}

function renderGroup() {
return (
<Box sx={{ pt: 5, pb: 5 }}>
<Typography gutterBottom>You are assigned to the group</Typography>
<Typography sx={{ fontWeight: 800, pb: 3 }} variant={"h5"}>
{group.phrase}
</Typography>
<Button variant="outlined" onClick={() => setGroup(null)}>
Reset Group
</Button>

<Typography sx={{ pt: 4 }}>
share this name to your team members
</Typography>
<Typography color={"text.secondary"}>
This is not your actual team name at the event
</Typography>
</Box>
);
}

return (
<Grid item md={12} xs={12}>
{group ? renderGroup() : renderGroupSelection()}
</Grid>
);
}
Loading

0 comments on commit 2c1d06f

Please sign in to comment.