From 1d3af289e586a8084f65559806e0cc4180fc1c21 Mon Sep 17 00:00:00 2001 From: aamoghS Date: Wed, 29 Apr 2026 14:33:09 -0400 Subject: [PATCH 01/11] ok --- .../app/(portal)/admin/analytics/page.tsx | 154 +++++++++++++ .../app/(portal)/admin/attendees/page.tsx | 205 ++++++++++++++++++ .../app/(portal)/admin/hackathons/page.tsx | 35 ++- sites/mainweb/app/(portal)/admin/page.tsx | 25 ++- .../app/(portal)/admin/projects/page.tsx | 199 +++++++++++++++++ .../components/admin/events/EventHeader.tsx | 6 +- .../mainweb/components/portal/AdminHeader.tsx | 105 +++++++++ .../mainweb/components/portal/AdminLayout.tsx | 15 +- .../components/portal/AdminSidebar.tsx | 140 ++++++++++++ .../mainweb/components/portal/Background.tsx | 27 --- sites/mainweb/components/portal/Spinner.tsx | 21 -- 11 files changed, 847 insertions(+), 85 deletions(-) create mode 100644 sites/mainweb/app/(portal)/admin/analytics/page.tsx create mode 100644 sites/mainweb/app/(portal)/admin/attendees/page.tsx create mode 100644 sites/mainweb/app/(portal)/admin/projects/page.tsx create mode 100644 sites/mainweb/components/portal/AdminHeader.tsx create mode 100644 sites/mainweb/components/portal/AdminSidebar.tsx delete mode 100644 sites/mainweb/components/portal/Background.tsx delete mode 100644 sites/mainweb/components/portal/Spinner.tsx diff --git a/sites/mainweb/app/(portal)/admin/analytics/page.tsx b/sites/mainweb/app/(portal)/admin/analytics/page.tsx new file mode 100644 index 00000000..8ba37b83 --- /dev/null +++ b/sites/mainweb/app/(portal)/admin/analytics/page.tsx @@ -0,0 +1,154 @@ +'use client'; + +import { useSession } from 'next-auth/react'; +import { trpc } from '@/lib/trpc'; +import { useRouter } from 'next/navigation'; +import AdminLayout from '@/components/portal/AdminLayout'; +import { LiquidGlass } from '@/components/portal/LiquidGlass'; +import { Users, Trophy, Calendar, Clock, TrendingUp, Activity } from 'lucide-react'; + +export default function AnalyticsPage() { + const { data: session, status } = useSession(); + const router = useRouter(); + + const { data: stats, isLoading } = trpc.analytics.overview.useQuery(undefined, { enabled: !!session }); + + if (status === 'unauthenticated') { + router.push('/login'); + return null; + } + + const StatCard = ({ icon: Icon, title, value, subtitle, trend }: any) => ( + +
+
+ +
+
+

{title}

+

{value}

+ {subtitle && ( +
+ {subtitle} + {trend?.positive && ( + + + {trend.percent}% + + )} + {trend?.negative && ( + + + {trend.percent}% + + )} +
+ )} +
+
+
+ ); + + return ( + +
+ {/* Page Header */} +
+

+ Analytics Dashboard +

+

+ View comprehensive statistics across all events, hackathons, and user engagement. +

+
+ + {/* Stats Grid */} +
+ {isLoading ? ( + [1, 2, 3, 4].map((i) => ( + +
+
+
+
+
+ + )) + ) : ( + <> + + + + + + )} +
+ + {/* Charts Section */} +
+ {/* Registration Trend */} + +

Registration Trend

+
+

Chart visualization for registration trends

+
+
+ + {/* Event Types */} + +

Event Distribution

+
+

Pie chart for event type breakdown

+
+
+
+ + {/* Recent Activity */} + +

Recent Activity

+
+ {isLoading ? ( + [1, 2, 3].map((i) => ( +
+
+
+
+
+
+
+ )) + ) : ( +
+ No recent activity to display +
+ )} +
+ +
+ + ); +} diff --git a/sites/mainweb/app/(portal)/admin/attendees/page.tsx b/sites/mainweb/app/(portal)/admin/attendees/page.tsx new file mode 100644 index 00000000..c5eba970 --- /dev/null +++ b/sites/mainweb/app/(portal)/admin/attendees/page.tsx @@ -0,0 +1,205 @@ +'use client'; + +import { useSession } from 'next-auth/react'; +import { trpc } from '@/lib/trpc'; +import { useRouter } from 'next/navigation'; +import { useState } from 'react'; +import AdminLayout from '@/components/portal/AdminLayout'; +import { LiquidGlass } from '@/components/portal/LiquidGlass'; +import { Download } from 'lucide-react'; + +export default function AttendeesPage() { + const { data: session, status } = useSession(); + const router = useRouter(); + const utils = trpc.useUtils(); + + const [filter, setFilter] = useState<'all' | 'registered' | 'pending' | 'cancelled'>('all'); + + const { data: attendees, isLoading } = trpc.hackathon.adminGetAttendees.useQuery( + undefined, + { enabled: !!session } + ); + + const [selectedHackathon, setSelectedHackathon] = useState(null); + + if (status === 'unauthenticated') { + router.push('/login'); + return null; + } + + const handleDownloadCSV = () => { + if (selectedHackathon) { + // CSV export logic would go here + console.log('Downloading CSV for hackathon:', selectedHackathon); + } + }; + + return ( + +
+ {/* Page Header */} +
+

+ Attendees Registry +

+

+ View and manage attendee registrations for hackathon events. +

+
+ +
+ {/* Hackathon Selector */} +
+
+ +
+ {selectedHackathon && ( + + )} +
+ + {/* Filters */} +
+ + + + +
+ + {/* Attendees List */} +
+ {isLoading ? ( +
+

Loading...

+
+ ) : !attendees || attendees.length === 0 ? ( + +
+ + + +
+

No attendees yet

+

Select a hackathon to view registrations.

+
+ ) : ( +
+ + + + + + + + + + + + {attendees + .filter((a) => { + if (filter === 'all') return true; + if (filter === 'registered') return a.status === 'registered'; + if (filter === 'pending') return a.status === 'pending'; + if (filter === 'cancelled') return a.status === 'cancelled'; + return true; + }) + .map((attendee) => ( + + + + + + + + ))} + +
NameEmailTeamStatusDate
+
+ {attendee.name} +
+

{attendee.name}

+

{attendee.user?.email}

+
+
+
{attendee.email}{attendee.team || 'Individual'} + + {attendee.status} + + + {new Date(attendee.registrationDate).toLocaleDateString()} +
+
+ )} +
+
+
+
+ ); +} diff --git a/sites/mainweb/app/(portal)/admin/hackathons/page.tsx b/sites/mainweb/app/(portal)/admin/hackathons/page.tsx index 871b648d..6f53a53a 100644 --- a/sites/mainweb/app/(portal)/admin/hackathons/page.tsx +++ b/sites/mainweb/app/(portal)/admin/hackathons/page.tsx @@ -31,17 +31,16 @@ export default function AdminHackathonsPage() { return ( -
-
-
-

- Hackathon Manager -

-

- Manage your hackathon events -

-
-
diff --git a/sites/mainweb/app/(portal)/admin/page.tsx b/sites/mainweb/app/(portal)/admin/page.tsx index c442d24a..2203b877 100644 --- a/sites/mainweb/app/(portal)/admin/page.tsx +++ b/sites/mainweb/app/(portal)/admin/page.tsx @@ -133,18 +133,25 @@ export default function AdminPage() { /> )} -
- +
+
+

+ Check-in Events +

+

+ Manage your event check-in locations, QR codes, and attendance tracking. +

+
{/* View Controls */}
-
+