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

@ -7,6 +7,7 @@ import SessionDetails from "../../../../components/SessionDetails";
import TranscriptViewer from "../../../../components/TranscriptViewer";
import MessageViewer from "../../../../components/MessageViewer";
import { ChatSession } from "../../../../lib/types";
import { formatCategory } from "@/lib/format-enums";
import Link from "next/link";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
@ -181,10 +182,10 @@ export default function SessionViewPage() {
</div>
</div>
<div className="flex flex-wrap gap-2">
{session.category && session.category !== 'UNRECOGNIZED_OTHER' && session.category !== 'ACCESS_LOGIN' && (
{session.category && (
<Badge variant="secondary" className="gap-1">
<Activity className="h-3 w-3" />
{session.category.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, l => l.toUpperCase())}
{formatCategory(session.category)}
</Badge>
)}
{session.language && (