import React, { useState } from 'react'; import { getSecurityColor } from '../utils/securityColors'; interface MapNodeProps { id: string; name: string; position: { x: number; y: number }; onClick: () => void; type: 'region' | 'system'; security?: number; signatures?: number; } export const MapNode: React.FC = ({ id, name, position, onClick, type, security, signatures }) => { const [isHovered, setIsHovered] = useState(false); // Use security-based color for both systems and regions const nodeColor = security !== undefined ? getSecurityColor(security) : '#a855f7'; // fallback purple color if (type === 'region') { // Further reduce region size to prevent overlap - made even smaller const pillWidth = Math.max(name.length * 5, 40); // Reduced from 8 to 5, min from 60 to 40 const pillHeight = 18; // Reduced from 24 to 18 return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={(e) => { e.stopPropagation(); onClick(); }} > {/* Glow effect */} {/* Main pill */} {/* Text inside pill - made smaller */} {name} ); } else { // Render system as a dot with external label const nodeSize = 6; const textOffset = 20; // Position text below the dot - moved down more return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={(e) => { e.stopPropagation(); onClick(); }} > {/* Node glow effect */} {/* Main node - removed stroke to eliminate white border */} {/* Inner core */} {/* Node label */} {name} {security !== undefined && ( {security.toFixed(1)} )} {signatures !== undefined && `📡 ${signatures}`} ); } };