- Updated import paths for various components to align with new directory structure. - Changed imports from 'row-actions', 'confirm-dialog', 'image-preview-button', and 'file-upload' to their respective new locations in 'data-display', 'dialogs', and 'inputs'. - Adjusted imports in multiple pages including purchase, restock, transaction, category, customer, product, raw-material, supplier, roles, and settings. - Ensured all relevant components are imported from their new locations to maintain functionality.
28 lines
586 B
TypeScript
28 lines
586 B
TypeScript
import { Badge } from '@/components/ui/badge';
|
|
|
|
type StatusBadgeConfig = Record<string, { label: string; className: string }>;
|
|
|
|
type StatusBadgeProps = {
|
|
status: string;
|
|
config: StatusBadgeConfig;
|
|
fallbackKey?: string;
|
|
};
|
|
|
|
export function StatusBadge({
|
|
status,
|
|
config,
|
|
fallbackKey = 'pending',
|
|
}: StatusBadgeProps) {
|
|
const resolved = config[status] ?? config[fallbackKey];
|
|
|
|
if (!resolved) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Badge variant="secondary" className={resolved.className}>
|
|
{resolved.label}
|
|
</Badge>
|
|
);
|
|
}
|