diff --git a/app/admin/login/page.tsx b/app/admin/login/page.tsx index 310a3de..b026bd6 100644 --- a/app/admin/login/page.tsx +++ b/app/admin/login/page.tsx @@ -1,65 +1,59 @@ "use client"; import { useState } from "react"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; export default function AdminLoginPage() { - const [email, setEmail] = useState(""); - const [password, setPassword] = useState(""); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - console.log({ email, password }); - }; + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log({ email, password }); + }; - return ( -
-
-
-

Admin Login

-

- Sign in to access the admin dashboard -

-
+ return ( +
+
+
+

Admin Login

+

+ Sign in to access the admin dashboard +

+
-
-
- - setEmail(e.target.value)} - placeholder="admin@example.com" - required - className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring" - /> -
+ +
+ + setEmail(e.target.value)} + placeholder="admin@example.com" + required + /> +
-
- - setPassword(e.target.value)} - placeholder="••••••••" - required - className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring" - /> -
+
+ + setPassword(e.target.value)} + placeholder="••••••••" + required + /> +
- -
-
-
- ); + + +
+
+ ); } diff --git a/app/api/admin/events/[id]/route.ts b/app/api/admin/events/[id]/route.ts index dbafaf4..57814b4 100644 --- a/app/api/admin/events/[id]/route.ts +++ b/app/api/admin/events/[id]/route.ts @@ -2,18 +2,22 @@ import { NextResponse } from "next/server"; import { prisma } from "@/lib/prisma"; -export async function GET(_: Request, { params }: { params: { id: string } }) { +type RouteContext = { params: Promise<{ id: string }> }; + +export async function GET(_: Request, { params }: RouteContext) { + const { id } = await params; // TODO: require admin - const event = await prisma.event.findUnique({ where: { id: params.id } }); + const event = await prisma.event.findUnique({ where: { id } }); if (!event) return NextResponse.json({ error: "Not found" }, { status: 404 }); return NextResponse.json(event); } -export async function PATCH(req: Request, { params }: { params: { id: string } }) { +export async function PATCH(req: Request, { params }: RouteContext) { + const { id } = await params; // TODO: require admin const body = await req.json(); - const data: Record = {}; + const data: Record = {}; if (body.title !== undefined) data.title = body.title; if (body.description !== undefined) data.description = body.description ?? null; if (body.startAt !== undefined) data.startAt = new Date(body.startAt); @@ -21,13 +25,13 @@ export async function PATCH(req: Request, { params }: { params: { id: string } } if (body.location !== undefined) data.location = body.location ?? null; if (body.link !== undefined) data.link = body.link ?? null; - if (data.startAt && data.endAt && data.endAt < data.startAt) { + if (data.startAt && data.endAt && (data.endAt as Date) < (data.startAt as Date)) { return NextResponse.json({ error: "endAt cannot be before startAt" }, { status: 400 }); } try { const updated = await prisma.event.update({ - where: { id: params.id }, + where: { id }, data, }); return NextResponse.json(updated); @@ -36,12 +40,13 @@ export async function PATCH(req: Request, { params }: { params: { id: string } } } } -export async function DELETE(_: Request, { params }: { params: { id: string } }) { +export async function DELETE(_: Request, { params }: RouteContext) { + const { id } = await params; // TODO: require admin try { - await prisma.event.delete({ where: { id: params.id } }); + await prisma.event.delete({ where: { id } }); return NextResponse.json({ ok: true }); } catch { return NextResponse.json({ error: "Not found" }, { status: 404 }); } -} \ No newline at end of file +} diff --git a/app/api/applications/startup/route.ts b/app/api/applications/startup/route.ts index a549296..aa3379e 100644 --- a/app/api/applications/startup/route.ts +++ b/app/api/applications/startup/route.ts @@ -1,9 +1,7 @@ export const runtime = "nodejs"; import { NextResponse } from "next/server"; -import { PrismaClient } from "@/generated/prisma/client"; - -const prisma = new PrismaClient(); +import { prisma } from "@/lib/prisma"; export async function POST(request: Request) { console.log("DATABASE_URL:", process.env.DATABASE_URL); diff --git a/app/apply/page.tsx b/app/apply/page.tsx index 1ac0232..725f9cf 100644 --- a/app/apply/page.tsx +++ b/app/apply/page.tsx @@ -1,30 +1,45 @@ -import Link from "next/link"; -import PublicLayout from "@/components/layout/PublicLayout"; +import { useState } from "react"; -export default function ApplyPage() { +const cards = [ + { id: "startup", label: "STARTUP\nAPPLICATION", href: "/apply/startup" }, + { id: "org", label: "ORG/COMPANY\nPROJECT FORM", href: "/apply/org" }, + { id: "student", label: "STUDENT/PRODUCT\nTEAM SKILLS FORM [Mock for now]", href: "#" }, +]; + +export default function StrategicLeadersPage() { return ( - -
-

Apply

-

- Choose the application you want to start. +

+ +
+
+ +
+

+ Apply to Join a Private
+ + Network of Strategic Leaders + + +

+

+ Learn from our executive strategy playbook
+ and get access to our network of strategic leaders.

+
-
-

Application Types

-
- - Startup Application - - - Org Application - - - Team Application - -
-
+
+ {cards.map((card) => ( + + + {card.label} + + + ))}
- +
); } \ No newline at end of file diff --git a/app/apply/startup/page.tsx b/app/apply/startup/page.tsx index 9d646fa..b46234b 100644 --- a/app/apply/startup/page.tsx +++ b/app/apply/startup/page.tsx @@ -2,6 +2,10 @@ import { useState } from "react"; import PublicLayout from "@/components/layout/PublicLayout"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; type StartupFormState = { name: string; @@ -17,14 +21,45 @@ export default function StartupApplyPage() { fundingGoal: "", contact: "", }); + const [loading, setLoading] = useState(false); + const [status, setStatus] = useState<"idle" | "success" | "error">("idle"); function updateField(key: K, value: StartupFormState[K]) { setForm((prev) => ({ ...prev, [key]: value })); } - function handleSubmit(e: React.FormEvent) { + async function handleSubmit(e: React.FormEvent) { e.preventDefault(); - console.log("Startup application form:", form); + setLoading(true); + setStatus("idle"); + + try { + const res = await fetch("/api/applications/startup", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + StartupName : form.name, + StartupDescription : form.description, + StartupFundingGoal : form.fundingGoal, + StartupContact : form.contact, + }), + }); + if (!res.ok) { + throw new Error("Failed to submit application"); + } + setStatus("success"); + setForm({ + name: "", + description: "", + fundingGoal: "", + contact: "", + }); + } catch (err) { + console.error(err); + setStatus("error"); + } finally { + setLoading(false); + } } return ( @@ -32,79 +67,71 @@ export default function StartupApplyPage() {

Startup Application

- UI only for now — submitting will log your inputs to the console. + Tell us more about your startup!

-
- - updateField("name", e.target.value)} - className="w-full rounded-md border px-3 py-2" - placeholder="e.g., Startup Labs" - required - /> -
+
+ +