From b24fe59535677622a3ce9446096aec0bc78db9d8 Mon Sep 17 00:00:00 2001 From: Joshua Silva <72359611+joshuasilva414@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:38:01 -0500 Subject: [PATCH] I made cool schedule (#33) * Schedule timeline * Mobile optimizations * Prettier formatted --- apps/bot/bot.ts | 22 ++++++------- apps/web/src/actions/discord-verify.ts | 17 ++++------ apps/web/src/app/dash/pass/page.tsx | 2 +- apps/web/src/app/dash/schedule/page.tsx | 33 ++++++++++++++++++- .../app/dash/schedule/schedule-timeline.tsx | 17 ++++++---- .../dash/overview/ServerBubbles.tsx | 2 -- 6 files changed, 61 insertions(+), 32 deletions(-) diff --git a/apps/bot/bot.ts b/apps/bot/bot.ts index f8ceedb0..8d582822 100644 --- a/apps/bot/bot.ts +++ b/apps/bot/bot.ts @@ -151,9 +151,9 @@ app.get("/postMsgToServer", (h) => { text: "Questions or issues? Contact an organizer :)", iconURL: "https://static.acmutsa.org/Info_Simple.svg.png", }); - console.log( - `server type is: ${serverType}\nDev channel id is: ${process.env.DISCORD_DEV_VERIFY_CHANNEL_ID}\nProd channel id is: ${process.env.DISCORD_PROD_VERIFY_CHANNEL_ID}`, - ); + console.log( + `server type is: ${serverType}\nDev channel id is: ${process.env.DISCORD_DEV_VERIFY_CHANNEL_ID}\nProd channel id is: ${process.env.DISCORD_PROD_VERIFY_CHANNEL_ID}`, + ); const channel = client.channels.cache.get( serverType === "dev" ? (process.env.DISCORD_DEV_VERIFY_CHANNEL_ID as string) @@ -239,7 +239,7 @@ app.post("/api/checkDiscordVerification", async (h) => { return h.json({ success: false }); } - console.log("attempting to get member...") + console.log("attempting to get member..."); const member = guild.members.cache.get(verification.discordUserID); @@ -247,17 +247,17 @@ app.post("/api/checkDiscordVerification", async (h) => { console.log("failed cause could not find member"); return h.json({ success: false }); } - console.log('got member'); + console.log("got member"); // Holy waterfalling request - console.log('adding role'); + console.log("adding role"); await member.roles.add(role); - console.log('added role'); - console.log('adding group role'); + console.log("added role"); + console.log("adding group role"); await member.roles.add(userGroupRole); - console.log('added group role'); - console.log('setting nickname'); + console.log("added group role"); + console.log("setting nickname"); await member.setNickname(user.firstName + " " + user.lastName); - console.log('set nickname'); + console.log("set nickname"); return h.json({ success: true }); }); diff --git a/apps/web/src/actions/discord-verify.ts b/apps/web/src/actions/discord-verify.ts index 1127328d..ea489515 100644 --- a/apps/web/src/actions/discord-verify.ts +++ b/apps/web/src/actions/discord-verify.ts @@ -36,17 +36,14 @@ export const confirmVerifyDiscord = authenticatedAction env.BOT_API_URL + "/api/checkDiscordVerification?access=" + env.INTERNAL_AUTH_KEY; - console.log("url is: ", url); - const res = await fetch( - url, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ code }), + console.log("url is: ", url); + const res = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", }, - ); + body: JSON.stringify({ code }), + }); let resJson = await res.json(); console.log(resJson); diff --git a/apps/web/src/app/dash/pass/page.tsx b/apps/web/src/app/dash/pass/page.tsx index 894b1ac5..0c9016ae 100644 --- a/apps/web/src/app/dash/pass/page.tsx +++ b/apps/web/src/app/dash/pass/page.tsx @@ -63,7 +63,7 @@ function EventPass({ qrPayload, user, clerk, guild }: EventPassProps) {

{user.firstName}

-
+

@{user.hackerTag}

diff --git a/apps/web/src/app/dash/schedule/page.tsx b/apps/web/src/app/dash/schedule/page.tsx index b2b059c3..4b686a26 100644 --- a/apps/web/src/app/dash/schedule/page.tsx +++ b/apps/web/src/app/dash/schedule/page.tsx @@ -6,13 +6,44 @@ import { getAllEvents } from "db/functions"; import { headers } from "next/headers"; import { VERCEL_IP_TIMEZONE_HEADER_KEY } from "@/lib/constants"; import { getClientTimeZone } from "@/lib/utils/client/shared"; +import { Badge } from "@/components/shadcn/ui/badge"; +import c from "config"; export default async function Page() { const sched = await getAllEvents(); + + const currentEvent = sched.filter((e) => { + const currentTime = new Date(); + return !(e.startTime < currentTime && e.endTime > currentTime); + })[0]; const userTimeZoneHeaderKey = headers().get(VERCEL_IP_TIMEZONE_HEADER_KEY); const userTimeZone = getClientTimeZone(userTimeZoneHeaderKey); return ( <> -

Schedule

+
+

+ Schedule +

+
+

Current

+
+

+ {currentEvent?.title || "No current events"}{" "} + + )[currentEvent?.type], + }} + > +

{currentEvent.type}

+ +

+
+
+
+ }> {/* */} diff --git a/apps/web/src/app/dash/schedule/schedule-timeline.tsx b/apps/web/src/app/dash/schedule/schedule-timeline.tsx index 6737ad25..7ff2d337 100644 --- a/apps/web/src/app/dash/schedule/schedule-timeline.tsx +++ b/apps/web/src/app/dash/schedule/schedule-timeline.tsx @@ -39,13 +39,16 @@ export default function ScheduleTimeline({ timezone, }: ScheduleTimelineProps) { return ( -
+
{Array.from(splitByDay(schedule).entries()).map( ([dayName, arr]): ReactNode => ( <> - + @@ -101,8 +104,8 @@ export function EventRow({ event, userTimeZone }: EventRowProps) { const color = (c.eventTypes as Record)[event.type]; return ( - - + + -
-

+

{dayName}

{`${startTimeFormatted} - ${endTimeFormatted}`}
{`${startTimeFormatted} - ${endTimeFormatted}`} )} -
+
+
{event.title}{" "}
-

- {c.hackathonName}