mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-28 03:53:26 +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>
111 lines
3.4 KiB
TypeScript
111 lines
3.4 KiB
TypeScript
import { useLabelsMenu, useStatusMenu, useTagMenu } from '@/hooks/Mapper/components/contexts/ContextMenuSystem/hooks';
|
|
import { useMemo } from 'react';
|
|
import { getSystemById } from '@/hooks/Mapper/helpers';
|
|
import classes from './ContextMenuSystem.module.scss';
|
|
import { PrimeIcons } from 'primereact/api';
|
|
import { ContextMenuSystemProps } from '@/hooks/Mapper/components/contexts';
|
|
import { useWaypointMenu } from '@/hooks/Mapper/components/contexts/hooks';
|
|
import { FastSystemActions } from '@/hooks/Mapper/components/contexts/components';
|
|
import { useMapCheckPermissions } from '@/hooks/Mapper/mapRootProvider/hooks/api';
|
|
import { UserPermission } from '@/hooks/Mapper/types/permissions.ts';
|
|
import { isWormholeSpace } from '@/hooks/Mapper/components/map/helpers/isWormholeSpace.ts';
|
|
import { getSystemStaticInfo } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic';
|
|
|
|
export const useContextMenuSystemItems = ({
|
|
onDeleteSystem,
|
|
onLockToggle,
|
|
onHubToggle,
|
|
onSystemTag,
|
|
onSystemStatus,
|
|
onSystemLabels,
|
|
onCustomLabelDialog,
|
|
onOpenSettings,
|
|
onWaypointSet,
|
|
systemId,
|
|
hubs,
|
|
systems,
|
|
}: Omit<ContextMenuSystemProps, 'contextMenuRef'>) => {
|
|
const getTags = useTagMenu(systems, systemId, onSystemTag);
|
|
const getStatus = useStatusMenu(systems, systemId, onSystemStatus);
|
|
const getLabels = useLabelsMenu(systems, systemId, onSystemLabels, onCustomLabelDialog);
|
|
const getWaypointMenu = useWaypointMenu(onWaypointSet);
|
|
const canLockSystem = useMapCheckPermissions([UserPermission.LOCK_SYSTEM]);
|
|
|
|
return useMemo(() => {
|
|
const system = systemId ? getSystemById(systems, systemId) : undefined;
|
|
const systemStaticInfo = getSystemStaticInfo(systemId)!;
|
|
|
|
if (!system || !systemId) {
|
|
return [];
|
|
}
|
|
|
|
return [
|
|
{
|
|
className: classes.FastActions,
|
|
template: () => {
|
|
return (
|
|
<FastSystemActions
|
|
systemId={systemId}
|
|
systemName={systemStaticInfo.solar_system_name}
|
|
regionName={systemStaticInfo.region_name}
|
|
isWH={isWormholeSpace(systemStaticInfo.system_class)}
|
|
showEdit
|
|
onOpenSettings={onOpenSettings}
|
|
/>
|
|
);
|
|
},
|
|
},
|
|
{ separator: true },
|
|
getTags(),
|
|
getStatus(),
|
|
...getLabels(),
|
|
...getWaypointMenu(systemId, systemStaticInfo.system_class),
|
|
{
|
|
label: !hubs.includes(systemId) ? 'Add in Routes' : 'Remove from Routes',
|
|
icon: PrimeIcons.MAP_MARKER,
|
|
command: onHubToggle,
|
|
},
|
|
...(system.locked
|
|
? canLockSystem
|
|
? [
|
|
{
|
|
label: 'Unlock',
|
|
icon: PrimeIcons.LOCK_OPEN,
|
|
command: onLockToggle,
|
|
},
|
|
]
|
|
: []
|
|
: [
|
|
...(canLockSystem
|
|
? [
|
|
{
|
|
label: 'Lock',
|
|
icon: PrimeIcons.LOCK,
|
|
command: onLockToggle,
|
|
},
|
|
]
|
|
: []),
|
|
{ separator: true },
|
|
{
|
|
label: 'Delete',
|
|
icon: PrimeIcons.TRASH,
|
|
command: onDeleteSystem,
|
|
},
|
|
]),
|
|
];
|
|
}, [
|
|
canLockSystem,
|
|
systems,
|
|
systemId,
|
|
getTags,
|
|
getStatus,
|
|
getLabels,
|
|
getWaypointMenu,
|
|
hubs,
|
|
onHubToggle,
|
|
onOpenSettings,
|
|
onLockToggle,
|
|
onDeleteSystem,
|
|
]);
|
|
};
|