feat(frontend): implement via mode for setting destinations and add MapNode disableNavigate prop

This commit is contained in:
2025-08-09 19:51:53 +02:00
parent e7a8014a50
commit cd1cc6dc5f
3 changed files with 55 additions and 21 deletions

View File

@@ -8,7 +8,7 @@ interface SystemContextMenuProps {
onRename: (newName: string) => void;
onDelete: (system: System) => void;
onClearConnections: (system: System) => void;
onSetDestination: (systemName: string, viaMode: boolean) => void;
onSetDestination?: (systemName: string, viaMode: boolean) => void;
onClose: () => void;
}
@@ -28,6 +28,16 @@ export const SystemContextMenu = ({ x, y, system, onRename, onDelete, onClearCon
setIsRenaming(false);
};
const handleSetDestinationClick = (e: React.MouseEvent) => {
const via = !!e.shiftKey;
if (typeof onSetDestination === 'function') {
onSetDestination(system.solarSystemName, via);
} else {
console.error('onSetDestination not provided');
}
onClose();
};
return (
<div
ref={menuRef}
@@ -85,7 +95,7 @@ export const SystemContextMenu = ({ x, y, system, onRename, onDelete, onClearCon
</button>
<div className="h-px bg-slate-700 my-1" />
<button
onClick={(e) => { onSetDestination(system.solarSystemName, e.shiftKey); onClose(); }}
onClick={handleSetDestinationClick}
className="w-full px-3 py-1 text-left text-emerald-400 hover:bg-slate-700 rounded text-sm"
title="Shift-click to enter via mode and append waypoints"
>