51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
|
|
import { Badge } from '@/components/ui/badge'
|
|||
|
|
import { cn } from '@/lib/utils'
|
|||
|
|
import type { TaskDto } from '@/types/models'
|
|||
|
|
|
|||
|
|
interface TaskStatusBadgeProps {
|
|||
|
|
status: TaskDto['status']
|
|||
|
|
className?: string
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export function TaskStatusBadge({ status, className }: TaskStatusBadgeProps) {
|
|||
|
|
const statusConfig = {
|
|||
|
|
available: {
|
|||
|
|
label: 'Доступна',
|
|||
|
|
variant: 'default' as const,
|
|||
|
|
className: 'bg-green-500 hover:bg-green-600 text-white border-transparent',
|
|||
|
|
},
|
|||
|
|
in_progress: {
|
|||
|
|
label: 'В процессе',
|
|||
|
|
variant: 'default' as const,
|
|||
|
|
className: 'bg-blue-500 hover:bg-blue-600 text-white border-transparent',
|
|||
|
|
},
|
|||
|
|
completed: {
|
|||
|
|
label: 'Завершена',
|
|||
|
|
variant: 'default' as const,
|
|||
|
|
className: 'bg-purple-500 hover:bg-purple-600 text-white border-transparent',
|
|||
|
|
},
|
|||
|
|
expired: {
|
|||
|
|
label: 'Истекла',
|
|||
|
|
variant: 'secondary' as const,
|
|||
|
|
className: 'bg-gray-500 hover:bg-gray-600 text-white border-transparent',
|
|||
|
|
},
|
|||
|
|
failed: {
|
|||
|
|
label: 'Провалена',
|
|||
|
|
variant: 'destructive' as const,
|
|||
|
|
className: 'bg-red-500 hover:bg-red-600 text-white border-transparent',
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const config = statusConfig[status]
|
|||
|
|
|
|||
|
|
return (
|
|||
|
|
<Badge
|
|||
|
|
variant={config.variant}
|
|||
|
|
className={cn(config.className, className)}
|
|||
|
|
>
|
|||
|
|
{config.label}
|
|||
|
|
</Badge>
|
|||
|
|
)
|
|||
|
|
}
|
|||
|
|
|