import type React from 'react'; import { X, Plus } from 'lucide-react'; import { motion } from 'framer-motion'; import type { ButtonHTMLAttributes } from 'react'; import type { LucideIcon } from 'lucide-react'; import { cn } from '~/utils'; interface BadgeProps extends ButtonHTMLAttributes { icon?: LucideIcon; label: string; id?: string; isActive?: boolean; isEditing?: boolean; isDragging?: boolean; isAvailable: boolean; isInChat?: boolean; onBadgeAction?: () => void; onToggle?: () => void; } export default function Badge({ icon: Icon, label, id, isActive = false, isEditing = false, isDragging = false, isAvailable = true, isInChat = false, onBadgeAction, onToggle, className, ...props }: BadgeProps) { const isMoveable = isEditing && isAvailable; const isDisabled = id === '1' && isInChat; const handleClick: React.MouseEventHandler = (e) => { if (isDisabled) { e.preventDefault(); e.stopPropagation(); return; } if (!isEditing && onToggle) { e.preventDefault(); e.stopPropagation(); onToggle(); } }; return ( {Icon && } {label} {isEditing && !isDragging && ( e.stopPropagation()} onClick={(e) => { e.stopPropagation(); onBadgeAction?.(); }} > {isAvailable ? : } )} ); }