Skip to content

Commit f4db0b9

Browse files
committed
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
1 parent 85cd491 commit f4db0b9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

components/companies/CompanyProfile.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ export function CompanyProfile({ company, isOwner = false, className }: CompanyP
120120
<div className="grid grid-cols-3 gap-4 text-center">
121121
<div className="space-y-1">
122122
<p className="text-2xl font-bold text-primary">
123-
{company.total_events}
123+
{company.total_events || 0}
124124
</p>
125125
<p className="text-xs text-muted-foreground">Events Hosted</p>
126126
</div>
127127
<div className="space-y-1">
128128
<p className="text-2xl font-bold text-primary">
129-
{company.total_hackathons}
129+
{company.total_hackathons || 0}
130130
</p>
131131
<p className="text-xs text-muted-foreground">Hackathons</p>
132132
</div>
133133
<div className="space-y-1">
134134
<p className="text-2xl font-bold text-primary">
135-
{company.total_participants}
135+
{company.total_registrations || 0}
136136
</p>
137-
<p className="text-xs text-muted-foreground">Participants</p>
137+
<p className="text-xs text-muted-foreground">Registrations</p>
138138
</div>
139139
</div>
140140
</CardContent>

types/company.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface Company {
4242
total_events: number
4343
total_hackathons: number
4444
total_participants: number
45+
total_registrations: number
4546
}
4647

4748
export interface CompanyAddress {

0 commit comments

Comments
 (0)