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

Sync with template #70

Merged
merged 83 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4c3fa90
Merge pull request #7 from bearhack-ucr/dev
shahdivyank Nov 5, 2023
7341886
Merge pull request #8 from bearhack-ucr/dev
shahdivyank Nov 5, 2023
14d6530
disabled several eslint rules that's causing errors, left the eslint …
JohnZ9865 Jan 5, 2024
7775599
removed react
JohnZ9865 Jan 7, 2024
860b80a
extended next/core-web-vitals and exempted less rules
JohnZ9865 Jan 7, 2024
697653e
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 11, 2024
305fe02
fixed all eslint warnings and errors, disabled some eslint rules
JohnZ9865 Jan 12, 2024
11e9ead
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 12, 2024
9f58c6d
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 15, 2024
77f7003
git pulled, and fixed all 'React Hook useEffect has a missing depende…
JohnZ9865 Jan 16, 2024
8516a73
ignore this
JohnZ9865 Jan 16, 2024
90a598f
added dependencies to ProtectedPage
JohnZ9865 Jan 18, 2024
42f9635
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 18, 2024
abbe914
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 19, 2024
09d920c
undid changes made in protectedPage
JohnZ9865 Jan 19, 2024
0dbc2f8
fixed lint errors on ProtectedPage?
JohnZ9865 Jan 19, 2024
428c720
Merge branch 'main' into template/update
NovaSagittarii Jan 22, 2024
a765fb8
Merge remote-tracking branch 'template/dev' into template/update
NovaSagittarii Jan 22, 2024
c292e31
think its fixed now
JohnZ9865 Jan 27, 2024
a52a854
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Jan 27, 2024
57c9b33
removed dependency that would've caused infinite loop
JohnZ9865 Jan 27, 2024
9034dd1
made EmailServices become send
JohnZ9865 Jan 28, 2024
4f0ab68
Resetted and pulled from dev. Added toast util
Fuyuki325 Jan 28, 2024
cac8ac2
added more questions to admin and committees
seanquiambao Jan 31, 2024
184d4dd
add table number to team name for judges
pondohoo Feb 1, 2024
d68cfee
add phone number validation
pondohoo Feb 1, 2024
d0b2627
fix user dashboard validation
pondohoo Feb 1, 2024
cfb9428
added if empty toast
stormyy00 Feb 1, 2024
779ae25
added toast for confirming users
stormyy00 Feb 1, 2024
3f7a783
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
JohnZ9865 Feb 1, 2024
a3b5366
fixed send
JohnZ9865 Feb 1, 2024
e18e856
removed search bar
JohnZ9865 Feb 1, 2024
a58fb0c
Merge pull request #1096 from acm-ucr/JohnZ/removeSearchBar
shahdivyank Feb 2, 2024
a19ca9d
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
Fuyuki325 Feb 4, 2024
fa8cdd8
export regex to different file
pondohoo Feb 4, 2024
6484e9d
added default resume + teams participant
seanquiambao Feb 4, 2024
40f848b
Toaster with Tailwind
Fuyuki325 Feb 7, 2024
fb5090c
remove branching
shahdivyank Feb 7, 2024
c48eda7
make explicit comparison to 0
shahdivyank Feb 7, 2024
403699e
rename variables
shahdivyank Feb 7, 2024
1b741b5
Merge pull request #1094 from acm-ucr/stormyy00/emailemt
shahdivyank Feb 7, 2024
4692e38
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
seanquiambao Feb 8, 2024
771dbf4
Merge pull request #1093 from acm-ucr/pondohoo/phoneNumber
shahdivyank Feb 8, 2024
e7a8408
cleanup
seanquiambao Feb 8, 2024
647c42d
Fixed Merge conflicts
Fuyuki325 Feb 8, 2024
d6484e3
flip team name and table number
pondohoo Feb 8, 2024
8c7cb60
Merge pull request #1097 from acm-ucr/seanquiambao/defaultresumeteam
shahdivyank Feb 8, 2024
0197e33
implicit return
pondohoo Feb 8, 2024
18d5bb6
Merge pull request #1095 from acm-ucr/stormyy00/toastOPS
shahdivyank Feb 8, 2024
4b9709a
Merge pull request #1092 from acm-ucr/pondohoo/teamTables
shahdivyank Feb 8, 2024
7aaedfa
fixed dashboard questions
seanquiambao Feb 8, 2024
2369ab0
Update src/data/dynamic/admin/Admins.js
shahdivyank Feb 8, 2024
766da2f
Merge pull request #1091 from acm-ucr/seanquiambao/questions
shahdivyank Feb 8, 2024
dc2e742
added submit page
fardinzam Feb 14, 2024
f1a9892
Merge pull request #1101 from acm-ucr/fardinzam/feedback-form
shahdivyank Feb 14, 2024
65ec209
Merge branch 'dev' into Fuyuki/toastUtil
shahdivyank Feb 14, 2024
fdd9a3f
remove excess packages
shahdivyank Feb 14, 2024
c7f13af
Merge branch 'Fuyuki/toastUtil' of https://github.com/acm-ucr/hackath…
shahdivyank Feb 14, 2024
c442d52
fix tests
shahdivyank Feb 14, 2024
6495878
Merge pull request #1024 from acm-ucr/Fuyuki/toastUtil
shahdivyank Feb 14, 2024
c6a0cd1
fix eslint
shahdivyank Feb 14, 2024
5435224
Merge remote-tracking branch 'template/dev' into template/update
NovaSagittarii Feb 14, 2024
669b38d
Merge branch 'dev' into template/update
NovaSagittarii Feb 14, 2024
f2c0163
fix place holder
menthy-wu Feb 15, 2024
856e96e
add space
menthy-wu Feb 15, 2024
38c870d
expect fail
chonml Feb 15, 2024
a386474
Merge pull request #1119 from acm-ucr/menthy/form
shahdivyank Feb 15, 2024
e4cfec2
removed end time, moved start time to front
fardinzam Feb 15, 2024
6c8191a
Merge pull request #1019 from acm-ucr/JohnZ/extendNext
shahdivyank Feb 15, 2024
a65c891
Merge pull request #1120 from acm-ucr/fardinzam/time-visuals
shahdivyank Feb 15, 2024
0fec9d7
fixed pulse animation in toaster.js
chonml Feb 15, 2024
6532e83
Merge pull request #1122 from acm-ucr/fix_pulse
shahdivyank Feb 17, 2024
78ae89e
Consolidated toaster into singular component
chonml Feb 17, 2024
e4dadf1
Replaced original toaster with new toaster that uses mapping to assig…
chonml Feb 17, 2024
579997a
added calendar time limits
fardinzam Feb 18, 2024
f086c2a
url
fardinzam Feb 18, 2024
2ec1d88
Merge branch 'dev' of https://github.com/acm-ucr/hackathon-website in…
shahdivyank Feb 19, 2024
9272119
reduce variables
shahdivyank Feb 19, 2024
85639f3
fixed to no default state and changed iconMapping -> icons
chonml Feb 19, 2024
afd6a98
fix
shahdivyank Feb 19, 2024
afc00d8
Merge pull request #1125 from acm-ucr/fardinzam/time-limits
shahdivyank Feb 20, 2024
ed4923b
Merge pull request #1124 from acm-ucr/Arkes123/ConsolidateToaster
shahdivyank Feb 20, 2024
c59cd54
Merge remote-tracking branch 'template/dev' into template/update
NovaSagittarii Feb 21, 2024
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
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
"browser": true,
"es2021": true
},
"extends": ["plugin:react/recommended", "google", "prettier"],
"extends": ["next/core-web-vitals", "google", "prettier"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"require-jsdoc": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
"require-jsdoc": 0
},
"settings": {
"react": {
Expand Down
6 changes: 3 additions & 3 deletions src/app/api/dashboard/[type]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "firebase/firestore";
import { authenticate } from "@/utils/auth";
import { AUTH, ATTRIBUTES } from "@/data/dynamic/admin/Dashboard";
import EmailService from "@/utils/email";
import send from "@/utils/email";
const types = new Set([
"admins",
"committees",
Expand Down Expand Up @@ -52,7 +52,7 @@ export async function POST(req, { params }) {
[`${params.type}.0`]: increment(1),
});

await EmailService.send({
await send({
email: user.email,
id: process.env.EMAIL_CONFIRMATION_TEMPLATE,
name: user.name,
Expand Down Expand Up @@ -137,7 +137,7 @@ export async function PUT(req, { params }) {
await updateDoc(doc(db, "users", object.uid), {
[`roles.${params.type}`]: status,
});
await EmailService.send({
await send({
email: object.email,
id:
status === 1
Expand Down
22 changes: 13 additions & 9 deletions src/app/user/join/[teamID]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,41 @@
import { useState, useEffect } from "react";
import Button from "@/components/dynamic/Button";
import { useRouter } from "next/navigation";
import toast from "react-hot-toast";
import toaster from "@/utils/toaster";
import { useSession } from "next-auth/react";
import Fault from "@/utils/error";
import { api } from "@/utils/api";

export default function page({ params }) {
export default function Page({ params }) {
const [team, setTeam] = useState(null);
const router = useRouter();
const { update: sessionUpdate } = useSession();

const { teamID } = params;

const handleJoin = () => {
api({
method: "PUT",
url: "/api/members",
body: { team: params.teamID },
body: { team: teamID },
}).then((response) => {
if (response.message !== "OK") {
toast(`❌ ${response.message}`);
toaster(`${response.message}`, "error");
return;
}
toast("✅ Successfully joined team!");
toaster("Successfully joined team!", "success");
sessionUpdate({
team: params.teamID,
team: teamID,
});
router.push("/user");
});
};

useEffect(() => {
if (params.teamID) {
if (teamID) {
api({
method: "GET",
url: `/api/team?teamid=${params.teamID}`,
url: `/api/team?teamid=${teamID}`,
}).then((response) => {
if (response.message === "OK") {
setTeam(response.items);
Expand All @@ -51,7 +55,7 @@ export default function page({ params }) {
}
});
}
}, []);
}, [teamID]);

return (
<div>
Expand Down
6 changes: 6 additions & 0 deletions src/components/dynamic/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Input = ({
editable = true,
maxLength,
required,
regex,
}) => {
return (
<div className="flex flex-col w-full">
Expand All @@ -24,6 +25,11 @@ const Input = ({
placeholder={placeholder}
value={value}
maxLength={maxLength}
onBlur={(e) => {
if (regex && !regex.test(e.target.value)) {
setUser({ ...user, [name]: "Invalid " + title });
}
}}
onChange={(e) => setUser({ ...user, [name]: e.target.value })}
data-cy={`${name}-input`}
/>
Expand Down
8 changes: 7 additions & 1 deletion src/components/dynamic/admin/dashboards/Admins.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"use client";
import { STATUSES, TAGS, COLUMNS } from "@/data/dynamic/admin/Admins.js";
import {
STATUSES,
TAGS,
COLUMNS,
DROPDOWN,
} from "@/data/dynamic/admin/Admins.js";
import Table from "./dashboard/Dashboard";

const Admin = () => {
Expand All @@ -11,6 +16,7 @@ const Admin = () => {
tags={TAGS}
page="admins"
statuses={STATUSES}
Dropdown={DROPDOWN}
empty="No Admins Available"
/>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/components/dynamic/admin/dashboards/Committees.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"use client";
import { STATUSES, TAGS, COLUMNS } from "@/data/dynamic/admin/Committees";
import {
STATUSES,
TAGS,
COLUMNS,
DROPDOWN,
} from "@/data/dynamic/admin/Committees";
import Table from "./dashboard/Dashboard";

const Committee = () => {
Expand All @@ -11,6 +16,7 @@ const Committee = () => {
tags={TAGS}
page="committees"
statuses={STATUSES}
Dropdown={DROPDOWN}
empty="No Committees Available"
/>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/components/dynamic/admin/dashboards/dashboard/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FaTimes } from "react-icons/fa";
import Image from "next/image";

const Modal = ({ data, setModal }) => {
return (
Expand All @@ -11,7 +12,12 @@ const Modal = ({ data, setModal }) => {
/>
</div>
<div className="bg-white px-3 rounded-b-xl py-2 border-x-2 border-b-2 border-hackathon-darkgray h-full w-full flex justify-center">
<img className="h-full" src={data.src} />
<Image
fill={true}
className="h-full"
src={data.src}
alt="Photo of the Judge"
/>
</div>
</div>
);
Expand Down
36 changes: 20 additions & 16 deletions src/components/dynamic/admin/dashboards/dashboard/Toolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
import { api } from "@/utils/api";
import { useEffect, useState } from "react";
import { useState, useEffect } from "react";
import { FaTrashAlt, FaUndoAlt } from "react-icons/fa";
import toast from "react-hot-toast";
import toaster from "@/utils/toaster";
import Popup from "../../Popup";
import Tag from "../../Tag";
import { COLORS } from "@/data/dynamic/Tags";
Expand Down Expand Up @@ -38,7 +38,7 @@ const Toolbar = ({
url: `/api/dashboard/${page}`,
}).then(({ items }) => {
setData(items);
toast("✅ Fetched Data Successfully");
toaster("Fetched Data Successfully", "success");
});
};

Expand All @@ -51,14 +51,14 @@ const Toolbar = ({
method: "DELETE",
url: `/api/dashboard/${page}?remove=${ids.join(",")}`,
}).then(() => {
toast("✅ Successfully Deleted");
toaster("Successfully Deleted", "success");
toggleAllRowsSelected(false);
});
};

const confirmDelete = () => {
if (rows.length === 0) {
toast("❌ No rows selected for deletion.");
toaster("No rows selected for deletion.", "error");
return;
}

Expand All @@ -74,14 +74,14 @@ const Toolbar = ({

const onClick = (value) => {
if (rows.length === 0) {
toast("❌ No items selected.");
toaster("No items selected.", "error");
return;
}

const notPending = rows.some((obj) => obj.status !== 0);

if (notPending) {
toast("❌ Only pending items can be changed!");
toaster("Only pending items can be changed!", "error");
toggleAllRowsSelected(false);
return;
}
Expand All @@ -94,18 +94,22 @@ const Toolbar = ({
status: value,
attribute: "status",
},
});
})
.then(() => {
const ids = rows.map(({ uid }) => uid);

const ids = rows.map(({ uid }) => uid);
setData(
data.map((a) => {
if (ids.includes(a.uid)) a.status = value;
return a;
})
);

setData(
data.map((a) => {
if (ids.includes(a.uid)) a.status = value;
return a;
})
);
toggleAllRowsSelected(false);

toggleAllRowsSelected(false);
toaster("Operation Completed", "success");
})
.catch(() => toaster("Operation Failed", "error"));
};

useEffect(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/components/dynamic/admin/services/Upload.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { RiAttachment2 } from "react-icons/ri";
import { FaTimes } from "react-icons/fa";
import { toast } from "react-hot-toast";
import toaster from "@/utils/toaster";
import { BYTES } from "@/data/dynamic/Bytes";
import { compress } from "@/utils/convert";

Expand All @@ -17,7 +17,7 @@ const Upload = ({ text, setObjects, objects, size, types }) => {
const handleInput = (e) => {
setUploading(true);
if (objects.files.length + e.target.files.length > 5) {
toast("❌ Exceeds 5 files!");
toaster("Exceeds 5 files!", "error");
setUploading(false);
return;
}
Expand All @@ -29,11 +29,11 @@ const Upload = ({ text, setObjects, objects, size, types }) => {
...Object.values(e.target.files).filter(async (file) => {
const blob = await compress(file);
if (blob.size > getSize(size)) {
toast(`❌ ${blob.name} exceeds ${size[0]} ${size[1]}`);
toaster(`${blob.name} exceeds ${size[0]} ${size[1]}`, "error");
return false;
}
if (objects.files.map((file) => file.name).includes(file.name)) {
toast(`❌ ${file.name} is already uploaded`);
toaster(`${file.name} is already uploaded`, "error");
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/components/dynamic/admin/services/calendar/Event.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ const Event = ({ event, view }) => {
return (
<div className="p-0.5">
<p className="inline text-xs">
{event.summary}
{view === "month" && (
<>
{" - "}
{new Date(event.start).toLocaleTimeString(navigator.language, {
hour: "2-digit",
minute: "2-digit",
})}
{" - "}
</>
)}
{event.summary}
</p>
</div>
);
Expand Down
25 changes: 20 additions & 5 deletions src/components/dynamic/admin/services/calendar/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@ const CalendarEvents = () => {
};

useEffect(() => {
const min = new Date(
new Date().getTime() - 20 * 7 * 24 * 60 * 60 * 1000
).toISOString();

const max = new Date(
new Date().getTime() + 20 * 7 * 24 * 60 * 60 * 1000
).toISOString();

const hackathon = api({
method: "GET",
url: `https://www.googleapis.com/calendar/v3/calendars/${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR}/events?key=${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_API_KEY}&singleEvents=true&orderBy=startTime`,
url: `https://www.googleapis.com/calendar/v3/calendars/${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR}/events?key=${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_API_KEY}&singleEvents=true&orderBy=startTime&timeMin=${min}&timeMax=${max}`,
});

const leads = api({
method: "GET",
url: `https://www.googleapis.com/calendar/v3/calendars/${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_LEADS}/events?key=${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_API_KEY}&singleEvents=true&orderBy=startTime`,
url: `https://www.googleapis.com/calendar/v3/calendars/${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_LEADS}/events?key=${process.env.NEXT_PUBLIC_GOOGLE_CALENDAR_API_KEY}&singleEvents=true&orderBy=startTime&timeMin=${min}&timeMax=${max}`,
});

Promise.all([hackathon, leads]).then(([hackathonData, leadsData]) => {
Expand Down Expand Up @@ -81,9 +89,16 @@ const CalendarEvents = () => {
onNavigate={(newDate) => setDate(newDate)}
onView={(newView) => setView(newView)}
components={{
event: (props) => <Event {...props} view={view} />,
toolbar: (props) => (
<Toolbar {...props} events={events} setEvents={setEvents} />
event: ({ event }) => <Event event={event} view={view} />,
toolbar: ({ onView, onNavigate, date, view }) => (
<Toolbar
onView={onView}
onNavigate={onNavigate}
date={date}
view={view}
events={events}
setEvents={setEvents}
/>
),
}}
eventPropGetter={(event) => {
Expand Down
5 changes: 0 additions & 5 deletions src/components/dynamic/admin/services/calendar/Modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ const CalendarModal = ({ event, setEvent }) => {
hour: "numeric",
minute: "2-digit",
})}
{" - "}
{event.end.toLocaleString("default", {
hour: "numeric",
minute: "2-digit",
})}
</div>
<div>
<Tag
Expand Down
Loading
Loading