Fix: Implement connections and region styling
- Added "connectsTo" to JSON data for connections. - Updated region nodes to be rounded oblongs. - Updated the GalaxyMap and RegionMap to render connections.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import React, { useState, useRef, useCallback, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { MapNode } from './MapNode';
|
||||
import { Connection } from './Connection';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { ArrowLeft } from 'lucide-react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@@ -11,6 +12,7 @@ interface System {
|
||||
x: string;
|
||||
y: string;
|
||||
security: number;
|
||||
connectsTo: string[];
|
||||
}
|
||||
|
||||
interface Position {
|
||||
@@ -137,6 +139,23 @@ export const RegionMap: React.FC<RegionMapProps> = ({ regionName }) => {
|
||||
</filter>
|
||||
</defs>
|
||||
|
||||
{/* Render connections first (behind nodes) */}
|
||||
{systems?.map((system) =>
|
||||
system.connectsTo?.map((connectedSystem) => {
|
||||
const fromPos = nodePositions[system.solarSystemName];
|
||||
const toPos = nodePositions[connectedSystem];
|
||||
if (!fromPos || !toPos) return null;
|
||||
|
||||
return (
|
||||
<Connection
|
||||
key={`${system.solarSystemName}-${connectedSystem}`}
|
||||
from={fromPos}
|
||||
to={toPos}
|
||||
/>
|
||||
);
|
||||
})
|
||||
)}
|
||||
|
||||
{/* Render systems */}
|
||||
{systems?.map((system) => (
|
||||
<MapNode
|
||||
|
Reference in New Issue
Block a user