diff --git a/app/closed/closed.module.scss b/app/closed/closed.module.scss new file mode 100644 index 00000000..32d819dc --- /dev/null +++ b/app/closed/closed.module.scss @@ -0,0 +1,92 @@ +.screen { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 100vw; + min-height: 100vh; + gap: 30px; + + background-size: cover; + background-repeat: no-repeat; + background-position: center; +} + +.logo { + height: fit-content; + width: 55vw; + max-width: 1000px; + + @media screen and (max-width: 640px) { + width: 90vw; + } +} + +.container { + flex: 3; + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + + background-size: contain; + background-repeat: no-repeat; + background-position: bottom; + + width: 100vw; + max-width: 1000px; + padding: 50px; + + @media screen and (max-width: 640px) { + flex: 2; + // background-size: cover; + padding: 0; + } +} + +.container .content { + display: flex; + flex-direction: column; + justify-content: center; + gap: 20px; + flex: 0.9; + @media screen and (max-width: 640px) { + flex: 1; + } +} + +.container .topSpacer { + display: none; + @media screen and (max-width: 640px) { + flex: 0.6; + display: flex; + } +} + +.container .spacer { + flex: 0.6; +} + +.container h2 { + position: relative; + z-index: 4; + text-align: center; + color: #34274a; +} + +.container .link { + color: #34274a; + position: relative; + text-align: center; + text-decoration: underline; + text-decoration-color: #34274a; + padding-top: 14px; +} + +.container .signUpAsButtons { + flex: 1; +} + +.topSpacer { + flex: 3; +} diff --git a/app/closed/page.tsx b/app/closed/page.tsx new file mode 100644 index 00000000..08dca05f --- /dev/null +++ b/app/closed/page.tsx @@ -0,0 +1,50 @@ +import Image from "next/image"; +import Link from "next/link"; + +import SNOWGLOBE from "@/public/registration/track_selection/snowglobe.svg"; +import LOGO_TEXTONLY from "@/public/registration/track_selection/logo_textonly.svg"; +import BACKGROUND from "@/public/registration/track_selection/background.svg"; + +import OlympianButton from "@/components/OlympianButton/OlympianButton"; + +import styles from "@/app/closed/closed.module.scss" + +const closed: React.FC = () => { + + return ( +
+
+ HackOlympus Logo +
+
+
+

Sorry, registration is closed.

+

Check back next year!

+ + +
+
+
+
+ ); +}; + +export default closed; diff --git a/app/register/layout.tsx b/app/register/layout.tsx index 5c78e644..b0327203 100644 --- a/app/register/layout.tsx +++ b/app/register/layout.tsx @@ -3,33 +3,52 @@ import Loading from "@/components/Loading/Loading"; import { isAuthenticated, authenticate, - getRegistrationOrDefault + getRegistrationOrDefault, + getRegistrationStatus } from "@/util/api"; import Head from "next/head"; import { usePathname, useRouter } from "next/navigation"; import { useState, useEffect } from "react"; const Layout = ({ children }: { children: React.ReactNode }) => { - const [isLoading, setIsLoading] = useState(true); - const router = useRouter(); - const pathname = usePathname(); + const [isLoading, setIsLoading] = useState(true) + const router = useRouter() + const pathname = usePathname() + const [isAlive, setIsAlive] = useState(true) + + useEffect(() => { if (!isAuthenticated()) { - authenticate(pathname); - return; + authenticate(pathname) + return } getRegistrationOrDefault() .then(registration => { if (registration.hasSubmitted) { - router.push("/profile"); + router.push("/profile") + } else if (!isAlive) { + router.push("/closed") } }) .finally(() => { - setIsLoading(false); - }); - }, []); + setIsLoading(false) + }) + }, []) + + useEffect(() => { + const fetchRegistrationStatus = async () => { + try { + const response = await getRegistrationStatus() + setIsAlive(response.alive) + } catch (err) { + console.error(err) + } + } + + fetchRegistrationStatus() + }, []) return ( <> diff --git a/components/Home/Olympian/Olympian.tsx b/components/Home/Olympian/Olympian.tsx index 73e97db1..d76d351d 100644 --- a/components/Home/Olympian/Olympian.tsx +++ b/components/Home/Olympian/Olympian.tsx @@ -1,4 +1,7 @@ +"use client"; import styles from "./Olympian.module.scss"; +import { useEffect, useState } from "react"; +import { getRegistrationStatus } from "@/util/api"; import Image from "next/image"; import LOGO from "@/public/home/olympian/logo.svg"; @@ -7,6 +10,12 @@ import OlympianButton from "@/components/OlympianButton/OlympianButton"; import Description from "../Description/Description"; const Olympian: React.FC = () => { + const [registrationOpen, setRegistrationOpen] = useState(true); + useEffect(() => { + getRegistrationStatus().then(status => { + setRegistrationOpen(status.alive); + }); + }, []); return (
@@ -16,8 +25,8 @@ const Olympian: React.FC = () => { className={styles.logo} />
@@ -31,4 +40,4 @@ const Olympian: React.FC = () => { ); }; -export default Olympian; +export default Olympian; \ No newline at end of file diff --git a/components/OlympianButton/OlympianButton.tsx b/components/OlympianButton/OlympianButton.tsx index 681918ff..e8e33f3c 100644 --- a/components/OlympianButton/OlympianButton.tsx +++ b/components/OlympianButton/OlympianButton.tsx @@ -41,4 +41,4 @@ const OlympianButton: React.FC = ({ ); }; -export default OlympianButton; +export default OlympianButton; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 40fef6ba..f5065866 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@types/react-dom": "^19.0.2", "clsx": "^2.1.1", "formik": "^2.4.6", - "next": "^15.1.0", + "next": "^15.1.6", "react": "^19.0.0", "react-dom": "^19.0.0", "react-icons": "^5.4.0", @@ -519,9 +519,10 @@ } }, "node_modules/@next/env": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.0.tgz", - "integrity": "sha512-UcCO481cROsqJuszPPXJnb7GGuLq617ve4xuAyyNG4VSSocJNtMU5Fsx+Lp6mlN8c7W58aZLc5y6D/2xNmaK+w==" + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.6.tgz", + "integrity": "sha512-d9AFQVPEYNr+aqokIiPLNK/MTyt3DWa/dpKveiAaVccUadFbhFEvY6FXYX2LJO2Hv7PHnLBu2oWwB4uBuHjr/w==", + "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { "version": "15.1.0", @@ -561,12 +562,13 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.0.tgz", - "integrity": "sha512-ZU8d7xxpX14uIaFC3nsr4L++5ZS/AkWDm1PzPO6gD9xWhFkOj2hzSbSIxoncsnlJXB1CbLOfGVN4Zk9tg83PUw==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.6.tgz", + "integrity": "sha512-u7lg4Mpl9qWpKgy6NzEkz/w0/keEHtOybmIl0ykgItBxEM5mYotS5PmqTpo+Rhg8FiOiWgwr8USxmKQkqLBCrw==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -576,12 +578,13 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.0.tgz", - "integrity": "sha512-DQ3RiUoW2XC9FcSM4ffpfndq1EsLV0fj0/UY33i7eklW5akPUCo6OX2qkcLXZ3jyPdo4sf2flwAED3AAq3Om2Q==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.6.tgz", + "integrity": "sha512-x1jGpbHbZoZ69nRuogGL2MYPLqohlhnT9OCU6E6QFewwup+z+M6r8oU47BTeJcWsF2sdBahp5cKiAcDbwwK/lg==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -591,12 +594,13 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.0.tgz", - "integrity": "sha512-M+vhTovRS2F//LMx9KtxbkWk627l5Q7AqXWWWrfIzNIaUFiz2/NkOFkxCFyNyGACi5YbA8aekzCLtbDyfF/v5Q==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.6.tgz", + "integrity": "sha512-jar9sFw0XewXsBzPf9runGzoivajeWJUc/JkfbLTC4it9EhU8v7tCRLH7l5Y1ReTMN6zKJO0kKAGqDk8YSO2bg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -606,12 +610,13 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.0.tgz", - "integrity": "sha512-Qn6vOuwaTCx3pNwygpSGtdIu0TfS1KiaYLYXLH5zq1scoTXdwYfdZtwvJTpB1WrLgiQE2Ne2kt8MZok3HlFqmg==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.6.tgz", + "integrity": "sha512-+n3u//bfsrIaZch4cgOJ3tXCTbSxz0s6brJtU3SzLOvkJlPQMJ+eHVRi6qM2kKKKLuMY+tcau8XD9CJ1OjeSQQ==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -621,12 +626,13 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.0.tgz", - "integrity": "sha512-yeNh9ofMqzOZ5yTOk+2rwncBzucc6a1lyqtg8xZv0rH5znyjxHOWsoUtSq4cUTeeBIiXXX51QOOe+VoCjdXJRw==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.6.tgz", + "integrity": "sha512-SpuDEXixM3PycniL4iVCLyUyvcl6Lt0mtv3am08sucskpG0tYkW1KlRhTgj4LI5ehyxriVVcfdoxuuP8csi3kQ==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -636,12 +642,13 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.0.tgz", - "integrity": "sha512-t9IfNkHQs/uKgPoyEtU912MG6a1j7Had37cSUyLTKx9MnUpjj+ZDKw9OyqTI9OwIIv0wmkr1pkZy+3T5pxhJPg==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.6.tgz", + "integrity": "sha512-L4druWmdFSZIIRhF+G60API5sFB7suTbDRhYWSjiw0RbE+15igQvE2g2+S973pMGvwN3guw7cJUjA/TmbPWTHQ==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -651,12 +658,13 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.0.tgz", - "integrity": "sha512-WEAoHyG14t5sTavZa1c6BnOIEukll9iqFRTavqRVPfYmfegOAd5MaZfXgOGG6kGo1RduyGdTHD4+YZQSdsNZXg==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.6.tgz", + "integrity": "sha512-s8w6EeqNmi6gdvM19tqKKWbCyOBvXFbndkGHl+c9YrzsLARRdCHsD9S1fMj8gsXm9v8vhC8s3N8rjuC/XrtkEg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -666,12 +674,13 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.0.tgz", - "integrity": "sha512-J1YdKuJv9xcixzXR24Dv+4SaDKc2jj31IVUEMdO5xJivMTXuE6MAdIi4qPjSymHuFG8O5wbfWKnhJUcHHpj5CA==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.6.tgz", + "integrity": "sha512-6xomMuu54FAFxttYr5PJbEfu96godcxBTRk1OhAvJq0/EnmFU/Ybiax30Snis4vdWZ9LGpf7Roy5fSs7v/5ROQ==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -3776,11 +3785,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/next/-/next-15.1.0.tgz", - "integrity": "sha512-QKhzt6Y8rgLNlj30izdMbxAwjHMFANnLwDwZ+WQh5sMhyt4lEBqDK9QpvWHtIM4rINKPoJ8aiRZKg5ULSybVHw==", + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/next/-/next-15.1.6.tgz", + "integrity": "sha512-Hch4wzbaX0vKQtalpXvUiw5sYivBy4cm5rzUKrBnUB/y436LGrvOUqYvlSeNVCWFO/770gDlltR9gqZH62ct4Q==", + "license": "MIT", "dependencies": { - "@next/env": "15.1.0", + "@next/env": "15.1.6", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.15", "busboy": "1.6.0", @@ -3795,14 +3805,14 @@ "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.1.0", - "@next/swc-darwin-x64": "15.1.0", - "@next/swc-linux-arm64-gnu": "15.1.0", - "@next/swc-linux-arm64-musl": "15.1.0", - "@next/swc-linux-x64-gnu": "15.1.0", - "@next/swc-linux-x64-musl": "15.1.0", - "@next/swc-win32-arm64-msvc": "15.1.0", - "@next/swc-win32-x64-msvc": "15.1.0", + "@next/swc-darwin-arm64": "15.1.6", + "@next/swc-darwin-x64": "15.1.6", + "@next/swc-linux-arm64-gnu": "15.1.6", + "@next/swc-linux-arm64-musl": "15.1.6", + "@next/swc-linux-x64-gnu": "15.1.6", + "@next/swc-linux-x64-musl": "15.1.6", + "@next/swc-win32-arm64-msvc": "15.1.6", + "@next/swc-win32-x64-msvc": "15.1.6", "sharp": "^0.33.5" }, "peerDependencies": { @@ -4226,6 +4236,7 @@ "version": "19.0.0", "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4234,6 +4245,7 @@ "version": "19.0.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", + "license": "MIT", "dependencies": { "scheduler": "^0.25.0" }, diff --git a/package.json b/package.json index dc21bdb4..4f9fe679 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@types/react-dom": "^19.0.2", "clsx": "^2.1.1", "formik": "^2.4.6", - "next": "^15.1.0", + "next": "^15.1.6", "react": "^19.0.0", "react-dom": "^19.0.0", "react-icons": "^5.4.0", diff --git a/util/api.ts b/util/api.ts index 999ce1da..29eb288b 100644 --- a/util/api.ts +++ b/util/api.ts @@ -121,6 +121,15 @@ export async function registerSubmit( return res; } +export async function getRegistrationStatus(): Promise<{ alive: boolean }> { + const res = await requestv2("GET", "/registration/status").catch(body => + handleError(body) + ); + return res; +} + + + export async function getRSVP(): Promise { const res = await requestv2("GET", "/admission/rsvp").catch(body => handleError(body)