From 74b1a337bc7cee8981e092a58b3db82ea913d632 Mon Sep 17 00:00:00 2001 From: aamoghS Date: Thu, 5 Feb 2026 07:53:27 -0500 Subject: [PATCH] ui resuability --- sites/mainweb/app/(portal)/admin/page.tsx | 237 ++---------------- sites/mainweb/app/(portal)/club/page.tsx | 161 ++---------- sites/mainweb/app/(portal)/dashboard/page.tsx | 7 +- sites/mainweb/app/(portal)/judge/page.tsx | 184 +++----------- .../components/portal/EventFormModal.tsx | 140 +++++++++++ .../components/portal/LoadingScreen.tsx | 15 ++ .../components/portal/ModalWrapper.tsx | 37 +++ .../mainweb/components/portal/ProgressBar.tsx | 19 ++ .../mainweb/components/portal/QRCodeModal.tsx | 122 +++++++++ .../components/portal/QRScannerModal.tsx | 96 +++++++ .../components/portal/ScanResultModal.tsx | 90 +++++++ .../components/portal/StatusScreen.tsx | 99 ++++++++ .../portal/dashboard/FeatureCard.tsx | 151 +++++++++++ .../components/portal/dashboard/Sidebar.tsx | 104 ++++++++ .../components/portal/judge/RubricSlider.tsx | 108 ++++++++ 15 files changed, 1071 insertions(+), 499 deletions(-) create mode 100644 sites/mainweb/components/portal/EventFormModal.tsx create mode 100644 sites/mainweb/components/portal/LoadingScreen.tsx create mode 100644 sites/mainweb/components/portal/ModalWrapper.tsx create mode 100644 sites/mainweb/components/portal/ProgressBar.tsx create mode 100644 sites/mainweb/components/portal/QRCodeModal.tsx create mode 100644 sites/mainweb/components/portal/QRScannerModal.tsx create mode 100644 sites/mainweb/components/portal/ScanResultModal.tsx create mode 100644 sites/mainweb/components/portal/StatusScreen.tsx create mode 100644 sites/mainweb/components/portal/dashboard/FeatureCard.tsx create mode 100644 sites/mainweb/components/portal/dashboard/Sidebar.tsx create mode 100644 sites/mainweb/components/portal/judge/RubricSlider.tsx diff --git a/sites/mainweb/app/(portal)/admin/page.tsx b/sites/mainweb/app/(portal)/admin/page.tsx index 62699d1..5e47bfd 100644 --- a/sites/mainweb/app/(portal)/admin/page.tsx +++ b/sites/mainweb/app/(portal)/admin/page.tsx @@ -1,6 +1,6 @@ 'use client'; -import { useSession, signOut } from 'next-auth/react'; +import { useSession } from 'next-auth/react'; import { trpc } from '@/lib/trpc'; import { useRouter } from 'next/navigation'; import { useEffect, useState } from 'react'; @@ -8,6 +8,8 @@ import Background from '@/components/portal/Background'; import QRCode from 'qrcode'; import Link from 'next/link'; import { LiquidGlass } from '@/components/portal/LiquidGlass'; +import { QRCodeModal } from '@/components/portal/QRCodeModal'; +import { EventFormModal } from '@/components/portal/EventFormModal'; type AdminView = 'events' | 'members' | 'admins'; @@ -34,14 +36,7 @@ export default function AdminPage() { const [qrCodeDataURL, setQrCodeDataURL] = useState(''); const [selectedEvent, setSelectedEvent] = useState(null); - // Event form state - const [eventForm, setEventForm] = useState({ - title: '', - description: '', - location: '', - eventDate: '', - maxCheckIns: '', - }); + // Queries const { data: adminStatus, isLoading: adminLoading } = trpc.admin.isAdmin.useQuery(undefined, { @@ -55,13 +50,6 @@ export default function AdminPage() { const createEventMutation = trpc.events.create.useMutation({ onSuccess: (newEvent) => { if (newEvent) { - setEventForm({ - title: '', - description: '', - location: '', - eventDate: '', - maxCheckIns: '', - }); setShowCreateEvent(false); generateQRCode(newEvent.qrCode); setSelectedEvent(newEvent as unknown as Event); @@ -69,6 +57,7 @@ export default function AdminPage() { }, }); + const toggleCheckInMutation = trpc.events.toggleCheckIn.useMutation({ onSuccess: () => { utils.events.listAll.invalidate(); @@ -104,10 +93,10 @@ export default function AdminPage() { try { const url = await QRCode.toDataURL(qrCode, { width: 400, - margin: 2, + margin: 3, color: { - dark: '#00A8A8', - light: '#0a0a0a', + dark: '#000000', + light: '#ffffff', }, }); setQrCodeDataURL(url); @@ -117,13 +106,13 @@ export default function AdminPage() { } }; - const handleCreateEvent = () => { + const handleCreateEvent = (formData: { title: string; description: string; location: string; eventDate: string }) => { createEventMutation.mutate({ - title: eventForm.title, - description: eventForm.description || undefined, - location: eventForm.location || undefined, - eventDate: new Date(eventForm.eventDate), - maxCheckIns: eventForm.maxCheckIns ? parseInt(eventForm.maxCheckIns) : undefined, + title: formData.title, + description: formData.description || undefined, + location: formData.location || undefined, + eventDate: new Date(formData.eventDate), + maxCheckIns: undefined, // Always unlimited }); }; @@ -150,195 +139,23 @@ export default function AdminPage() { {/* CREATE EVENT MODAL */} {showCreateEvent && ( -
-
setShowCreateEvent(false)} - /> -
-
-
-

- Create Event -

-

- Configure QR Protocols -

-
- -
- -
-
- - setEventForm({ ...eventForm, title: e.target.value })} - className="w-full bg-black/40 border border-white/10 rounded-xl px-6 py-4 text-white text-base focus:border-[#00A8A8] focus:outline-none transition-all font-mono" - placeholder="e.g., Weekly_Workshop_01" - /> -
- -
- -