Refactor moderation data fetching

This commit is contained in:
gpt-engineer-app[bot]
2025-11-04 16:56:49 +00:00
parent f32b8bdfee
commit feee859a50
4 changed files with 110 additions and 117 deletions

View File

@@ -10,7 +10,8 @@ interface RichCompanyDisplayProps {
}
export function RichCompanyDisplay({ data, actionType, showAllFields = true }: RichCompanyDisplayProps) {
const getCompanyTypeColor = (type: string) => {
const getCompanyTypeColor = (type: string | undefined) => {
if (!type) return 'bg-gray-500';
switch (type.toLowerCase()) {
case 'manufacturer': return 'bg-blue-500';
case 'operator': return 'bg-green-500';
@@ -31,7 +32,7 @@ export function RichCompanyDisplay({ data, actionType, showAllFields = true }: R
<h3 className="text-xl font-bold text-foreground truncate">{data.name}</h3>
<div className="flex items-center gap-2 mt-1 flex-wrap">
<Badge className={`${getCompanyTypeColor(data.company_type)} text-white text-xs`}>
{data.company_type?.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
{(data.company_type || 'Unknown')?.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
</Badge>
{data.person_type && (
<Badge variant="outline" className="text-xs">