From 23a86194e56c83c5dd3122b8207eb274427b6dc9 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 19 Nov 2025 16:24:12 +0530 Subject: [PATCH] refactor: Standardize upcoming event/hackathon registration data and update `UpcomingHackathonItem` to a div, removing unused `companySlug` prop. --- components/dashboard/CompanyDashboard.tsx | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/components/dashboard/CompanyDashboard.tsx b/components/dashboard/CompanyDashboard.tsx index 6f2fc51b..cb07cb6b 100644 --- a/components/dashboard/CompanyDashboard.tsx +++ b/components/dashboard/CompanyDashboard.tsx @@ -160,7 +160,11 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) { return eventDate > new Date() && e.approval_status === 'approved' }) .sort((a: any, b: any) => new Date(a.date).getTime() - new Date(b.date).getTime()) - .slice(0, 5) || [] + .slice(0, 5) + .map((e: any) => ({ + ...e, + registrations: e.registered || 0, // Map 'registered' to 'registrations' + })) || [] const upcomingHackathonsData = hackathonsData.hackathons ?.filter((h: any) => { @@ -168,7 +172,11 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) { return hackathonDate > new Date() && h.approval_status === 'approved' }) .sort((a: any, b: any) => new Date(a.date).getTime() - new Date(b.date).getTime()) - .slice(0, 5) || [] + .slice(0, 5) + .map((h: any) => ({ + ...h, + registrations: h.registered || 0, // Map 'registered' to 'registrations' + })) || [] console.log('Upcoming hackathons data:', upcomingHackathonsData) @@ -595,7 +603,6 @@ export function CompanyDashboard({ company }: CompanyDashboardProps) { ))} @@ -673,9 +680,8 @@ function StatsCard({ return ( {title} @@ -687,9 +693,8 @@ function StatsCard({

{description}

{change !== undefined && change !== 0 && (
{isPositive && } {isNegative && } @@ -767,21 +772,19 @@ function UpcomingEventItem({ event }: UpcomingEventItemProps) { // Upcoming Hackathon Item Component interface UpcomingHackathonItemProps { hackathon: UpcomingHackathon - companySlug: string } -function UpcomingHackathonItem({ hackathon, companySlug }: UpcomingHackathonItemProps) { +function UpcomingHackathonItem({ hackathon }: UpcomingHackathonItemProps) { return ( -
-
+
-

+

{hackathon.title}

@@ -792,12 +795,12 @@ function UpcomingHackathonItem({ hackathon, companySlug }: UpcomingHackathonItem {hackathon.mode || 'Online'} - {hackathon.registrations || 0} teams registered + {hackathon.registrations || 0} participants

- +
) }