import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ShieldAlert, Zap, Siren, BatteryWarning, MoveVertical, } from 'lucide-react'; export type RobotFeature = | 'emergencyStop' | 'response' | 'obstacleAvoidance' | 'lowBatteryReturn' | 'tiltProtection'; export interface FeatureConfig { key: RobotFeature; icon: React.ReactNode; activeColor: string; inactiveColor: string; } const FEATURES: FeatureConfig[] = [ { key: 'emergencyStop', icon: , activeColor: '#ef4444', inactiveColor: '#94a3b8' }, { key: 'obstacleAvoidance', icon: , activeColor: '#3b82f6', inactiveColor: '#94a3b8' }, { key: 'lowBatteryReturn', icon: , activeColor: '#f59e0b', inactiveColor: '#94a3b8' }, { key: 'tiltProtection', icon: , activeColor: '#10b981', inactiveColor: '#94a3b8' }, ]; interface RobotFeatureButtonsProps { activeFeatures?: RobotFeature[]; onToggle?: (feature: RobotFeature, enabled: boolean) => void; className?: string; } const RobotFeatureButtons: React.FC = ({ activeFeatures = [], onToggle, className = '', }) => { const { t } = useTranslation(); const [active, setActive] = useState>(new Set(activeFeatures)); const handleClick = (feature: RobotFeature) => { const next = !active.has(feature); const nextSet = new Set(active); if (next) nextSet.add(feature); else nextSet.delete(feature); setActive(nextSet); onToggle?.(feature, next); }; return (
{FEATURES.map((f) => { const isActive = active.has(f.key); return ( ); })}
); }; export default RobotFeatureButtons;