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; } export const MapNode: React.FC = ({ id, name, position, onClick, type, security }) => { 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') { // Reduce region size to prevent overlap const pillWidth = Math.max(name.length * 8, 60); // Reduced from 12 to 8, min from 80 to 60 const pillHeight = 24; // Reduced from 32 to 24 return ( setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={(e) => { e.stopPropagation(); onClick(); }} > {/* Glow effect */} {/* Main pill */} {/* Text inside pill */} {name} ); } else { // Render system as a dot with external label const nodeSize = 6; const textOffset = 18; // Position text below the dot 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} ); } };