mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 05:30:41 +01:00
- Added DOCUMENT_STATUS constant to lib/constants.ts - Added DocumentStatusType derived from constant - Added DOCUMENT_STATUS_CONFIG for display (labels, colors) - Created DocumentStatusBadge shared component - Updated types/document.ts to use DocumentStatusType - Updated app/documents/page.tsx to use shared component and constants Changes to add a new status now require only 1 file (lib/constants.ts). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 lines
660 B
TypeScript
28 lines
660 B
TypeScript
/**
|
|
* Document Status Badge Component
|
|
*
|
|
* SSOT for document status badge rendering.
|
|
* Uses centralized status config from lib/constants.ts
|
|
*/
|
|
|
|
import { DOCUMENT_STATUS_CONFIG, type DocumentStatusType } from '@/lib/constants';
|
|
|
|
interface DocumentStatusBadgeProps {
|
|
status: DocumentStatusType;
|
|
className?: string;
|
|
}
|
|
|
|
export function DocumentStatusBadge({ status, className = '' }: DocumentStatusBadgeProps) {
|
|
const config = DOCUMENT_STATUS_CONFIG[status];
|
|
|
|
if (!config) return null;
|
|
|
|
return (
|
|
<span
|
|
className={`px-2 py-1 text-xs ${config.bgColor} ${config.color} rounded-full ${className}`}
|
|
>
|
|
{config.label}
|
|
</span>
|
|
);
|
|
}
|