feat: implement comprehensive enum formatting system

- Create centralized enum formatting utility for database enums
- Transform raw enums to human-readable text (SALARY_COMPENSATION → Salary & Compensation)
- Apply formatting across sessions list, individual session pages, and charts
- Improve color contrast ratios for better WCAG compliance
- Add semantic list structure with proper article elements
- Enhance accessibility with proper ARIA labels and screen reader support
- Fix all instances where users saw ugly database enums in UI
This commit is contained in:
2025-06-28 06:01:00 +02:00
parent 9eb86b0502
commit 5a22b860c5
6 changed files with 169 additions and 87 deletions

View File

@ -4,6 +4,7 @@ import { useEffect, useState, useCallback, useRef } from "react";
import { signOut, useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
import { Company, MetricsResult, WordCloudWord } from "../../../lib/types";
import { formatEnumValue } from "@/lib/format-enums";
import MetricCard from "../../../components/ui/metric-card";
import ModernLineChart from "../../../components/charts/line-chart";
import ModernBarChart from "../../../components/charts/bar-chart";
@ -259,10 +260,13 @@ function DashboardContent() {
const getCategoriesData = () => {
if (!metrics?.categories) return [];
return Object.entries(metrics.categories).map(([name, value]) => ({
name: name.length > 15 ? name.substring(0, 15) + "..." : name,
value: value as number,
}));
return Object.entries(metrics.categories).map(([name, value]) => {
const formattedName = formatEnumValue(name) || name;
return {
name: formattedName.length > 15 ? formattedName.substring(0, 15) + "..." : formattedName,
value: value as number,
};
});
};
const getLanguagesData = () => {