From f4db0b92dd5e05c9e108fd53ff99b93169008ffb Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 17 Nov 2025 13:20:49 +0530 Subject: [PATCH] feat(company-profile): Add null safety and update registration metrics display - Add null coalescing operators to total_events and total_hackathons to prevent undefined display - Replace total_participants with total_registrations for accurate metric tracking - Update label from "Participants" to "Registrations" for clarity - Add total_registrations field to Company interface type definition - Ensure all statistics display 0 as fallback when data is unavailable --- components/companies/CompanyProfile.tsx | 8 ++++---- types/company.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/companies/CompanyProfile.tsx b/components/companies/CompanyProfile.tsx index a45e0502..77bb653a 100644 --- a/components/companies/CompanyProfile.tsx +++ b/components/companies/CompanyProfile.tsx @@ -120,21 +120,21 @@ export function CompanyProfile({ company, isOwner = false, className }: CompanyP

- {company.total_events} + {company.total_events || 0}

Events Hosted

- {company.total_hackathons} + {company.total_hackathons || 0}

Hackathons

- {company.total_participants} + {company.total_registrations || 0}

-

Participants

+

Registrations

diff --git a/types/company.ts b/types/company.ts index 4ddaea5b..8e6f6665 100644 --- a/types/company.ts +++ b/types/company.ts @@ -42,6 +42,7 @@ export interface Company { total_events: number total_hackathons: number total_participants: number + total_registrations: number } export interface CompanyAddress {