Add header prop to control visibility of the header component
This commit is contained in:
@@ -33,6 +33,7 @@ interface RegionMapProps {
|
|||||||
focusSystem?: string;
|
focusSystem?: string;
|
||||||
isCompact?: boolean;
|
isCompact?: boolean;
|
||||||
isWormholeRegion?: boolean;
|
isWormholeRegion?: boolean;
|
||||||
|
header?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ContextMenuState {
|
interface ContextMenuState {
|
||||||
@@ -93,7 +94,7 @@ const ensureUniversePositions = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormholeRegion = false }: RegionMapProps) => {
|
export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormholeRegion = false, header = true }: RegionMapProps) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [viewBox, setViewBox] = useState({ x: 0, y: 0, width: 1200, height: 800 });
|
const [viewBox, setViewBox] = useState({ x: 0, y: 0, width: 1200, height: 800 });
|
||||||
const [isPanning, setIsPanning] = useState(false);
|
const [isPanning, setIsPanning] = useState(false);
|
||||||
@@ -119,10 +120,10 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
// Statistics state - MUST default to false to avoid API spam!
|
// Statistics state - MUST default to false to avoid API spam!
|
||||||
const [showJumps, setShowJumps] = useState(false);
|
const [showJumps, setShowJumps] = useState(false);
|
||||||
const [showKills, setShowKills] = useState(false);
|
const [showKills, setShowKills] = useState(false);
|
||||||
|
|
||||||
// System ID cache for statistics lookup
|
// System ID cache for statistics lookup
|
||||||
const [systemIDCache, setSystemIDCache] = useState<Map<string, number>>(new Map());
|
const [systemIDCache, setSystemIDCache] = useState<Map<string, number>>(new Map());
|
||||||
|
|
||||||
|
|
||||||
// New: selection/aim state for left-click aimbot behavior
|
// New: selection/aim state for left-click aimbot behavior
|
||||||
const [isSelecting, setIsSelecting] = useState(false);
|
const [isSelecting, setIsSelecting] = useState(false);
|
||||||
@@ -181,7 +182,7 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
}, [viaMode, viaDest, viaQueue]);
|
}, [viaMode, viaDest, viaQueue]);
|
||||||
|
|
||||||
const { data: rsystems, isLoading, error } = useRegionData(regionName);
|
const { data: rsystems, isLoading, error } = useRegionData(regionName);
|
||||||
|
|
||||||
// Fetch statistics data - only when toggles are enabled
|
// Fetch statistics data - only when toggles are enabled
|
||||||
const { data: jumpsData } = useSystemJumps(showJumps);
|
const { data: jumpsData } = useSystemJumps(showJumps);
|
||||||
const { data: killsData } = useSystemKills(showKills);
|
const { data: killsData } = useSystemKills(showKills);
|
||||||
@@ -189,7 +190,7 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoading && error == null && rsystems && rsystems.size > 0) {
|
if (!isLoading && error == null && rsystems && rsystems.size > 0) {
|
||||||
setSystems(rsystems);
|
setSystems(rsystems);
|
||||||
|
|
||||||
// Pre-resolve all system IDs for statistics lookup
|
// Pre-resolve all system IDs for statistics lookup
|
||||||
const resolveSystemIDs = async () => {
|
const resolveSystemIDs = async () => {
|
||||||
const newCache = new Map<string, number>();
|
const newCache = new Map<string, number>();
|
||||||
@@ -205,7 +206,7 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
}
|
}
|
||||||
setSystemIDCache(newCache);
|
setSystemIDCache(newCache);
|
||||||
};
|
};
|
||||||
|
|
||||||
resolveSystemIDs();
|
resolveSystemIDs();
|
||||||
}
|
}
|
||||||
}, [rsystems, isLoading, error]);
|
}, [rsystems, isLoading, error]);
|
||||||
@@ -558,26 +559,26 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
// Helper functions to get statistics for a system
|
// Helper functions to get statistics for a system
|
||||||
const getSystemJumps = (systemName: string): number | undefined => {
|
const getSystemJumps = (systemName: string): number | undefined => {
|
||||||
if (!showJumps) return undefined;
|
if (!showJumps) return undefined;
|
||||||
|
|
||||||
const systemID = systemIDCache.get(systemName);
|
const systemID = systemIDCache.get(systemName);
|
||||||
if (!systemID) return undefined;
|
if (!systemID) return undefined;
|
||||||
|
|
||||||
const jumps = jumpsBySystemID.get(systemID);
|
const jumps = jumpsBySystemID.get(systemID);
|
||||||
if (!jumps || jumps === 0) return undefined;
|
if (!jumps || jumps === 0) return undefined;
|
||||||
|
|
||||||
console.log(`🚀 Found ${jumps} jumps for ${systemName} (ID: ${systemID})`);
|
console.log(`🚀 Found ${jumps} jumps for ${systemName} (ID: ${systemID})`);
|
||||||
return jumps;
|
return jumps;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSystemKills = (systemName: string): number | undefined => {
|
const getSystemKills = (systemName: string): number | undefined => {
|
||||||
if (!showKills) return undefined;
|
if (!showKills) return undefined;
|
||||||
|
|
||||||
const systemID = systemIDCache.get(systemName);
|
const systemID = systemIDCache.get(systemName);
|
||||||
if (!systemID) return undefined;
|
if (!systemID) return undefined;
|
||||||
|
|
||||||
const kills = killsBySystemID.get(systemID);
|
const kills = killsBySystemID.get(systemID);
|
||||||
if (!kills || kills === 0) return undefined;
|
if (!kills || kills === 0) return undefined;
|
||||||
|
|
||||||
console.log(`⚔️ Found ${kills} kills for ${systemName} (ID: ${systemID})`);
|
console.log(`⚔️ Found ${kills} kills for ${systemName} (ID: ${systemID})`);
|
||||||
return kills;
|
return kills;
|
||||||
};
|
};
|
||||||
@@ -1021,13 +1022,15 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 relative">
|
<div className="w-full h-full bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 relative">
|
||||||
<Header
|
{header && (
|
||||||
title={`Region: ${regionName}`}
|
<Header
|
||||||
breadcrumbs={[
|
title={`Region: ${regionName}`}
|
||||||
{ label: "Universe", path: "/" },
|
breadcrumbs={[
|
||||||
{ label: regionName }
|
{ label: "Universe", path: "/" },
|
||||||
]}
|
{ label: regionName }
|
||||||
/>
|
]}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<svg
|
<svg
|
||||||
ref={svgRef}
|
ref={svgRef}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
@@ -281,6 +281,7 @@ export const SystemView = () => {
|
|||||||
regionName={region}
|
regionName={region}
|
||||||
focusSystem={system}
|
focusSystem={system}
|
||||||
isCompact={true}
|
isCompact={true}
|
||||||
|
header={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user