From e37f3a58740e502664041611db373075384a5f39 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 28 Apr 2026 16:28:30 +0200 Subject: [PATCH] fix: render enum labels as proper title case formatEnumLabel was leaving inputs uppercase ("TECHNOLOGY_INNOVATION" became "TECHNOLOGY INNOVATION"); lowercasing first yields proper title case ("Technology Innovation") and improves labels app-wide. Apply it on the project mentor page for Ocean Issue + Category. --- src/app/(admin)/admin/projects/[id]/mentor/page.tsx | 10 +++++++--- src/lib/utils.ts | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/(admin)/admin/projects/[id]/mentor/page.tsx b/src/app/(admin)/admin/projects/[id]/mentor/page.tsx index fa0aa66..5a0b715 100644 --- a/src/app/(admin)/admin/projects/[id]/mentor/page.tsx +++ b/src/app/(admin)/admin/projects/[id]/mentor/page.tsx @@ -37,7 +37,7 @@ import { Sparkles, Users, } from 'lucide-react' -import { getInitials } from '@/lib/utils' +import { getInitials, formatEnumLabel } from '@/lib/utils' interface PageProps { params: Promise<{ id: string }> @@ -164,11 +164,15 @@ function MentorAssignmentContent({ projectId }: { projectId: string }) {
Ocean Issue
-
{project.oceanIssue ?? '—'}
+
+ {project.oceanIssue ? formatEnumLabel(project.oceanIssue) : '—'} +
Category
-
{project.competitionCategory ?? '—'}
+
+ {project.competitionCategory ? formatEnumLabel(project.competitionCategory) : '—'} +
Country
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index b0ed9a3..611d893 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -50,6 +50,7 @@ export function formatFileSize(bytes: number): string { export function formatEnumLabel(value: string): string { return value + .toLowerCase() .replace(/_/g, ' ') .replace(/\b\w/g, (c) => c.toUpperCase()) }