diff --git a/app/(with-layout)/event/prizes/page.tsx b/app/(with-layout)/event/prizes/page.tsx index 7d12eb86..610e8b5f 100644 --- a/app/(with-layout)/event/prizes/page.tsx +++ b/app/(with-layout)/event/prizes/page.tsx @@ -11,7 +11,7 @@ export default function Page() { return (
-

$5500+ In Prizes

+

$3500+ In Prizes


diff --git a/app/(without-layout)/page.tsx b/app/(without-layout)/page.tsx index 66407904..d58a6ef0 100644 --- a/app/(without-layout)/page.tsx +++ b/app/(without-layout)/page.tsx @@ -6,6 +6,7 @@ import NavBar from "@/components/nav-bar/nav-bar"; import AboutSection from "../../components/about-us"; import TeamComponent from "@/components/team/team"; import Sponsors from "@/components/sponsors"; +import Footer from "@/components/footer/footer"; export default function Home() { return ( @@ -20,6 +21,7 @@ export default function Home() {
+
diff --git a/app/api/mongodb.ts b/app/api/mongodb.ts new file mode 100644 index 00000000..360eb829 --- /dev/null +++ b/app/api/mongodb.ts @@ -0,0 +1,18 @@ + +import * as dotenv from "dotenv"; +import mongoose from "mongoose"; + +dotenv.config(); + +const MONGO_URI = process.env.MONGO_URI; + +console.log("Mongo URI:", MONGO_URI); + +export async function connectDB(){ + if(MONGO_URI) { + const connectDB = mongoose + .connect(MONGO_URI) + .then(() => console.log("MongoDB Connected")) + .catch((err) => console.error("MongoDB Connection error:", err)); + } +} \ No newline at end of file diff --git a/app/api/schedule/route.ts b/app/api/schedule/route.ts new file mode 100644 index 00000000..5498caef --- /dev/null +++ b/app/api/schedule/route.ts @@ -0,0 +1,88 @@ +import { NextResponse } from "next/server"; +import { connectDB } from "../mongodb"; +import Schedule from "./schedule"; + +const EVENT_TYPES = ["ceremony", "workshop", "food", "fireside chat", "mentoring", "event"] as const; + +function parseBody(json: any) { + const errors: string[] = []; + + const str = (v: any) => (typeof v === "string" ? v.trim() : ""); + const bool = (v: any) => (typeof v === "boolean" ? v : v === "true"); + const num = (v: any) => (typeof v === "number" ? v : Number(v)); + + const name = str(json.name); + const location = str(json.location); + const host = str(json.host ?? ""); + const description = str(json.description ?? ""); + const event_created_by = str(json.event_created_by); + + const start_time = new Date(json.start_time); + const end_time = new Date(json.end_time); + + const column = num(json.column); + const discord_auto_announce = bool(json.discord_auto_announce); + + const event_type = str(json.event_type); + + if (!name) errors.push("name"); + if (!location) errors.push("location"); + if (!event_created_by) errors.push("event_created_by"); + if (!(start_time instanceof Date) || isNaN(start_time.getTime())) errors.push("start_time"); + if (!(end_time instanceof Date) || isNaN(end_time.getTime())) errors.push("end_time"); + if (start_time && end_time && start_time > end_time) errors.push("start_time <= end_time"); + if (![1, 2, 3, 4].includes(column)) errors.push("column (1-4)"); + if (!EVENT_TYPES.includes(event_type as any)) errors.push("event_type"); + + return { + ok: errors.length === 0, + errors, + doc: { + name, + location, + host, + description, + event_created_by, + start_time, + end_time, + column, + discord_auto_announce, + event_type, + }, + }; +} + +export async function GET() { + try { + await connectDB(); + const items = await Schedule.find().sort({ start_time: 1, createdAt: -1 }); + return NextResponse.json(items); + } catch (err) { + console.error("Error fetching schedule:", err); + return NextResponse.json({ error: "Failed to fetch schedule" }, { status: 500 }); + } +} + +export async function POST(req: Request) { + try { + await connectDB(); + const body = await req.json(); + const parsed = parseBody(body); + + console.log("WE GOT HERE") + console.log(parsed) + + if (!parsed.ok) { + return NextResponse.json( + { error: "Invalid/missing fields", fields: parsed.errors }, + { status: 400 } + ); + } + + const created = await Schedule.create(parsed.doc); + return NextResponse.json(created.toObject(), { status: 201 }); + } catch (err) { + console.error("Error creating schedule:", err); + return NextResponse.json({ error: "Failed to create schedule" }, { status: 500 }); + } +} diff --git a/app/api/schedule/schedule.ts b/app/api/schedule/schedule.ts new file mode 100644 index 00000000..4017731c --- /dev/null +++ b/app/api/schedule/schedule.ts @@ -0,0 +1,33 @@ +import mongoose, { Schema, model, models, InferSchemaType } from "mongoose"; + +const ScheduleSchema = new Schema( + { + name: { type: String, required: true }, + location: { type: String, required: true }, + host: { type: String, default: "" }, + description: { type: String, default: "" }, + event_created_by: { type: String, required: true }, + + start_time: { type: Date, required: true }, + end_time: { type: Date, required: true }, + + column: { type: Number, required: true, enum: [1, 2, 3, 4] }, + discord_auto_announce: { type: Boolean, required: true, default: false }, + + event_type: { + type: String, + required: true, + enum: ["ceremony", "workshop", "food", "fireside chat", "mentoring", "event"], + }, + }, + { timestamps: true } +); + +//prevent schema staleness in Next.js dev +if (process.env.NODE_ENV === "development") { + delete (mongoose.connection.models as any).Schedule; +} + +export type ScheduleDoc = InferSchemaType & { _id: string }; +export default (models.Schedule as mongoose.Model) || + model("Schedule", ScheduleSchema); diff --git a/app/globals.css b/app/globals.css index 0a8620af..9b40211b 100644 --- a/app/globals.css +++ b/app/globals.css @@ -74,3 +74,109 @@ line-height: 2.5rem; } } + +.bg { + background: url("/backgroundImage.jpg") no-repeat; + background-size: cover; + height: 100%; + width: 100%; + position: fixed; + top: 0; + left: 0; + z-index: -3; +} + +.bg:before { + content: ""; + width: 100%; + height: 100%; + background: #000; + position: fixed; + z-index: -1; + top: 0; + left: 0; + opacity: 0.3; +} + +@keyframes sf-fly-by-1 { + from { + transform: translateZ(-600px); + opacity: 0.5; + } + to { + transform: translateZ(0); + opacity: 0.5; + } +} +@keyframes sf-fly-by-2 { + from { + transform: translateZ(-1200px); + opacity: 0.5; + } + to { + transform: translateZ(-600px); + opacity: 0.5; + } +} +@keyframes sf-fly-by-3 { + from { + transform: translateZ(-1800px); + opacity: 0.5; + } + to { + transform: translateZ(-1200px); + opacity: 0.5; + } +} + +.star-field { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + perspective: 600px; + -webkit-perspective: 600px; + z-index: -2; +} + +.star-field .layer { + box-shadow: -411px -476px #cccccc, 777px -407px #d4d4d4, -387px -477px #fcfcfc, -91px -235px #d4d4d4, + 491px -460px #f7f7f7, 892px -128px #f7f7f7, 758px -277px #ededed, 596px 378px #cccccc, 647px 423px whitesmoke, + 183px 389px #c7c7c7, 524px -237px #f0f0f0, 679px -535px #e3e3e3, 158px 399px #ededed, 157px 249px #ededed, + 81px -450px #ebebeb, 719px -360px #c2c2c2, -499px 473px #e8e8e8, -158px -349px #d4d4d4, 870px -134px #cfcfcf, + 446px 404px #c2c2c2, 440px 490px #d4d4d4, 414px 507px #e6e6e6, -12px 246px #fcfcfc, -384px 369px #e3e3e3, + 641px -413px #fcfcfc, 822px 516px #dbdbdb, 449px 132px #c2c2c2, 727px 146px #f7f7f7, -315px -488px #e6e6e6, + 952px -70px #e3e3e3, -869px -29px #dbdbdb, 502px 80px #dedede, 764px 342px #e0e0e0, -150px -380px #dbdbdb, + 654px -426px #e3e3e3, -325px -263px #c2c2c2, 755px -447px #c7c7c7, 729px -177px #c2c2c2, -682px -391px #e6e6e6, + 554px -176px #ededed, -85px -428px #d9d9d9, 714px 55px #e8e8e8, 359px -285px #cfcfcf, -362px -508px #dedede, + 468px -265px #fcfcfc, 74px -500px #c7c7c7, -514px 383px #dbdbdb, 730px -92px #cfcfcf, -112px 287px #c9c9c9, + -853px 79px #d6d6d6, 828px 475px #d6d6d6, -681px 13px #fafafa, -176px 209px #f0f0f0, 758px 457px #fafafa, + -383px -454px #ededed, 813px 179px #d1d1d1, 608px 98px whitesmoke, -860px -65px #c4c4c4, -572px 272px #f7f7f7, + 459px 533px #fcfcfc, 624px -481px #e6e6e6, 790px 477px #dedede, 731px -403px #ededed, 70px -534px #cccccc, + -23px 510px #cfcfcf, -652px -237px whitesmoke, -690px 367px #d1d1d1, 810px 536px #d1d1d1, 774px 293px #c9c9c9, + -362px 97px #c2c2c2, 563px 47px #dedede, 313px 475px #e0e0e0, 839px -491px #e3e3e3, -217px 377px #d4d4d4, + -581px 239px #c2c2c2, -857px 72px #cccccc, -23px 340px #dedede, -837px 246px white, 170px -502px #cfcfcf, + 822px -443px #e0e0e0, 795px 497px #e0e0e0, -814px -337px #cfcfcf, 206px -339px #f2f2f2, -779px 108px #e6e6e6, + 808px 2px #d4d4d4, 665px 41px #d4d4d4, -564px 64px #cccccc, -380px 74px #cfcfcf, -369px -60px #f7f7f7, + 47px -495px #e3e3e3, -383px 368px #f7f7f7, 419px 288px #d1d1d1, -598px -50px #c2c2c2, -833px 187px #c4c4c4, + 378px 325px whitesmoke, -703px 375px #d6d6d6, 392px 520px #d9d9d9, -492px -60px #c4c4c4, 759px 288px #ebebeb, + 98px -412px #c4c4c4, -911px -277px #c9c9c9; + transform-style: preserve-3d; + position: absolute; + top: 50%; + left: 50%; + height: 4px; + width: 4px; + border-radius: 2px; +} + +.star-field .layer:nth-child(1) { + animation: sf-fly-by-1 5s linear infinite; +} +.star-field .layer:nth-child(2) { + animation: sf-fly-by-2 5s linear infinite; +} +.star-field .layer:nth-child(3) { + animation: sf-fly-by-3 5s linear infinite; +} \ No newline at end of file diff --git a/app/schedule/page.tsx b/app/schedule/page.tsx new file mode 100644 index 00000000..b3167cc8 --- /dev/null +++ b/app/schedule/page.tsx @@ -0,0 +1,161 @@ +"use client"; + +import { useEffect, useState } from "react"; + +type ScheduleItem = { + _id: string; + name: string; + location: string; + host: string; + description: string; + event_created_by: string; + start_time: string; // ISO + end_time: string; // ISO + column: 1 | 2 | 3 | 4; + discord_auto_announce: boolean; + event_type: "ceremony" | "workshop" | "food" | "fireside chat" | "mentoring" | "event"; +}; + +const EVENT_TYPES = ["ceremony", "workshop", "food", "fireside chat", "mentoring", "event"] as const; + +export default function SchedulePage() { + const [items, setItems] = useState([]); + const [loading, setLoading] = useState(false); + + const [form, setForm] = useState({ + name: "", + location: "", + host: "", + description: "", + event_created_by: "", + start_time: "", + end_time: "", + column: 1 as 1 | 2 | 3 | 4, + discord_auto_announce: false, + event_type: "event" as ScheduleItem["event_type"], + }); + + const fetchItems = async () => { + const res = await fetch("/api/schedule", { cache: "no-store" }); + if (!res.ok) return; + const data: ScheduleItem[] = await res.json(); + setItems(data); + }; + + useEffect(() => { + fetchItems(); + }, []); + + const onSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + setLoading(true); + + const res = await fetch("/api/schedule", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + ...form, + // `datetime-local` gives 'YYYY-MM-DDTHH:mm'; send ISO for backend Date + start_time: new Date(form.start_time).toISOString(), + end_time: new Date(form.end_time).toISOString(), + }), + }); + + setLoading(false); + + if (!res.ok) { + const err = await res.json().catch(() => ({})); + alert("Failed to create schedule" + (err?.fields ? `: ${err.fields.join(", ")}` : "")); + return; + } + + const created: ScheduleItem = await res.json(); + // Keep list sorted by start_time ascending + setItems((prev) => [...prev, created].sort((a, b) => +new Date(a.start_time) - +new Date(b.start_time))); + // reset minimal fields + setForm((f) => ({ ...f, name: "", description: "", start_time: "", end_time: "", location: "", host: "", event_created_by: "", column: 1, event_type: "event", discord_auto_announce: false })); + }; + + return ( +
+

Schedule

+ +
+ setForm({ ...form, name: e.target.value })} /> + setForm({ ...form, location: e.target.value })} /> + setForm({ ...form, host: e.target.value })} /> +