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:
gpt-engineer-app[bot]
2025-06-13 23:48:04 +00:00
parent 0264ac2f00
commit 81bfc9f45a
9 changed files with 216 additions and 87 deletions

View File

@@ -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