mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-04 16:34:28 +00:00
* fix(Map): fix design of kills widget, fix design of signatures widget - refactor a lot of code, fixed problem with tooltip blinking * fix(Map): refactor Tracking dialog, refactor Activity tracker, refactor codebase and some styles * fix(Core): don't count character passage on manual add connection * refactor(Core): improved characters tracking API * fix(Core): fixed link signature to system on 'leads to' set * fix(Map): Refactor map settings and prepared it to easier using * fix(Map): Add support new command for following update * fix(Map): Add support new command for main update * refactor(Core): Reduce map init data by using cached system static data * refactor(Core): Reduce map init data by extract signatures loading to a separate event * fix(Core): adjusted IP rate limits * fix(Map): Update design of tracking characters. Added icons for following and main. Added ability to see that character on the station or structure --------- Co-authored-by: achichenkov <aleksei.chichenkov@telleqt.ai> Co-authored-by: Dmitry Popov <dmitriypopovsamara@gmail.com>
26 lines
881 B
TypeScript
26 lines
881 B
TypeScript
import { Node, useReactFlow } from 'reactflow';
|
|
import { useCallback, useRef } from 'react';
|
|
import { CommandAddSystems } from '@/hooks/Mapper/types/mapHandlers.ts';
|
|
import { convertSystem2Node } from '../../helpers';
|
|
import { useLoadSystemStatic } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic';
|
|
|
|
export const useMapAddSystems = () => {
|
|
const rf = useReactFlow();
|
|
|
|
const { addSystemStatic } = useLoadSystemStatic({ systems: [] });
|
|
|
|
const ref = useRef({ rf });
|
|
ref.current = { rf };
|
|
|
|
return useCallback((systems: CommandAddSystems) => {
|
|
const { rf } = ref.current;
|
|
const nodes = rf.getNodes();
|
|
|
|
const newSystems = systems.filter(x => !nodes.some(y => x.id === y.id));
|
|
newSystems.forEach(x => addSystemStatic(x.system_static_info));
|
|
|
|
const prepared: Node[] = newSystems.map(convertSystem2Node);
|
|
rf.addNodes(prepared);
|
|
}, []);
|
|
};
|