

import { IconButton } from '@/ui/IconButton';
import { AlertTriangle } from 'lucide-react';

interface DriverDTO {
  id: string;
  name: string;
}

interface InlinePenaltyButtonProps {
  driver: DriverDTO;
  onPenaltyClick?: (driver: DriverDTO) => void;
  isAdmin: boolean;
}

export function InlinePenaltyButton({
  driver,
  onPenaltyClick,
  isAdmin,
}: InlinePenaltyButtonProps) {
  if (!isAdmin) return null;

  const handleButtonClick = () => {
    if (onPenaltyClick) {
      onPenaltyClick(driver);
    }
  };

  return (
    <IconButton
      variant="danger"
      icon={AlertTriangle}
      onClick={handleButtonClick}
      title={`Issue penalty to ${driver.name}`}
      size="sm"
    />
  );
}
