({ sensor, isActive, isEnabled, onToggle })
| 30 | isEnabled: boolean; |
| 31 | onToggle: (sensor: SensorPlaceholder, active: boolean) => void; |
| 32 | }> = ({ sensor, isActive, isEnabled, onToggle }) => { |
| 33 | const info = SENSOR_DESCRIPTIONS[sensor]; |
| 34 | const getIconComponent = (iconName: string) => { |
| 35 | switch (iconName) { |
| 36 | case 'Monitor': return Monitor; |
| 37 | case 'FileText': return FileText; |
| 38 | case 'Camera': return CameraIcon; |
| 39 | case 'Volume2': return Volume2; |
| 40 | case 'Mic': return Mic; |
| 41 | case 'Headphones': return Blend; |
| 42 | default: return Monitor; |
| 43 | } |
| 44 | }; |
| 45 | const IconComponent = getIconComponent(info.icon); |
| 46 | |
| 47 | return ( |
| 48 | <button |
| 49 | type="button" |
| 50 | onClick={() => onToggle(sensor, !isActive)} |
| 51 | disabled={!isEnabled} |
| 52 | className={`group inline-flex flex-col items-center gap-1 px-3 py-2 rounded-md text-sm font-medium transition-all cursor-pointer ${ |
| 53 | isActive |
| 54 | ? 'bg-blue-100 text-blue-800 hover:bg-blue-200' |
| 55 | : 'bg-gray-100 text-gray-700 hover:bg-gray-200' |
| 56 | } disabled:opacity-50 disabled:cursor-not-allowed`} |
| 57 | title={info.description} |
| 58 | > |
| 59 | <div className="flex items-center gap-1.5"> |
| 60 | <IconComponent className="w-4 h-4" /> |
| 61 | <span>{info.name}</span> |
| 62 | {isActive && <CheckCircle className="w-3.5 h-3.5" />} |
| 63 | </div> |
| 64 | <code className={`text-xs font-mono px-1.5 py-0.5 rounded ${ |
| 65 | isActive ? 'bg-blue-200 text-blue-900' : 'bg-gray-200 text-gray-600' |
| 66 | }`}> |
| 67 | {sensor} |
| 68 | </code> |
| 69 | </button> |
| 70 | ); |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | /** |
nothing calls this directly
no test coverage detected