Add region security and coloring
Add security field to region data and implement color-coding.
This commit is contained in:
@@ -4,30 +4,35 @@
|
|||||||
"regionName": "Derelik",
|
"regionName": "Derelik",
|
||||||
"x": "413",
|
"x": "413",
|
||||||
"y": "357",
|
"y": "357",
|
||||||
|
"security": 0.3,
|
||||||
"connectsTo": ["Devoid", "Domain"]
|
"connectsTo": ["Devoid", "Domain"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regionName": "Devoid",
|
"regionName": "Devoid",
|
||||||
"x": "200",
|
"x": "200",
|
||||||
"y": "250",
|
"y": "250",
|
||||||
|
"security": 0.7,
|
||||||
"connectsTo": ["Derelik", "Domain", "Genesis"]
|
"connectsTo": ["Derelik", "Domain", "Genesis"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regionName": "Domain",
|
"regionName": "Domain",
|
||||||
"x": "600",
|
"x": "600",
|
||||||
"y": "300",
|
"y": "300",
|
||||||
|
"security": 0.9,
|
||||||
"connectsTo": ["Devoid", "Derelik", "Kador"]
|
"connectsTo": ["Devoid", "Derelik", "Kador"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regionName": "Genesis",
|
"regionName": "Genesis",
|
||||||
"x": "350",
|
"x": "350",
|
||||||
"y": "500",
|
"y": "500",
|
||||||
|
"security": 0.4,
|
||||||
"connectsTo": ["Devoid", "Kador"]
|
"connectsTo": ["Devoid", "Kador"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"regionName": "Kador",
|
"regionName": "Kador",
|
||||||
"x": "500",
|
"x": "500",
|
||||||
"y": "180",
|
"y": "180",
|
||||||
|
"security": 0.6,
|
||||||
"connectsTo": ["Domain", "Genesis"]
|
"connectsTo": ["Domain", "Genesis"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface Region {
|
|||||||
regionName: string;
|
regionName: string;
|
||||||
x: string;
|
x: string;
|
||||||
y: string;
|
y: string;
|
||||||
|
security: number;
|
||||||
connectsTo: string[];
|
connectsTo: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +149,7 @@ export const GalaxyMap = () => {
|
|||||||
onMouseDown={() => handleMouseDown(region.regionName)}
|
onMouseDown={() => handleMouseDown(region.regionName)}
|
||||||
isDragging={draggedNode === region.regionName}
|
isDragging={draggedNode === region.regionName}
|
||||||
type="region"
|
type="region"
|
||||||
|
security={region.security}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { getSecurityColor } from '../utils/securityColors';
|
import { getSecurityColor } from '../utils/securityColors';
|
||||||
|
|
||||||
@@ -25,12 +24,10 @@ export const MapNode: React.FC<MapNodeProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const [isHovered, setIsHovered] = useState(false);
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
|
|
||||||
// Use security-based color for systems, default colors for regions
|
// Use security-based color for both systems and regions
|
||||||
const nodeColor = type === 'system' && security !== undefined
|
const nodeColor = security !== undefined
|
||||||
? getSecurityColor(security)
|
? getSecurityColor(security)
|
||||||
: type === 'region'
|
: '#a855f7'; // fallback purple color
|
||||||
? (isHovered ? '#8b5cf6' : '#a855f7')
|
|
||||||
: (isHovered ? '#06b6d4' : '#0891b2');
|
|
||||||
|
|
||||||
if (type === 'region') {
|
if (type === 'region') {
|
||||||
// Render region as a pill/rounded rectangle
|
// Render region as a pill/rounded rectangle
|
||||||
|
|||||||
Reference in New Issue
Block a user