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 production with dev #36

Merged
merged 37 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
afc38b5
migrate from clerk user metadata
joshuasilva414 Sep 15, 2024
297823d
Merge remote-tracking branch 'upstream/dev' into dev
christianhelp Sep 24, 2024
3f0730e
adds hackkit credits
christianhelp Sep 24, 2024
169c9b9
Added text saying only accepted files are PDF. Might want to make it …
jacobellerbrock Sep 30, 2024
52db3b5
Upgrade Next Safe Action (#118)
joshuasilva414 Oct 2, 2024
a4d6525
fix registration default
christianhelp Oct 5, 2024
089490c
Added "Presented by SWIVEL"
jacobellerbrock Oct 7, 2024
56fcc55
Update README.md
Lermatroid Oct 8, 2024
ae09168
Fixed text overflow on user dashboard (#25)
mjanderson1227 Oct 9, 2024
1d27be5
Revert "Fixed text overflow on user dashboard (#25)" (#26)
christianhelp Oct 13, 2024
e712b3e
fixes overflow
christianhelp Oct 13, 2024
5641aeb
adds guilds
christianhelp Oct 13, 2024
8cda4ad
fixes schedule default
christianhelp Oct 14, 2024
aec7a29
Add event location (#124)
joshuasilva414 Oct 14, 2024
e438128
fixed xs screen size overriding all other sizes (#28)
mjanderson1227 Oct 14, 2024
adb3472
updates bot name
christianhelp Oct 15, 2024
ba4aa3c
Merge remote-tracking branch 'origin/dev' into dev
christianhelp Oct 15, 2024
97bc773
updates user profile
christianhelp Oct 15, 2024
9d8e2a1
updates media query size
christianhelp Oct 15, 2024
7644a1a
Adding Team Section (#29)
jacobellerbrock Oct 21, 2024
f4d1cc4
Merge branch 'production' into dev
jacobellerbrock Oct 22, 2024
2123259
Merging in new schedule enhancements (#128)
jacobellerbrock Oct 22, 2024
e99bf9c
updates from prod
christianhelp Oct 23, 2024
638fd57
Fix Hackathon Check-In Scanner (#130)
christianhelp Oct 24, 2024
11c5602
fix admin link check
christianhelp Oct 24, 2024
19d324c
Satisfies User Settings w/ New Schema (#112)
jacobellerbrock Oct 24, 2024
8ff9c0f
Merge remote-tracking branch 'upstream/dev' into dev
christianhelp Oct 24, 2024
601bcc3
test update image
christianhelp Oct 24, 2024
3c7d9df
mobile optimize pass
christianhelp Oct 24, 2024
b24fe59
I made cool schedule (#33)
joshuasilva414 Oct 24, 2024
804be3f
fix current event logic
joshuasilva414 Oct 24, 2024
ec33cbe
fix current event display
joshuasilva414 Oct 24, 2024
bba616c
adds survival guide
christianhelp Oct 25, 2024
6f23635
small event layout change
christianhelp Oct 25, 2024
e0c5ecf
updates theming
christianhelp Oct 25, 2024
45fb503
Merge remote-tracking branch 'origin/production' into dev
christianhelp Oct 25, 2024
ae8a7db
updates settings
christianhelp Oct 25, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ yarn-error.log*

# vscode
.vscode

#Jetbrians
.idea
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
</p>
<h1 align="center" style="margin-top: 0px;font-weight:800">HackKit</h1>
<h3 align="center"><b>Feature-packed Hackathon Managment Software That Just Works.</b><br></h3><br/>
<p>Putting together a hackathon is not an easy feat, like really not easy. While ACM UTSA's tech team can't help you with delayed packages, food orders being botched, or any of the other issues that can arise at the worst times, we can help you with the tech to make your hackathon go smoothly. <i>HackKit</i> is battle-tested and feature-packed to help your hackathon be the best it can be. From a seamless registration, to an easy-to-use admin panel, to event passes and more, <i>HackKit</i> has you covered. </p>
<p>Putting together a hackathon is not an easy feat, like really not easy. While we can't help you with delayed packages, food orders being botched, or any of the other issues that can arise at the worst times, we can help you with the tech to make your hackathon go smoothly. <i>HackKit</i> is battle-tested and feature-packed to help your hackathon be the best it can be. From a seamless registration, to an easy-to-use admin panel, to event passes and more, <i>HackKit</i> has you covered. </p>
<p>Want to get started with using <i>HackKit</i>? Check out our <a href="https://oss-acmutsa.vercel.app/">OSS Documents</a> that will be updated as we add new features and fix bugs! </p>
<p>
Have any questions, feedback, or need help hosting? Join our <a href="https://discord.acmutsa.org">Discord</a> or <a href="mailto:[email protected]"> Contact our projects officer.</a></p></p>

**The offical website for RowdyHacks 2024!**

## Technologies Used

- TypeScript
Expand All @@ -21,12 +19,10 @@

## Join The Team

Want to help make RowdyHacks the best Hackathon around? Please reach out to us at `team@rowdyhacks.org`!
Want to help us build HackKit? Please reach out to us at `tech@acmutsa.org` or join us on [Discord](https://go.acmutsa.org/projectsdiscord)!

## RH 2024 Website Contributors
## HackKit Contributors

<a href="https://github.com/acmutsa/RowdyHacks24/graphs/contributors">
<img src="https://contrib.rocks/image?repo=acmutsa/RowdyHacks24" />
<a href="https://github.com/acmutsa/HackKit/graphs/contributors">
<img src="https://contrib.rocks/image?repo=acmutsa/HackKit" />
</a>

[📣❤️ Other Contributions ❤️📣](https://github.com/UTSA-ACM/RowdyHacks24/blob/dev/contributions.md)
22 changes: 11 additions & 11 deletions apps/bot/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -239,25 +239,25 @@ 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);

if (!member) {
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 });
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"lucide-react": "^0.411.0",
"nanoid": "^5.0.7",
"next": "14.2.5",
"next-safe-action": "^5.2.3",
"next-safe-action": "^7.9.3",
"no-profanity": "^1.5.1",
"pg": "^8.12.0",
"postcss": "8.4.39",
Expand Down
42 changes: 22 additions & 20 deletions apps/web/src/actions/admin/modify-nav-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const metadataSchema = z.object({
// Maybe a better way to do this for revalidation? Who knows.
const navAdminPage = "/admin/toggles/landing";

export const setItem = adminAction(
metadataSchema,
async ({ name, url }, { user, userId }) => {
export const setItem = adminAction
.schema(metadataSchema)
.action(async ({ parsedInput: { name, url }, ctx: { user, userId } }) => {
await kv.sadd("config:navitemslist", encodeURIComponent(name));
await kv.hset(`config:navitems:${encodeURIComponent(name)}`, {
url,
Expand All @@ -24,29 +24,31 @@ export const setItem = adminAction(
});
revalidatePath(navAdminPage);
return { success: true };
},
);
});

export const removeItem = adminAction(
z.string(),
async (name, { user, userId }) => {
export const removeItem = adminAction
.schema(z.string())
.action(async ({ parsedInput: name, ctx: { user, userId } }) => {
const pipe = kv.pipeline();
pipe.srem("config:navitemslist", encodeURIComponent(name));
pipe.del(`config:navitems:${encodeURIComponent(name)}`);
await pipe.exec();
// await new Promise((resolve) => setTimeout(resolve, 1500));
revalidatePath(navAdminPage);
return { success: true };
},
);
});

export const toggleItem = adminAction(
z.object({ name: z.string(), statusToSet: z.boolean() }),
async ({ name, statusToSet }, { user, userId }) => {
await kv.hset(`config:navitems:${encodeURIComponent(name)}`, {
enabled: statusToSet,
});
revalidatePath(navAdminPage);
return { success: true, itemStatus: statusToSet };
},
);
export const toggleItem = adminAction
.schema(z.object({ name: z.string(), statusToSet: z.boolean() }))
.action(
async ({
parsedInput: { name, statusToSet },
ctx: { user, userId },
}) => {
await kv.hset(`config:navitems:${encodeURIComponent(name)}`, {
enabled: statusToSet,
});
revalidatePath(navAdminPage);
return { success: true, itemStatus: statusToSet };
},
);
36 changes: 16 additions & 20 deletions apps/web/src/actions/admin/registration-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,34 @@ const defaultRegistrationToggleSchema = z.object({
enabled: z.boolean(),
});

export const toggleRegistrationEnabled = adminAction(
defaultRegistrationToggleSchema,
async ({ enabled }, { user, userId }) => {
export const toggleRegistrationEnabled = adminAction
.schema(defaultRegistrationToggleSchema)
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
await kv.set("config:registration:registrationEnabled", enabled);
revalidatePath("/admin/toggles/registration");
return { success: true, statusSet: enabled };
},
);
});

export const toggleRegistrationMessageEnabled = adminAction(
defaultRegistrationToggleSchema,
async ({ enabled }, { user, userId }) => {
export const toggleRegistrationMessageEnabled = adminAction
.schema(defaultRegistrationToggleSchema)
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
await kv.set("config:registration:registrationMessageEnabled", enabled);
revalidatePath("/admin/toggles/registration");
return { success: true, statusSet: enabled };
},
);
});

export const toggleSecretRegistrationEnabled = adminAction(
defaultRegistrationToggleSchema,
async ({ enabled }, { user, userId }) => {
export const toggleSecretRegistrationEnabled = adminAction
.schema(defaultRegistrationToggleSchema)
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
await kv.set("config:registration:secretRegistrationEnabled", enabled);
revalidatePath("/admin/toggles/registration");
return { success: true, statusSet: enabled };
},
);
});

export const toggleRSVPs = adminAction(
defaultRegistrationToggleSchema,
async ({ enabled }, { user, userId }) => {
export const toggleRSVPs = adminAction
.schema(defaultRegistrationToggleSchema)
.action(async ({ parsedInput: { enabled }, ctx: { user, userId } }) => {
await kv.set("config:registration:allowRSVPs", enabled);
revalidatePath("/admin/toggles/registration");
return { success: true, statusSet: enabled };
},
);
});
123 changes: 78 additions & 45 deletions apps/web/src/actions/admin/scanner-admin-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,84 @@ import { z } from "zod";
import { db, sql } from "db";
import { scans, userCommonData } from "db/schema";
import { eq, and } from "db/drizzle";
export const createScan = adminAction(
z.object({
eventID: z.number(),
userID: z.string(),
creationTime: z.date(),
countToSet: z.number(),
alreadyExists: z.boolean(),
}),
async (
{ eventID, userID, creationTime, countToSet, alreadyExists },
{ user, userId },
) => {
if (alreadyExists) {
await db
.update(scans)
.set({ count: countToSet, updatedAt: creationTime })
.where(
and(eq(scans.eventID, eventID), eq(scans.userID, userID)),
);
} else {
await db.insert(scans).values({
userID: userID,
updatedAt: creationTime,
count: 1,
eventID: eventID,
});
}
return { success: true };
},
);

export const getScan = adminAction(
z.object({ eventID: z.number(), userID: z.string() }),
async ({ eventID, userID }, { user, userId: adminUserID }) => {
const scan = await db.query.scans.findFirst({
where: and(eq(scans.eventID, eventID), eq(scans.userID, userID)),
});
return scan;
},
);
export const createScan = adminAction
.schema(
z.object({
eventID: z.number(),
userID: z.string(),
creationTime: z.date(),
countToSet: z.number(),
alreadyExists: z.boolean(),
}),
)
.action(
async ({
parsedInput: {
eventID,
userID,
creationTime,
countToSet,
alreadyExists,
},
ctx: { user, userId },
}) => {
if (alreadyExists) {
await db
.update(scans)
.set({ count: countToSet, updatedAt: creationTime })
.where(
and(
eq(scans.eventID, eventID),
eq(scans.userID, userID),
),
);
} else {
await db.insert(scans).values({
userID: userID,
updatedAt: creationTime,
count: 1,
eventID: eventID,
});
}
return { success: true };
},
);

export const getScan = adminAction
.schema(z.object({ eventID: z.number(), userID: z.string() }))
.action(
async ({
parsedInput: { eventID, userID },
ctx: { user, userId: adminUserID },
}) => {
const scan = await db.query.scans.findFirst({
where: and(
eq(scans.eventID, eventID),
eq(scans.userID, userID),
),
});
return scan;
},
);

export const checkInUser = adminAction(z.string(), async (user) => {
// Set checkinTimestamp
return await db
.update(userCommonData)
.set({ checkinTimestamp: sql`now()` })
.where(eq(userCommonData.clerkID, user));
// Schema will be moved over when rewrite of the other scanner happens
const checkInUserSchema = z.object({
userID: z.string(),
QRTimestamp: z
.number()
.positive()
.refine((timestamp) => {
return Date.now() - timestamp < 5 * 60 * 1000;
}, "QR Code has expired. Please tell user refresh the QR Code"),
});

export const checkInUserToHackathon = adminAction
.schema(checkInUserSchema)
.action(async ({ parsedInput: { userID } }) => {
// Set checkinTimestamp
await db
.update(userCommonData)
.set({ checkinTimestamp: sql`now()` })
.where(eq(userCommonData.clerkID, userID));
});
Loading
Loading