From 4fb8c86b9344467a57c815f9988235b65bec64e2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 19 Nov 2025 11:56:49 +0530 Subject: [PATCH] feat(hackathons): Add total views and registrations statistics to hackathons dashboard - Add totalViews and totalRegistrations calculations to stats object - Add new stats cards displaying total views and registrations with icons - Update stats grid layout from 4 columns to 3 lg:6 columns for better spacing - Add pointer-events-none class to all approval and status badges for consistency - Make registration count clickable link to registrations page when count > 0 - Display registration count as gray text when zero to indicate no registrations - Improve visual hierarchy and accessibility of hackathon dashboard metrics --- .../company/[slug]/hackathons/page.tsx | 65 ++++++++++++++----- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/app/dashboard/company/[slug]/hackathons/page.tsx b/app/dashboard/company/[slug]/hackathons/page.tsx index 6b029595..1b985cc0 100644 --- a/app/dashboard/company/[slug]/hackathons/page.tsx +++ b/app/dashboard/company/[slug]/hackathons/page.tsx @@ -130,40 +130,42 @@ export default function CompanyHackathonsPage() { approved: hackathons.filter(h => h.approval_status === 'approved').length, pending: hackathons.filter(h => h.approval_status === 'pending').length, draft: hackathons.filter(h => h.status === 'draft').length, + totalViews: hackathons.reduce((sum, h) => sum + (h.views || 0), 0), + totalRegistrations: hackathons.reduce((sum, h) => sum + (h.registered || 0), 0), } const getApprovalBadge = (status: string) => { switch (status) { case 'approved': return ( - + Approved ) case 'pending': return ( - + Pending ) case 'rejected': return ( - + Rejected ) case 'changes_requested': return ( - + Changes Requested ) default: - return {status} + return {status} } } @@ -172,15 +174,15 @@ export default function CompanyHackathonsPage() { if (hackathon.approval_status !== 'approved') { switch (hackathon.approval_status) { case 'pending': - return Pending Review + return Pending Review case 'draft': - return Draft + return Draft case 'rejected': - return Rejected + return Rejected case 'changes_requested': - return Changes Requested + return Changes Requested default: - return {hackathon.approval_status} + return {hackathon.approval_status} } } @@ -188,15 +190,15 @@ export default function CompanyHackathonsPage() { switch (hackathon.status) { case 'live': case 'published': - return Live + return Live case 'draft': - return Draft + return Draft case 'cancelled': - return Cancelled + return Cancelled case 'completed': - return Completed + return Completed default: - return {hackathon.status} + return {hackathon.status} } } @@ -229,7 +231,7 @@ export default function CompanyHackathonsPage() { {/* Stats Cards */} -
+
Total Hackathons @@ -266,6 +268,24 @@ export default function CompanyHackathonsPage() {
{stats.draft}
+ + + Total Views + + + +
{stats.totalViews}
+
+
+ + + Total Registrations + + + +
{stats.totalRegistrations}
+
+
{/* Search */} @@ -346,7 +366,18 @@ export default function CompanyHackathonsPage() { {hackathon.views || 0}
- {hackathon.registered || 0} + + {hackathon.registered && hackathon.registered > 0 ? ( + + {hackathon.registered} + + ) : ( + 0 + )} + {canManageEvents ? (