From c467cad78dbdfeb50dcef801b8e37dd2022a3e07 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 17 Nov 2025 16:30:54 +0530 Subject: [PATCH] feat(company-dashboard): Add hackathon support and improve status display - Add Trophy icon import for hackathon representation - Implement strict typing for approval_status with union type ('draft' | 'pending' | 'approved' | 'rejected' | 'changes_requested') - Refactor getStatusBadge function to accept full hackathon object and display approval status when not approved - Update status badge logic to show event status only for approved hackathons, approval status otherwise - Add Total Hackathons stats card to dashboard with orange Trophy icon - Expand quick actions grid from 3 to 4 columns on large screens to accommodate new Create Hackathon button - Add Create Hackathon quick action button alongside Create Event for event managers - Replace generic Plus icon with Calendar icon for Create Event button for better visual distinction --- .../company/[slug]/hackathons/page.tsx | 27 +++++++++++++--- components/dashboard/CompanyDashboard.tsx | 32 ++++++++++++++----- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/app/dashboard/company/[slug]/hackathons/page.tsx b/app/dashboard/company/[slug]/hackathons/page.tsx index d4016773..6b029595 100644 --- a/app/dashboard/company/[slug]/hackathons/page.tsx +++ b/app/dashboard/company/[slug]/hackathons/page.tsx @@ -29,7 +29,7 @@ interface Hackathon { excerpt: string category: string status: string - approval_status: string + approval_status: 'draft' | 'pending' | 'approved' | 'rejected' | 'changes_requested' date: string time: string duration: string @@ -167,8 +167,25 @@ export default function CompanyHackathonsPage() { } } - const getStatusBadge = (status: string) => { - switch (status) { + const getStatusBadge = (hackathon: Hackathon) => { + // If not approved, show approval status instead of event status + if (hackathon.approval_status !== 'approved') { + switch (hackathon.approval_status) { + case 'pending': + return Pending Review + case 'draft': + return Draft + case 'rejected': + return Rejected + case 'changes_requested': + return Changes Requested + default: + return {hackathon.approval_status} + } + } + + // If approved, show event status + switch (hackathon.status) { case 'live': case 'published': return Live @@ -179,7 +196,7 @@ export default function CompanyHackathonsPage() { case 'completed': return Completed default: - return {status} + return {hackathon.status} } } @@ -321,7 +338,7 @@ export default function CompanyHackathonsPage() { {hackathon.category || 'General'} - {getStatusBadge(hackathon.status)} + {getStatusBadge(hackathon)} {getApprovalBadge(hackathon.approval_status)}
diff --git a/components/dashboard/CompanyDashboard.tsx b/components/dashboard/CompanyDashboard.tsx index a7d03833..262c2a37 100644 --- a/components/dashboard/CompanyDashboard.tsx +++ b/components/dashboard/CompanyDashboard.tsx @@ -19,6 +19,7 @@ import { ArrowDownRight, Activity, FileText, + Trophy, } from 'lucide-react' import { Company } from '@/types/company' import { format, formatDistanceToNow } from 'date-fns' @@ -229,7 +230,7 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) { return (
{/* Stats Cards */} -
+
+ Common tasks and shortcuts -
+
{canManageEvents && ( - + <> + + + )} {canManageTeam && (