From 8f496cd54eef02619b593221d5ae8c787e702c7d Mon Sep 17 00:00:00 2001 From: John Zhou Date: Wed, 20 Dec 2023 22:02:57 -0800 Subject: [PATCH 01/24] git pulled --- src/components/dynamic/user/Dashboard.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dynamic/user/Dashboard.jsx b/src/components/dynamic/user/Dashboard.jsx index 42bc19f7..ae51d89b 100644 --- a/src/components/dynamic/user/Dashboard.jsx +++ b/src/components/dynamic/user/Dashboard.jsx @@ -15,7 +15,7 @@ const Dashboard = () => {
<Header email={user.email} name={user.name} /> - <div className="grid grid-cols-1 lg:grid-cols-2 h-full gap-3"> + <div className="grid grid-cols-1 lg:grid-cols-2 gap-3"> <User user={user} setUser={setUser} edit={edit} setEdit={setEdit} /> {user.roles.participants === 1 && ( <Team user={user} team={user.team} setUser={setUser} /> From 133a3bc98cb32c8714b4aa16ecac026c405cecd5 Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Thu, 21 Dec 2023 16:40:23 -0800 Subject: [PATCH 02/24] simplified Checkbox --- package-lock.json | 26 ++++++------------- src/components/dynamic/Checkbox.jsx | 2 +- .../dynamic/admin/dashboards/Toolbar.jsx | 4 +-- .../dynamic/admin/services/Toolbar.jsx | 4 +-- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index a5dcdcdb..115d6d61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8038,9 +8038,9 @@ } }, "node_modules/start-server-and-test": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.2.tgz", - "integrity": "sha512-4sGS2QmETUwqeBUqtTLP7OqXp3PdDnevaWlPlrFQgn8+7uCgVg4Do7/H/ZhAAVyvnL3DqKyANhnLgcgxrjhrMA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.3.tgz", + "integrity": "sha512-QsVObjfjFZKJE6CS6bSKNwWZCKBG6975/jKRPPGFfFh+yOQglSeGXiNWjzgQNXdphcBI9nXbyso9tPfX4YAUhg==", "dev": true, "dependencies": { "arg": "^5.0.2", @@ -8050,7 +8050,7 @@ "execa": "5.1.1", "lazy-ass": "1.6.0", "ps-tree": "1.2.0", - "wait-on": "7.1.0" + "wait-on": "7.2.0" }, "bin": { "server-test": "src/bin/start.js", @@ -8889,12 +8889,12 @@ } }, "node_modules/wait-on": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.1.0.tgz", - "integrity": "sha512-U7TF/OYYzAg+OoiT/B8opvN48UHt0QYMi4aD3PjRFpybQ+o6czQF8Ig3SKCCMJdxpBrCalIJ4O00FBof27Fu9Q==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", + "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", "dev": true, "dependencies": { - "axios": "^0.27.2", + "axios": "^1.6.1", "joi": "^17.11.0", "lodash": "^4.17.21", "minimist": "^1.2.8", @@ -8907,16 +8907,6 @@ "node": ">=12.0.0" } }, - "node_modules/wait-on/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dev": true, - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, "node_modules/warning": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", diff --git a/src/components/dynamic/Checkbox.jsx b/src/components/dynamic/Checkbox.jsx index 26f2af5f..53d4ffe0 100644 --- a/src/components/dynamic/Checkbox.jsx +++ b/src/components/dynamic/Checkbox.jsx @@ -9,7 +9,7 @@ const Checkbox = ({ toggle, onClick = () => {}, text = "", color }) => { > <div data-cy="checkbox-bg" - className={`w-4 h-4 rounded-sm ${ + className={`w-4 h-4 rounded-sm mr-4 ${ toggle ? `${color ? color : "bg-hackathon-blue-100"}` : "bg-hackathon-gray-100" diff --git a/src/components/dynamic/admin/dashboards/Toolbar.jsx b/src/components/dynamic/admin/dashboards/Toolbar.jsx index ee63be17..f43758f4 100644 --- a/src/components/dynamic/admin/dashboards/Toolbar.jsx +++ b/src/components/dynamic/admin/dashboards/Toolbar.jsx @@ -174,9 +174,7 @@ const Toolbar = ({ return ( <div className="w-full flex items-center" data-cy="toolbar"> <div className="w-11/12 flex items-center"> - <div className="mr-4" data-cy="select-all"> - <Checkbox onClick={selectAll} toggle={toggle} /> - </div> + <Checkbox onClick={selectAll} toggle={toggle} data-cy="select-all" /> <div className="flex flex-row gap-2"> {tags.map((tag, index) => ( <Tag diff --git a/src/components/dynamic/admin/services/Toolbar.jsx b/src/components/dynamic/admin/services/Toolbar.jsx index f41e26d9..2f2fb5ac 100644 --- a/src/components/dynamic/admin/services/Toolbar.jsx +++ b/src/components/dynamic/admin/services/Toolbar.jsx @@ -177,9 +177,7 @@ const Toolbar = ({ objects, setObjects, teams, setTeams, tags, empty }) => { return ( <> <form className="flex items-center" onSubmit={handleSearch}> - <div className="mr-4" data-cy="select-all"> - <Checkbox onClick={selectAll} toggle={toggle} /> - </div> + <Checkbox onClick={selectAll} toggle={toggle} data-cy="select-all" /> <div className="flex flex-row gap-2"> {tags.map((tag, index) => ( <Tag From 89699dc55462df7b2229a60d78386b9bb72e8338 Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Thu, 21 Dec 2023 23:01:44 -0800 Subject: [PATCH 03/24] fixed tests --- cypress/e2e/admin/admins/Select.cy.js | 2 +- src/components/dynamic/Checkbox.jsx | 8 +++++++- src/components/dynamic/admin/dashboards/Toolbar.jsx | 2 +- src/components/dynamic/admin/services/Toolbar.jsx | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/admin/admins/Select.cy.js b/cypress/e2e/admin/admins/Select.cy.js index 67bd814b..3b975d82 100644 --- a/cypress/e2e/admin/admins/Select.cy.js +++ b/cypress/e2e/admin/admins/Select.cy.js @@ -13,7 +13,7 @@ describe("Admin Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); admins.forEach((admin) => { cy.get(`[data-cy="${admin.uid}"]`).should("have.class", "bg-green-100"); }); diff --git a/src/components/dynamic/Checkbox.jsx b/src/components/dynamic/Checkbox.jsx index 53d4ffe0..d83bbcaf 100644 --- a/src/components/dynamic/Checkbox.jsx +++ b/src/components/dynamic/Checkbox.jsx @@ -1,6 +1,12 @@ import { BsCheckLg } from "react-icons/bs"; -const Checkbox = ({ toggle, onClick = () => {}, text = "", color }) => { +const Checkbox = ({ + toggle, + onClick = () => {}, + text = "", + color, + "data-cy": dataCy, +}) => { return ( <div className="flex items-center hover:cursor-pointer w-fit" diff --git a/src/components/dynamic/admin/dashboards/Toolbar.jsx b/src/components/dynamic/admin/dashboards/Toolbar.jsx index f43758f4..ad03638b 100644 --- a/src/components/dynamic/admin/dashboards/Toolbar.jsx +++ b/src/components/dynamic/admin/dashboards/Toolbar.jsx @@ -174,7 +174,7 @@ const Toolbar = ({ return ( <div className="w-full flex items-center" data-cy="toolbar"> <div className="w-11/12 flex items-center"> - <Checkbox onClick={selectAll} toggle={toggle} data-cy="select-all" /> + <Checkbox onClick={selectAll} toggle={toggle} /> <div className="flex flex-row gap-2"> {tags.map((tag, index) => ( <Tag diff --git a/src/components/dynamic/admin/services/Toolbar.jsx b/src/components/dynamic/admin/services/Toolbar.jsx index 2f2fb5ac..f41e26d9 100644 --- a/src/components/dynamic/admin/services/Toolbar.jsx +++ b/src/components/dynamic/admin/services/Toolbar.jsx @@ -177,7 +177,9 @@ const Toolbar = ({ objects, setObjects, teams, setTeams, tags, empty }) => { return ( <> <form className="flex items-center" onSubmit={handleSearch}> - <Checkbox onClick={selectAll} toggle={toggle} data-cy="select-all" /> + <div className="mr-4" data-cy="select-all"> + <Checkbox onClick={selectAll} toggle={toggle} /> + </div> <div className="flex flex-row gap-2"> {tags.map((tag, index) => ( <Tag From 5ed1e243b27ac1f6f056d3508fd894a0375420eb Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Thu, 21 Dec 2023 23:12:12 -0800 Subject: [PATCH 04/24] fixed ALL tests --- cypress/e2e/admin/committees/Select.cy.js | 2 +- cypress/e2e/admin/judges/Select.cy.js | 2 +- cypress/e2e/admin/mentors/Select.cy.js | 2 +- cypress/e2e/admin/participants/Select.cy.js | 2 +- cypress/e2e/admin/sponsors/Select.cy.js | 2 +- cypress/e2e/admin/teams/Select.cy.js | 2 +- cypress/e2e/admin/volunteers/Select.cy.js | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/admin/committees/Select.cy.js b/cypress/e2e/admin/committees/Select.cy.js index 067d6532..0211f608 100644 --- a/cypress/e2e/admin/committees/Select.cy.js +++ b/cypress/e2e/admin/committees/Select.cy.js @@ -13,7 +13,7 @@ describe("committee Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); committees.forEach((committee) => { cy.get(`[data-cy="${committee.uid}"]`).should( "have.class", diff --git a/cypress/e2e/admin/judges/Select.cy.js b/cypress/e2e/admin/judges/Select.cy.js index 0e68875d..2ba5dffa 100644 --- a/cypress/e2e/admin/judges/Select.cy.js +++ b/cypress/e2e/admin/judges/Select.cy.js @@ -13,7 +13,7 @@ describe("Mentor Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); judges.forEach((judge) => { cy.get(`[data-cy="${judge.uid}"]`).should("have.class", "bg-green-100"); }); diff --git a/cypress/e2e/admin/mentors/Select.cy.js b/cypress/e2e/admin/mentors/Select.cy.js index 64e1b54e..93fd01f8 100644 --- a/cypress/e2e/admin/mentors/Select.cy.js +++ b/cypress/e2e/admin/mentors/Select.cy.js @@ -13,7 +13,7 @@ describe("Mentor Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); mentors.forEach((mentor) => { cy.get(`[data-cy="${mentor.uid}"]`).should("have.class", "bg-green-100"); }); diff --git a/cypress/e2e/admin/participants/Select.cy.js b/cypress/e2e/admin/participants/Select.cy.js index c85939de..65276334 100644 --- a/cypress/e2e/admin/participants/Select.cy.js +++ b/cypress/e2e/admin/participants/Select.cy.js @@ -13,7 +13,7 @@ describe("Participant Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); participants.forEach((participant) => { cy.get(`[data-cy="${participant.uid}"]`).should( "have.class", diff --git a/cypress/e2e/admin/sponsors/Select.cy.js b/cypress/e2e/admin/sponsors/Select.cy.js index 8a54d7a2..c43ea68d 100644 --- a/cypress/e2e/admin/sponsors/Select.cy.js +++ b/cypress/e2e/admin/sponsors/Select.cy.js @@ -13,7 +13,7 @@ describe("Sponsors Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); sponsors.forEach((sponsor) => { cy.get(`[data-cy="${sponsor.uid}"]`).should("have.class", "bg-green-100"); }); diff --git a/cypress/e2e/admin/teams/Select.cy.js b/cypress/e2e/admin/teams/Select.cy.js index 1a13e6d6..b5ef4108 100644 --- a/cypress/e2e/admin/teams/Select.cy.js +++ b/cypress/e2e/admin/teams/Select.cy.js @@ -13,7 +13,7 @@ describe("Teams Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); teams.forEach((team) => { cy.get(`[data-cy="${team.uid}"]`).should("have.class", "bg-green-100"); }); diff --git a/cypress/e2e/admin/volunteers/Select.cy.js b/cypress/e2e/admin/volunteers/Select.cy.js index 908b847e..d5a2a9f0 100644 --- a/cypress/e2e/admin/volunteers/Select.cy.js +++ b/cypress/e2e/admin/volunteers/Select.cy.js @@ -13,7 +13,7 @@ describe("Volunteers Select", () => { }); it("Select All", () => { - cy.get('[data-cy="select-all"]').click(); + cy.get('[data-cy="toolbar"]').find('[data-cy="checkbox"]').click(); volunteers.forEach((volunteer) => { cy.get(`[data-cy="${volunteer.uid}"]`).should( "have.class", From 8cd61a392468c340c5a7137bc23a37865f608386 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Fri, 22 Dec 2023 23:16:05 -0700 Subject: [PATCH 05/24] fix 1d-0h-1m bug would skip zeroes after the first nonzero value --- src/components/static/Countdown.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 9e30aa17..1f177945 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -49,7 +49,8 @@ function calculateBlocksForDuration(duration) { const blocksIfRemainingAdded = blocks.length + i + 1; const amount = Math.floor(left / millis); left -= millis * amount; - if (blocksIfRemainingAdded <= 3 || amount > 0) { + // add by default since not enough || first nonzero || was first blocks already added + if (blocksIfRemainingAdded <= 3 || amount > 0 || blocks.length) { blocks.push({ unit: amount == 1 ? unitSingular : unitPlural, amount: amount, From 1fbf8f74d9297154af09829d48f7743845ccf1af Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Fri, 22 Dec 2023 23:25:43 -0700 Subject: [PATCH 06/24] title background responsiveness (no black bar on top) --- src/components/static/Title.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index 3181a36c..44b13913 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -8,8 +8,12 @@ import { CONFIG } from "@/data/Config.js"; const Title = () => { return ( <div className="w-full h-screen text-white flex flex-col justify-center items-center lg:items-end"> - <div className="absolute hidden lg:flex items-center left-0 w-full h-full m-auto z-0"> - <Image src={titleBg} alt={"Background"} /> + <div className="absolute hidden lg:flex w-full h-full z-0"> + <Image + src={titleBg} + alt={"Background"} + className="object-cover h-full" + /> </div> <div className="flex flex-col z-1 p-8 lg:p-16 gap-2 rounded-lg bg-slate-900 lg:bg-transparent"> <div className="p-8 flex flex-col items-center lg:items-end gap-2"> From 93109c04c5f7a88fbc0efa1f8a0a209c53d3491a Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Fri, 22 Dec 2023 23:53:56 -0700 Subject: [PATCH 07/24] change date display to MM DD-DD, YY format --- src/components/static/Title.jsx | 6 +++++- src/data/Config.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index 44b13913..8d0b1ae0 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -22,10 +22,14 @@ const Title = () => { </div> <div className="text-lg lg:text-xl font-paragraph text-bear-teal-100"> {CONFIG.date.toLocaleDateString(undefined, { - year: "numeric", + // year: "numeric", month: "long", day: "numeric", })} + {"-"} + {CONFIG.lastDate.toLocaleDateString(undefined, { day: "numeric" })} + {", "} + {CONFIG.lastDate.toLocaleDateString(undefined, { year: "numeric" })} </div> </div> <div className="flex gap-4 flex-col lg:flex-row px-8"> diff --git a/src/data/Config.js b/src/data/Config.js index d3af96b8..1a1e9317 100644 --- a/src/data/Config.js +++ b/src/data/Config.js @@ -3,6 +3,7 @@ export const CONFIG = { email: "contact.acmucr@gmail.com", year: "2024", date: new Date("April 27, 2024 9:00:00"), + lastDate: new Date("April 28, 2024 9:00:00"), packet: "", }; From 204757e0515add439a704fcb0f2dad244fdc24fd Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 00:00:18 -0700 Subject: [PATCH 08/24] show DD HH MM SS for countdown --- src/components/static/Countdown.jsx | 38 ++++++++++++++++------------- src/components/static/Title.jsx | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 1f177945..f0035c6b 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -24,16 +24,16 @@ const units = [ unitPlural: "days", millis: 24 * 60 * 60 * 1000, }, - { - unitSingular: "week", - unitPlural: "weeks", - millis: 7 * 24 * 60 * 60 * 1000, - }, - { - unitSingular: "month", - unitPlural: "months", - millis: 30 * 24 * 60 * 60 * 1000, - }, + // { + // unitSingular: "week", + // unitPlural: "weeks", + // millis: 7 * 24 * 60 * 60 * 1000, + // }, + // { + // unitSingular: "month", + // unitPlural: "months", + // millis: 30 * 24 * 60 * 60 * 1000, + // }, ]; /** @@ -44,13 +44,14 @@ const units = [ function calculateBlocksForDuration(duration) { let left = duration; const blocks = []; - for (let i = units.length - 1; i >= 0 && blocks.length < 3; --i) { + const blockCount = 4; + for (let i = units.length - 1; i >= 0 && blocks.length < blockCount; --i) { const { unitSingular, unitPlural, millis } = units[i]; const blocksIfRemainingAdded = blocks.length + i + 1; const amount = Math.floor(left / millis); left -= millis * amount; // add by default since not enough || first nonzero || was first blocks already added - if (blocksIfRemainingAdded <= 3 || amount > 0 || blocks.length) { + if (blocksIfRemainingAdded <= blockCount || amount > 0 || blocks.length) { blocks.push({ unit: amount == 1 ? unitSingular : unitPlural, amount: amount, @@ -79,24 +80,27 @@ const Countdown = ({ targetTime }) => { }, [targetTime]); return ( - <div className="flex gap-4 font-paragraph"> + <div className="flex gap-3 md:!gap-6 font-paragraph"> {blocks.map(({ unit, amount }, index) => ( - <div className="flex flex-col items-center m-2 gap-2" key={index}> - <div className="flex gap-2"> + <div + className="flex flex-col items-center gap-3 last:hidden sm:last:flex" + key={index} + > + <div className="flex gap-1 lg:!gap-2"> {amount .toString() .padStart(2, "0") .split("") .map((digit, index) => ( <div - className="text-md lg:text-5xl font-bold text-white bg-[#B3FBF780] p-3 rounded-lg" + className="text-lg lg:text-4xl font-bold text-white bg-[#B3FBF780] p-[10px] lg:p-3 rounded-lg" key={index} > {digit} </div> ))} </div> - <div className="">{unit}</div> + <div>{unit}</div> </div> ))} </div> diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index 8d0b1ae0..e1d50815 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -32,7 +32,7 @@ const Title = () => { {CONFIG.lastDate.toLocaleDateString(undefined, { year: "numeric" })} </div> </div> - <div className="flex gap-4 flex-col lg:flex-row px-8"> + <div className="flex flex-col gap-4 justify-end lg:flex-row px-8"> <Link text={"Register"} link={"/form/participant"} /> <Link text={"Mentor"} link={"/form/mentor"} /> <Link text={"Volunteer"} link={"/form/volunteer"} /> From 41e55fa28840902bed942ad5550ee149859d2e13 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 00:11:59 -0700 Subject: [PATCH 09/24] replace the rgba hex with something less hard-coded --- src/components/static/Countdown.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index f0035c6b..3c0163fe 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -93,7 +93,7 @@ const Countdown = ({ targetTime }) => { .split("") .map((digit, index) => ( <div - className="text-lg lg:text-4xl font-bold text-white bg-[#B3FBF780] p-[10px] lg:p-3 rounded-lg" + className="text-lg lg:text-4xl font-bold text-white bg-bear-teal-100/50 p-[10px] lg:p-3 rounded-lg" key={index} > {digit} From 2b5e582ce3af3c958fa46112fae5227c687e5235 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 00:14:12 -0700 Subject: [PATCH 10/24] remove unnecessary comment --- src/components/static/Title.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index e1d50815..1bb1a425 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -22,7 +22,6 @@ const Title = () => { </div> <div className="text-lg lg:text-xl font-paragraph text-bear-teal-100"> {CONFIG.date.toLocaleDateString(undefined, { - // year: "numeric", month: "long", day: "numeric", })} From 53fcc8642b281d00304fd9541875438909e741d8 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 01:02:52 -0700 Subject: [PATCH 11/24] attempt to fix react error #425 --- src/components/static/Countdown.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 3c0163fe..27d090e2 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -67,9 +67,11 @@ function calculateBlocksForDuration(duration) { * @return {JSX.Element} */ const Countdown = ({ targetTime }) => { - const [blocks, setBlocks] = useState( - calculateBlocksForDuration(Math.max(targetTime - Date.now(), 0)) - ); + const [blocks, setBlocks] = useState([]); + // Cypress E2E CI keeps dying... https://nextjs.org/docs/messages/react-hydration-error + useEffect(() => { + setBlocks(calculateBlocksForDuration(Math.max(targetTime - Date.now(), 0))); + }, []); useEffect(() => { const intervalId = setInterval(() => { setBlocks( From 9c658d10c951a82ef445f4576e0fc49d22a9635b Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Sat, 23 Dec 2023 02:07:41 -0800 Subject: [PATCH 12/24] changed team api to save discord instead of email --- src/app/api/team/route.js | 5 +++-- src/app/api/teams/route.js | 4 ++-- src/data/dynamic/admin/Teams.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/api/team/route.js b/src/app/api/team/route.js index d0705c7f..fe69a88f 100644 --- a/src/app/api/team/route.js +++ b/src/app/api/team/route.js @@ -6,7 +6,8 @@ import { AUTH } from "@/data/dynamic/user/Team"; export async function POST() { const res = NextResponse; - const { auth, message, user } = await authenticate(AUTH.POST); + const { auth, message, user } = await authenticate(AUTH.POST); // this user is taken from the session + console.log(user); if (auth !== 200) { return res.json( @@ -22,7 +23,7 @@ export async function POST() { devpost: "", figma: "", }, - members: [{ email: user.email, name: user.name, uid: user.id }], + members: [{ discord: user.discord, name: user.name, uid: user.id }], status: 0, }; const docRef = await addDoc(collection(db, "teams"), team); diff --git a/src/app/api/teams/route.js b/src/app/api/teams/route.js index 1abd2ced..a87ef48d 100644 --- a/src/app/api/teams/route.js +++ b/src/app/api/teams/route.js @@ -29,7 +29,7 @@ export async function GET() { const { links, status, members } = doc.data(); const formattedNames = members.map((member) => member.name); - const formattedEmails = members.map((member) => member.email); + const formattedDiscords = members.map((member) => member.discord); const formattedUids = members.map((member) => member.uid); const formattedLinks = Object.entries(links) .filter(([key, value]) => value !== "") @@ -40,7 +40,7 @@ export async function GET() { output.push({ links: formattedLinks, members: formattedNames, - emails: formattedEmails, + discords: formattedDiscords, uids: formattedUids, status, uid: doc.id, diff --git a/src/data/dynamic/admin/Teams.js b/src/data/dynamic/admin/Teams.js index 2f2f7103..8ae923f5 100644 --- a/src/data/dynamic/admin/Teams.js +++ b/src/data/dynamic/admin/Teams.js @@ -26,7 +26,7 @@ export const TAGS = [ export const HEADERS = [ { text: "name", size: "w-2/12", icon: true, sort: "off", symbol: "winner" }, { text: "members", size: "w-2/12", icon: false, sort: "off" }, - { text: "emails", size: "w-3/12", icon: false, sort: "off" }, + { text: "discords", size: "w-3/12", icon: false, sort: "off" }, { text: "links", size: "w-3/12", icon: false, sort: "off" }, { text: "status", From fdcbbf064852ecfbd328060e7ec06db2c4069522 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 13:58:06 -0700 Subject: [PATCH 13/24] update Config.js email --- src/data/Config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/Config.js b/src/data/Config.js index 1a1e9317..676e9e04 100644 --- a/src/data/Config.js +++ b/src/data/Config.js @@ -1,6 +1,6 @@ export const CONFIG = { name: "Bearhack 2024", - email: "contact.acmucr@gmail.com", + email: "bearhackucr@gmail.com", year: "2024", date: new Date("April 27, 2024 9:00:00"), lastDate: new Date("April 28, 2024 9:00:00"), From eae4a99c024a7b9d6c0969e5bead1c90051bbdc7 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 13:59:42 -0700 Subject: [PATCH 14/24] Title.jsx, Countdown.jsx cleanup --- src/components/static/Countdown.jsx | 10 ---------- src/components/static/Title.jsx | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 27d090e2..f4f7e6fb 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -24,16 +24,6 @@ const units = [ unitPlural: "days", millis: 24 * 60 * 60 * 1000, }, - // { - // unitSingular: "week", - // unitPlural: "weeks", - // millis: 7 * 24 * 60 * 60 * 1000, - // }, - // { - // unitSingular: "month", - // unitPlural: "months", - // millis: 30 * 24 * 60 * 60 * 1000, - // }, ]; /** diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index 1bb1a425..2bb7a159 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -21,14 +21,14 @@ const Title = () => { BEARHACK 2024 </div> <div className="text-lg lg:text-xl font-paragraph text-bear-teal-100"> - {CONFIG.date.toLocaleDateString(undefined, { + {CONFIG.date.toLocaleDateString("en-US", { month: "long", day: "numeric", })} {"-"} - {CONFIG.lastDate.toLocaleDateString(undefined, { day: "numeric" })} + {CONFIG.lastDate.getDate()} {", "} - {CONFIG.lastDate.toLocaleDateString(undefined, { year: "numeric" })} + {CONFIG.lastDate.getFullYear()} </div> </div> <div className="flex flex-col gap-4 justify-end lg:flex-row px-8"> From 2cd979a54dfcda7feec3d0cf5a68b508c10afbe9 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 14:05:14 -0700 Subject: [PATCH 15/24] initialize countdown to 0 to avoid hydration error (react error 425) --- src/components/static/Countdown.jsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index f4f7e6fb..60f793eb 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -57,17 +57,15 @@ function calculateBlocksForDuration(duration) { * @return {JSX.Element} */ const Countdown = ({ targetTime }) => { - const [blocks, setBlocks] = useState([]); - // Cypress E2E CI keeps dying... https://nextjs.org/docs/messages/react-hydration-error + const [blocks, setBlocks] = useState(calculateBlocksForDuration(0, 0)); useEffect(() => { - setBlocks(calculateBlocksForDuration(Math.max(targetTime - Date.now(), 0))); - }, []); - useEffect(() => { - const intervalId = setInterval(() => { + const update = () => { setBlocks( calculateBlocksForDuration(Math.max(targetTime - Date.now(), 0)) ); - }, 1000); + }; + update(); + const intervalId = setInterval(update, 1000); return () => clearInterval(intervalId); }, [targetTime]); From b85c094c0abdc0adb976436a3d52704550a8c99d Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 14:30:37 -0700 Subject: [PATCH 16/24] take simpler countdown from https://github.com/citrushack/cutiehack2023/blob/dev/src/components/static/Countdown.jsx --- src/components/static/Countdown.jsx | 137 +++++++++++----------------- src/components/static/Title.jsx | 2 +- 2 files changed, 52 insertions(+), 87 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 60f793eb..ff8c2616 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -1,97 +1,62 @@ "use client"; +import { useState, useEffect } from "react"; +import { CONFIG } from "@/data/Config"; -import { useEffect, useState } from "react"; +const Digits = ({ value, text }) => { + return ( + <div className="flex flex-col items-center mr-3 md:mr-5 gap-2"> + <div className="flex items-center"> + <p className="bg-cutie-blue-200/75 mb-0 h-10 md:h-16 text-lg md:text-3xl font-bold w-8 md:w-14 flex items-center justify-center rounded-lg drop-shadow-md mr-1 md:mr-2"> + {Math.floor(value / 10)} + </p> + <p className="bg-cutie-blue-200/75 mb-0 h-10 md:h-16 text-lg md:text-3xl font-bold w-8 md:w-14 flex items-center justify-center rounded-lg drop-shadow-md"> + {value % 10} + </p> + </div> + <p className="text-xs md:text-base">{text}</p> + </div> + ); +}; -// approximate units for a simple implementation, can use Date API if more accuracy is needed -const units = [ - { - unitSingular: "second", - unitPlural: "seconds", - millis: 1000, - }, - { - unitSingular: "minute", - unitPlural: "minutes", - millis: 60 * 1000, - }, - { - unitSingular: "hour", - unitPlural: "hours", - millis: 60 * 60 * 1000, - }, - { - unitSingular: "day", - unitPlural: "days", - millis: 24 * 60 * 60 * 1000, - }, -]; +const Countdown = () => { + const [time, setTime] = useState({ + days: 0, + hours: 0, + minutes: 0, + seconds: 0, + }); -/** - * returns block data that can be rendered for some duration - * @param {number} duration milliseconds to convert into larger time units - * @return {{unit:string, amount:number}[]} - */ -function calculateBlocksForDuration(duration) { - let left = duration; - const blocks = []; - const blockCount = 4; - for (let i = units.length - 1; i >= 0 && blocks.length < blockCount; --i) { - const { unitSingular, unitPlural, millis } = units[i]; - const blocksIfRemainingAdded = blocks.length + i + 1; - const amount = Math.floor(left / millis); - left -= millis * amount; - // add by default since not enough || first nonzero || was first blocks already added - if (blocksIfRemainingAdded <= blockCount || amount > 0 || blocks.length) { - blocks.push({ - unit: amount == 1 ? unitSingular : unitPlural, - amount: amount, + useEffect(() => { + const interval = setInterval(() => { + const diff = CONFIG.date.getTime() - new Date().getTime(); + + setTime({ + days: + Math.floor(diff / (1000 * 60 * 60 * 24)) > 0 + ? Math.floor(diff / (1000 * 60 * 60 * 24)) + : 0, + hours: + Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) > 0 + ? Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) + : 0, + minutes: + Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)) > 0 + ? Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)) + : 0, + seconds: + Math.floor((diff % (1000 * 60 * 60)) / 1000) % 60 > 0 + ? Math.floor((diff % (1000 * 60 * 60)) / 1000) % 60 + : 0, }); - } - } - return blocks; -} + }, 1000); -/** - * Renders a countdown element with the 3 most significant time units. - * @param {{targetTime: number}} props targetTime in millis since unix epoch (same as `Date.now()`) - * @return {JSX.Element} - */ -const Countdown = ({ targetTime }) => { - const [blocks, setBlocks] = useState(calculateBlocksForDuration(0, 0)); - useEffect(() => { - const update = () => { - setBlocks( - calculateBlocksForDuration(Math.max(targetTime - Date.now(), 0)) - ); - }; - update(); - const intervalId = setInterval(update, 1000); - return () => clearInterval(intervalId); - }, [targetTime]); + return () => clearInterval(interval); + }, []); return ( - <div className="flex gap-3 md:!gap-6 font-paragraph"> - {blocks.map(({ unit, amount }, index) => ( - <div - className="flex flex-col items-center gap-3 last:hidden sm:last:flex" - key={index} - > - <div className="flex gap-1 lg:!gap-2"> - {amount - .toString() - .padStart(2, "0") - .split("") - .map((digit, index) => ( - <div - className="text-lg lg:text-4xl font-bold text-white bg-bear-teal-100/50 p-[10px] lg:p-3 rounded-lg" - key={index} - > - {digit} - </div> - ))} - </div> - <div>{unit}</div> - </div> + <div className="flex"> + {Object.entries(time).map(([text, value], index) => ( + <Digits key={index} text={text} value={value} /> ))} </div> ); diff --git a/src/components/static/Title.jsx b/src/components/static/Title.jsx index 2bb7a159..1d110358 100644 --- a/src/components/static/Title.jsx +++ b/src/components/static/Title.jsx @@ -41,7 +41,7 @@ const Title = () => { <HorizontalLine /> </div> <div className="m-auto"> - <Countdown targetTime={CONFIG.date.getTime()} /> + <Countdown /> </div> </div> </div> From 9b58e3b274fd3198fa138ce37edea80682790501 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 14:38:29 -0700 Subject: [PATCH 17/24] update styles from previous version --- src/components/static/Countdown.jsx | 32 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index ff8c2616..8c79a0d7 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -2,18 +2,24 @@ import { useState, useEffect } from "react"; import { CONFIG } from "@/data/Config"; -const Digits = ({ value, text }) => { +const Digits = ({ value, unit }) => { return ( - <div className="flex flex-col items-center mr-3 md:mr-5 gap-2"> - <div className="flex items-center"> - <p className="bg-cutie-blue-200/75 mb-0 h-10 md:h-16 text-lg md:text-3xl font-bold w-8 md:w-14 flex items-center justify-center rounded-lg drop-shadow-md mr-1 md:mr-2"> - {Math.floor(value / 10)} - </p> - <p className="bg-cutie-blue-200/75 mb-0 h-10 md:h-16 text-lg md:text-3xl font-bold w-8 md:w-14 flex items-center justify-center rounded-lg drop-shadow-md"> - {value % 10} - </p> + <div className="flex flex-col items-center gap-3 last:hidden sm:last:flex"> + <div className="flex gap-1 lg:!gap-2"> + {value + .toString() + .padStart(2, "0") + .split("") + .map((digit, index) => ( + <div + className="text-lg lg:text-4xl font-bold text-white bg-bear-teal-100/50 p-[10px] lg:p-3 rounded-lg" + key={index} + > + {digit} + </div> + ))} </div> - <p className="text-xs md:text-base">{text}</p> + <div>{unit}</div> </div> ); }; @@ -54,9 +60,9 @@ const Countdown = () => { }, []); return ( - <div className="flex"> - {Object.entries(time).map(([text, value], index) => ( - <Digits key={index} text={text} value={value} /> + <div className="flex gap-3 md:!gap-6 font-paragraph"> + {Object.entries(time).map(([unit, value], index) => ( + <Digits key={index} unit={unit} value={value} /> ))} </div> ); From 7886cd17da9f358e4fe395c4ba3e763bdd795ce4 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Sat, 23 Dec 2023 14:38:43 -0700 Subject: [PATCH 18/24] cleanup time unit conversion implementation --- src/components/static/Countdown.jsx | 30 ++++++++++------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/components/static/Countdown.jsx b/src/components/static/Countdown.jsx index 8c79a0d7..2774dda9 100644 --- a/src/components/static/Countdown.jsx +++ b/src/components/static/Countdown.jsx @@ -33,28 +33,18 @@ const Countdown = () => { }); useEffect(() => { - const interval = setInterval(() => { - const diff = CONFIG.date.getTime() - new Date().getTime(); - + const updateTime = () => { + const diff = Math.max(CONFIG.date.getTime() - Date.now(), 0); setTime({ - days: - Math.floor(diff / (1000 * 60 * 60 * 24)) > 0 - ? Math.floor(diff / (1000 * 60 * 60 * 24)) - : 0, - hours: - Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) > 0 - ? Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) - : 0, - minutes: - Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)) > 0 - ? Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)) - : 0, - seconds: - Math.floor((diff % (1000 * 60 * 60)) / 1000) % 60 > 0 - ? Math.floor((diff % (1000 * 60 * 60)) / 1000) % 60 - : 0, + days: Math.floor(diff / (1000 * 60 * 60 * 24)), + hours: Math.floor(diff / (1000 * 60 * 60)) % 24, + minutes: Math.floor(diff / (1000 * 60)) % 60, + seconds: Math.floor(diff / 1000) % 60, }); - }, 1000); + }; + + updateTime(); + const interval = setInterval(updateTime, 1000); return () => clearInterval(interval); }, []); From cb2de8230232a5d7fed2db421976a2cb565c994e Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Sat, 23 Dec 2023 17:48:06 -0800 Subject: [PATCH 19/24] consolidated forms routes --- src/app/form/[type]/page.js | 41 +++++++++++++++++++++++++++ src/app/form/admin/page.js | 12 -------- src/app/form/committee/page.js | 12 -------- src/app/form/feedback/page.js | 12 -------- src/app/form/interest/page.js | 12 -------- src/app/form/judge/page.js | 12 -------- src/app/form/mentor/page.js | 12 -------- src/app/form/participant/page.js | 12 -------- src/app/form/sponsor/page.js | 12 -------- src/app/form/volunteer/page.js | 12 -------- src/components/dynamic/form/Judge.jsx | 4 +-- 11 files changed, 43 insertions(+), 110 deletions(-) create mode 100644 src/app/form/[type]/page.js delete mode 100644 src/app/form/admin/page.js delete mode 100644 src/app/form/committee/page.js delete mode 100644 src/app/form/feedback/page.js delete mode 100644 src/app/form/interest/page.js delete mode 100644 src/app/form/judge/page.js delete mode 100644 src/app/form/mentor/page.js delete mode 100644 src/app/form/participant/page.js delete mode 100644 src/app/form/sponsor/page.js delete mode 100644 src/app/form/volunteer/page.js diff --git a/src/app/form/[type]/page.js b/src/app/form/[type]/page.js new file mode 100644 index 00000000..09c49785 --- /dev/null +++ b/src/app/form/[type]/page.js @@ -0,0 +1,41 @@ +import Admin from "@/components/dynamic/form/Admin"; +import Committee from "@/components/dynamic/form/Committee"; +import Feedback from "@/components/dynamic/form/Feedback"; +import Interest from "@/components/dynamic/form/Interest"; +import Judge from "@/components/dynamic/form/Judge"; +import Mentor from "@/components/dynamic/form/Mentor"; +import Participant from "@/components/dynamic/form/Participant"; +import Sponsor from "@/components/dynamic/form/Sponsor"; +import Volunteer from "@/components/dynamic/form/Volunteer"; +import Error from "@/components/dynamic/Error"; +import ProtectedPage from "@/components/dynamic/ProtectedPage"; + +const Page = ({ params }) => { + const route = params.type; + + const components = { + admin: <Admin />, + committee: <Committee />, + feedback: <Feedback />, + interest: <Interest />, + judge: <Judge />, + mentor: <Mentor />, + participant: <Participant />, + sponsor: <Sponsor />, + volunteer: <Volunteer />, + }; + + return components[route] ? ( + <ProtectedPage title={`Form | ${route}`} restrictions={{}}> + {components[route]} + </ProtectedPage> + ) : ( + <Error + code="404" + error="Page Not Found" + message="The page you are looking for does not seem to exist." + /> + ); +}; + +export default Page; diff --git a/src/app/form/admin/page.js b/src/app/form/admin/page.js deleted file mode 100644 index f55ce044..00000000 --- a/src/app/form/admin/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Admin from "@/components/dynamic/form/Admin"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Admin" restrictions={{}}> - <Admin /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/committee/page.js b/src/app/form/committee/page.js deleted file mode 100644 index 073eef05..00000000 --- a/src/app/form/committee/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Committee from "@/components/dynamic/form/Committee"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Committee" restrictions={{}}> - <Committee /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/feedback/page.js b/src/app/form/feedback/page.js deleted file mode 100644 index f6f34173..00000000 --- a/src/app/form/feedback/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Feedback from "@/components/dynamic/form/Feedback"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Feedback" restrictions={{}}> - <Feedback /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/interest/page.js b/src/app/form/interest/page.js deleted file mode 100644 index 6d90bc9b..00000000 --- a/src/app/form/interest/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Interest from "@/components/dynamic/form/Interest"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Interest" restrictions={{}}> - <Interest /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/judge/page.js b/src/app/form/judge/page.js deleted file mode 100644 index 70657c10..00000000 --- a/src/app/form/judge/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Judge from "@/components/dynamic/form/Judge"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Judge" restrictions={{}}> - <Judge /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/mentor/page.js b/src/app/form/mentor/page.js deleted file mode 100644 index b7481637..00000000 --- a/src/app/form/mentor/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Mentor from "@/components/dynamic/form/Mentor"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Mentor" restrictions={{}}> - <Mentor /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/participant/page.js b/src/app/form/participant/page.js deleted file mode 100644 index fff454fc..00000000 --- a/src/app/form/participant/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Participant from "@/components/dynamic/form/Participant"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Participant" restrictions={{}}> - <Participant /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/sponsor/page.js b/src/app/form/sponsor/page.js deleted file mode 100644 index 7713b77e..00000000 --- a/src/app/form/sponsor/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Sponsor from "@/components/dynamic/form/Sponsor"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Sponsor" restrictions={{}}> - <Sponsor /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/app/form/volunteer/page.js b/src/app/form/volunteer/page.js deleted file mode 100644 index ade09152..00000000 --- a/src/app/form/volunteer/page.js +++ /dev/null @@ -1,12 +0,0 @@ -import Volunteer from "@/components/dynamic/form/Volunteer"; -import ProtectedPage from "@/components/dynamic/ProtectedPage"; - -const Page = () => { - return ( - <ProtectedPage title="Form | Volunteer" restrictions={{}}> - <Volunteer /> - </ProtectedPage> - ); -}; - -export default Page; diff --git a/src/components/dynamic/form/Judge.jsx b/src/components/dynamic/form/Judge.jsx index be1096b7..49fc43b7 100644 --- a/src/components/dynamic/form/Judge.jsx +++ b/src/components/dynamic/form/Judge.jsx @@ -8,7 +8,7 @@ import axios from "axios"; import toast from "react-hot-toast"; import { STATUSES } from "@/data/dynamic/admin/Judges.js"; -const judge = () => { +const Judge = () => { const { data: session } = useSession(); const [judge, setJudge] = useState({ ...ATTRIBUTES, @@ -41,4 +41,4 @@ const judge = () => { ); }; -export default judge; +export default Judge; From 6ec1ee6e064dd4ee224f99883cd26481ef25a53b Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Sat, 23 Dec 2023 21:49:01 -0800 Subject: [PATCH 20/24] fixed error handling --- src/app/form/[type]/page.js | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/app/form/[type]/page.js b/src/app/form/[type]/page.js index 09c49785..8d294dba 100644 --- a/src/app/form/[type]/page.js +++ b/src/app/form/[type]/page.js @@ -7,12 +7,10 @@ import Mentor from "@/components/dynamic/form/Mentor"; import Participant from "@/components/dynamic/form/Participant"; import Sponsor from "@/components/dynamic/form/Sponsor"; import Volunteer from "@/components/dynamic/form/Volunteer"; -import Error from "@/components/dynamic/Error"; import ProtectedPage from "@/components/dynamic/ProtectedPage"; +import Fault from "@/utils/error"; const Page = ({ params }) => { - const route = params.type; - const components = { admin: <Admin />, committee: <Committee />, @@ -25,17 +23,26 @@ const Page = ({ params }) => { volunteer: <Volunteer />, }; - return components[route] ? ( - <ProtectedPage title={`Form | ${route}`} restrictions={{}}> - {components[route]} - </ProtectedPage> - ) : ( - <Error - code="404" - error="Page Not Found" - message="The page you are looking for does not seem to exist." - /> - ); + const capitalizeFirstLetter = (word) => { + return word[0].toUpperCase() + word.slice(1); + }; + + if (components.hasOwnProperty(params.type)) { + return ( + <ProtectedPage + title={`Form | ${capitalizeFirstLetter(params.type)}`} + restrictions={{}} + > + {components[params.type]} + </ProtectedPage> + ); + } else { + throw new Fault( + 404, + "Page Not Found", + "The page you are looking for does not seem to exist" + ); + } }; export default Page; From 56e0ffe9720e6d320bd814d64a174fc98ea8a805 Mon Sep 17 00:00:00 2001 From: Andrew Khadder <andrewkh15@gmail.com> Date: Sat, 23 Dec 2023 21:51:27 -0800 Subject: [PATCH 21/24] removed code comments mb --- src/app/api/team/route.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/api/team/route.js b/src/app/api/team/route.js index fe69a88f..06970718 100644 --- a/src/app/api/team/route.js +++ b/src/app/api/team/route.js @@ -6,8 +6,7 @@ import { AUTH } from "@/data/dynamic/user/Team"; export async function POST() { const res = NextResponse; - const { auth, message, user } = await authenticate(AUTH.POST); // this user is taken from the session - console.log(user); + const { auth, message, user } = await authenticate(AUTH.POST); if (auth !== 200) { return res.json( From 44551163f4fde901bef25e4fca75fa986ace6660 Mon Sep 17 00:00:00 2001 From: NovaSagittarii <novasagittarii@gmail.com> Date: Thu, 4 Jan 2024 13:06:58 -0700 Subject: [PATCH 22/24] limit scope of styling changes to forms only (checkbox and bg for now) too unpredictable if the entire admin dashboard is turned dark mode --- src/components/dynamic/Checkbox.jsx | 12 ++++++++++-- src/components/dynamic/ProtectedPage.jsx | 19 ++++++++++++++++--- src/components/dynamic/form/Questions.jsx | 1 + 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/dynamic/Checkbox.jsx b/src/components/dynamic/Checkbox.jsx index a5696508..5b84a517 100644 --- a/src/components/dynamic/Checkbox.jsx +++ b/src/components/dynamic/Checkbox.jsx @@ -1,6 +1,12 @@ import { BsCheckLg } from "react-icons/bs"; -const Checkbox = ({ toggle, onClick = () => {}, text = "", color }) => { +const Checkbox = ({ + toggle, + onClick = () => {}, + text = "", + color, + customStyle = false, +}) => { return ( <div className="flex items-center hover:cursor-pointer w-fit" @@ -9,7 +15,9 @@ const Checkbox = ({ toggle, onClick = () => {}, text = "", color }) => { > <div data-cy="checkbox-bg" - className={`w-4 h-4 rounded-sm border border-white !bg-transparent ${ + className={`w-4 h-4 rounded-sm ${ + customStyle ? "border border-white !bg-transparent" : "" + } ${ toggle ? `${color ? color : "bg-hackathon-blue-100"}` : "bg-hackathon-gray-100" diff --git a/src/components/dynamic/ProtectedPage.jsx b/src/components/dynamic/ProtectedPage.jsx index 8c700625..c3d27fff 100644 --- a/src/components/dynamic/ProtectedPage.jsx +++ b/src/components/dynamic/ProtectedPage.jsx @@ -7,7 +7,12 @@ import RELEASES from "@/data/Releases"; import Fault from "@/utils/error"; import Navigation from "@/components/dynamic/Navigation"; -const ProtectedPage = ({ children, restrictions, title }) => { +const ProtectedPage = ({ + children, + restrictions, + title, + customStyle = false, +}) => { const { data: session, status } = useSession(); const [confirmed, setConfirmed] = useState(false); @@ -57,8 +62,16 @@ const ProtectedPage = ({ children, restrictions, title }) => { <> <title>{title} {navigation && } -
-
{children}
+
+
+ {children} +
)} diff --git a/src/components/dynamic/form/Questions.jsx b/src/components/dynamic/form/Questions.jsx index f2c765d8..f6fa95e3 100644 --- a/src/components/dynamic/form/Questions.jsx +++ b/src/components/dynamic/form/Questions.jsx @@ -125,6 +125,7 @@ const Questions = ({ }) } color="bg-transparent" + customStyle={true} /> ))} From 39599e1a5ac047ac3e4d8ca16b6fc2e7ce907105 Mon Sep 17 00:00:00 2001 From: NovaSagittarii Date: Thu, 4 Jan 2024 13:33:59 -0700 Subject: [PATCH 23/24] restore admin dashboard backgnd to light theme --- src/app/form/[type]/page.js | 1 + src/components/dynamic/Loading.jsx | 11 ++++++++--- src/components/dynamic/ProtectedPage.jsx | 4 ++-- tailwind.config.js | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/form/[type]/page.js b/src/app/form/[type]/page.js index 8d294dba..034e25b2 100644 --- a/src/app/form/[type]/page.js +++ b/src/app/form/[type]/page.js @@ -32,6 +32,7 @@ const Page = ({ params }) => { {components[params.type]} diff --git a/src/components/dynamic/Loading.jsx b/src/components/dynamic/Loading.jsx index 393b4c31..e618b448 100644 --- a/src/components/dynamic/Loading.jsx +++ b/src/components/dynamic/Loading.jsx @@ -1,11 +1,16 @@ import { AiOutlineLoading3Quarters } from "react-icons/ai"; -const Loading = () => { - return ( -
+const Loading = ({ customStyle = false }) => { + return customStyle ? ( +

Loading...

+ ) : ( +
+

Loading...

+ +
); }; diff --git a/src/components/dynamic/ProtectedPage.jsx b/src/components/dynamic/ProtectedPage.jsx index c3d27fff..0a588b2b 100644 --- a/src/components/dynamic/ProtectedPage.jsx +++ b/src/components/dynamic/ProtectedPage.jsx @@ -57,7 +57,7 @@ const ProtectedPage = ({ return ( <> - {status === "loading" && } + {status === "loading" && } {confirmed && ( <> {title} @@ -65,7 +65,7 @@ const ProtectedPage = ({
diff --git a/tailwind.config.js b/tailwind.config.js index 9e72e13c..b8228835 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -25,7 +25,7 @@ module.exports = { "gray-200": "#9ea4af", "gray-300": "#525252", "select-bg": "#3F3F3F", - page: "#000303" /* bear-dark */, + page: "#F5F5F5", tags: { "red-bg": "#FFE9E2", "red-text": "#F07167", @@ -50,6 +50,8 @@ module.exports = { }, bear: { dark: "#000303", + "page-gradient-1": "#000303", + "page-gradient-2": "#002525", teal: "#4ABFB5", "teal-100": "#B3FBF7", purple: "#B16FF0", From eb7195b4c6cd76af4b17538e6eeab12e88962d6f Mon Sep 17 00:00:00 2001 From: NovaSagittarii Date: Thu, 4 Jan 2024 13:58:06 -0700 Subject: [PATCH 24/24] add gap for spacing the toolbar mr-4 on checkbox previoy did this --- src/components/dynamic/admin/dashboards/Toolbar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dynamic/admin/dashboards/Toolbar.jsx b/src/components/dynamic/admin/dashboards/Toolbar.jsx index ad03638b..5057b036 100644 --- a/src/components/dynamic/admin/dashboards/Toolbar.jsx +++ b/src/components/dynamic/admin/dashboards/Toolbar.jsx @@ -173,7 +173,7 @@ const Toolbar = ({ return (
-
+
{tags.map((tag, index) => (