feat(app): implement EVE SSO login and waypoint setting functionality

This commit is contained in:
2025-08-09 18:49:36 +02:00
parent 98b6397dcc
commit 478a628b6f
5 changed files with 513 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
import { useState, useRef } from 'react';
import { System } from '@/lib/types';
import { toast } from '@/hooks/use-toast';
import { StartESILogin, ESILoginStatus, SetDestinationByName } from '@/wailsjs/go/main/App';
interface SystemContextMenuProps {
x: number;
@@ -27,6 +29,22 @@ export const SystemContextMenu = ({ x, y, system, onRename, onDelete, onClearCon
setIsRenaming(false);
};
const handleSetDestination = async () => {
try {
const status = await ESILoginStatus();
if (status.includes('not logged in')) {
await StartESILogin();
toast({ title: 'EVE Login', description: 'Please complete login in your browser, then retry.' });
return;
}
await SetDestinationByName(system.solarSystemName, true, false);
toast({ title: 'Destination set', description: `${system.solarSystemName}` });
onClose();
} catch (e: any) {
toast({ title: 'Failed to set destination', description: String(e), variant: 'destructive' });
}
};
return (
<div
ref={menuRef}
@@ -82,6 +100,13 @@ export const SystemContextMenu = ({ x, y, system, onRename, onDelete, onClearCon
>
Delete
</button>
<div className="h-px bg-slate-700 my-1" />
<button
onClick={handleSetDestination}
className="w-full px-3 py-1 text-left text-green-400 hover:bg-slate-700 rounded text-sm"
>
Set destination
</button>
</div>
)}
</div>