, onSelectionChange
const { charactersUpdated, presentCharacters, characterAdded, characterRemoved, characterUpdated } =
useCommandsCharacters();
- useImperativeHandle(ref, () => {
- return {
- command(type, data) {
- switch (type) {
- case Commands.init:
- mapInit(data as CommandInit);
- break;
- case Commands.addSystems:
- setTimeout(() => mapAddSystems(data as CommandAddSystems), 100);
- break;
- case Commands.updateSystems:
- mapUpdateSystems(data as CommandUpdateSystems);
- break;
- case Commands.removeSystems:
- setTimeout(() => removeSystems(data as CommandRemoveSystems), 100);
- break;
- case Commands.addConnections:
- setTimeout(() => addConnections(data as CommandAddConnections), 100);
- break;
- case Commands.removeConnections:
- setTimeout(() => removeConnections(data as CommandRemoveConnections), 100);
- break;
- case Commands.charactersUpdated:
- charactersUpdated(data as CommandCharactersUpdated);
- break;
- case Commands.characterAdded:
- characterAdded(data as CommandCharacterAdded);
- break;
- case Commands.characterRemoved:
- characterRemoved(data as CommandCharacterRemoved);
- break;
- case Commands.characterUpdated:
- characterUpdated(data as CommandCharacterUpdated);
- break;
- case Commands.presentCharacters:
- presentCharacters(data as CommandPresentCharacters);
- break;
- case Commands.updateConnection:
- updateConnection(data as CommandUpdateConnection);
- break;
- case Commands.mapUpdated:
- mapUpdated(data as CommandMapUpdated);
- break;
- case Commands.killsUpdated:
- killsUpdated(data as CommandKillsUpdated);
- break;
+ useImperativeHandle(
+ ref,
+ () => {
+ return {
+ command(type, data) {
+ switch (type) {
+ case Commands.init:
+ mapInit(data as CommandInit);
+ break;
+ case Commands.addSystems:
+ setTimeout(() => mapAddSystems(data as CommandAddSystems), 100);
+ break;
+ case Commands.updateSystems:
+ mapUpdateSystems(data as CommandUpdateSystems);
+ break;
+ case Commands.removeSystems:
+ setTimeout(() => removeSystems(data as CommandRemoveSystems), 100);
+ break;
+ case Commands.addConnections:
+ setTimeout(() => addConnections(data as CommandAddConnections), 100);
+ break;
+ case Commands.removeConnections:
+ setTimeout(() => removeConnections(data as CommandRemoveConnections), 100);
+ break;
+ case Commands.charactersUpdated:
+ charactersUpdated(data as CommandCharactersUpdated);
+ break;
+ case Commands.characterAdded:
+ characterAdded(data as CommandCharacterAdded);
+ break;
+ case Commands.characterRemoved:
+ characterRemoved(data as CommandCharacterRemoved);
+ break;
+ case Commands.characterUpdated:
+ characterUpdated(data as CommandCharacterUpdated);
+ break;
+ case Commands.presentCharacters:
+ presentCharacters(data as CommandPresentCharacters);
+ break;
+ case Commands.updateConnection:
+ updateConnection(data as CommandUpdateConnection);
+ break;
+ case Commands.mapUpdated:
+ mapUpdated(data as CommandMapUpdated);
+ break;
+ case Commands.killsUpdated:
+ killsUpdated(data as CommandKillsUpdated);
+ break;
- case Commands.centerSystem:
- setTimeout(() => {
- const systemId = `${data}`;
- centerSystem(systemId as CommandSelectSystem);
- }, 100);
- break;
+ case Commands.centerSystem:
+ setTimeout(() => {
+ const systemId = `${data}`;
+ centerSystem(systemId as CommandSelectSystem);
+ }, 100);
+ break;
- case Commands.selectSystem:
- selectSystems({ systems: [data as string], delay: 500 });
- break;
+ case Commands.selectSystem:
+ selectSystems({ systems: [data as string], delay: 500 });
+ break;
- case Commands.selectSystems:
- selectSystems(data as CommandSelectSystems);
- break;
+ case Commands.selectSystems:
+ selectSystems(data as CommandSelectSystems);
+ break;
- case Commands.pingAdded:
- case Commands.pingCancelled:
- case Commands.routes:
- case Commands.signaturesUpdated:
- case Commands.linkSignatureToSystem:
- case Commands.detailedKillsUpdated:
- case Commands.characterActivityData:
- case Commands.trackingCharactersData:
- case Commands.updateActivity:
- case Commands.updateTracking:
- case Commands.userSettingsUpdated:
- // do nothing
- break;
+ case Commands.pingAdded:
+ case Commands.pingCancelled:
+ case Commands.routes:
+ case Commands.signaturesUpdated:
+ case Commands.linkSignatureToSystem:
+ case Commands.detailedKillsUpdated:
+ case Commands.characterActivityData:
+ case Commands.trackingCharactersData:
+ case Commands.updateActivity:
+ case Commands.updateTracking:
+ case Commands.userSettingsUpdated:
+ // do nothing
+ break;
- default:
- console.warn(`Map handlers: Unknown command: ${type}`, data);
- break;
- }
- },
- };
- }, []);
+ default:
+ console.warn(`Map handlers: Unknown command: ${type}`, data);
+ break;
+ }
+ },
+ };
+ },
+ [],
+ );
};
diff --git a/assets/js/hooks/Mapper/components/ui-kit/MenuItemWithInfo.tsx b/assets/js/hooks/Mapper/components/ui-kit/MenuItemWithInfo.tsx
index 9c7a295b..675eb64e 100644
--- a/assets/js/hooks/Mapper/components/ui-kit/MenuItemWithInfo.tsx
+++ b/assets/js/hooks/Mapper/components/ui-kit/MenuItemWithInfo.tsx
@@ -4,8 +4,17 @@ import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrap
import { TooltipPosition } from '@/hooks/Mapper/components/ui-kit/WdTooltip';
import clsx from 'clsx';
-type MenuItemWithInfoProps = { infoTitle: ReactNode; infoClass?: string } & WithChildren;
-export const MenuItemWithInfo = ({ children, infoClass, infoTitle }: MenuItemWithInfoProps) => {
+type MenuItemWithInfoProps = {
+ infoTitle: ReactNode;
+ infoClass?: string;
+ tooltipWrapperClassName?: string;
+} & WithChildren;
+export const MenuItemWithInfo = ({
+ children,
+ infoClass,
+ infoTitle,
+ tooltipWrapperClassName,
+}: MenuItemWithInfoProps) => {
return (
{children}
@@ -13,6 +22,7 @@ export const MenuItemWithInfo = ({ children, infoClass, infoTitle }: MenuItemWit
content={infoTitle}
position={TooltipPosition.top}
className="!opacity-100 !pointer-events-auto"
+ wrapperClassName={tooltipWrapperClassName}
>
diff --git a/assets/js/hooks/Mapper/components/ui-kit/WdMenuItem.tsx b/assets/js/hooks/Mapper/components/ui-kit/WdMenuItem.tsx
index 3af102d2..014662d3 100644
--- a/assets/js/hooks/Mapper/components/ui-kit/WdMenuItem.tsx
+++ b/assets/js/hooks/Mapper/components/ui-kit/WdMenuItem.tsx
@@ -1,13 +1,18 @@
-import { WithChildren } from '@/hooks/Mapper/types/common.ts';
+import { WithChildren, WithClassName } from '@/hooks/Mapper/types/common.ts';
import clsx from 'clsx';
-type WdMenuItemProps = { icon?: string; disabled?: boolean } & WithChildren;
-export const WdMenuItem = ({ children, icon, disabled }: WdMenuItemProps) => {
+type WdMenuItemProps = { icon?: string; disabled?: boolean } & WithChildren & WithClassName;
+export const WdMenuItem = ({ children, icon, disabled, className }: WdMenuItemProps) => {
return (
{icon && }
{children}
diff --git a/assets/js/hooks/Mapper/components/ui-kit/WdTooltipWrapper/WdTooltipWrapper.tsx b/assets/js/hooks/Mapper/components/ui-kit/WdTooltipWrapper/WdTooltipWrapper.tsx
index ce5d80ce..5090a4f4 100644
--- a/assets/js/hooks/Mapper/components/ui-kit/WdTooltipWrapper/WdTooltipWrapper.tsx
+++ b/assets/js/hooks/Mapper/components/ui-kit/WdTooltipWrapper/WdTooltipWrapper.tsx
@@ -10,6 +10,7 @@ export type WdTooltipWrapperProps = {
interactive?: boolean;
smallPaddings?: boolean;
tooltipClassName?: string;
+ wrapperClassName?: string;
} & Omit, 'content' | 'size'> &
Omit;
@@ -26,6 +27,7 @@ export const WdTooltipWrapper = forwardRef
- {targetSelector ? <>{children}> : {children}
}
+ {targetSelector ? <>{children}> : {children}
}
= {
[Spaces.Gallente]: 'Gallente',
[Spaces.Pochven]: 'Pochven',
};
+
+export const PERMISSIONS_POWER_MAP = {
+ [UserPermission.ADD_SYSTEM]: [UserPermission.ADD_SYSTEM, UserPermission.MANAGE_MAP, UserPermission.ADMIN_MAP],
+ [UserPermission.MANAGE_MAP]: [UserPermission.MANAGE_MAP, UserPermission.ADMIN_MAP],
+ [UserPermission.ADMIN_MAP]: [UserPermission.ADMIN_MAP],
+};
diff --git a/assets/js/hooks/Mapper/types/index.ts b/assets/js/hooks/Mapper/types/index.ts
index 1343e17c..142ef976 100644
--- a/assets/js/hooks/Mapper/types/index.ts
+++ b/assets/js/hooks/Mapper/types/index.ts
@@ -9,3 +9,4 @@ export * from './connectionPassages';
export * from './permissions';
export * from './comment';
export * from './ping';
+export * from './options';
diff --git a/assets/js/hooks/Mapper/types/mapHandlers.ts b/assets/js/hooks/Mapper/types/mapHandlers.ts
index e7b9c805..aaae0ff5 100644
--- a/assets/js/hooks/Mapper/types/mapHandlers.ts
+++ b/assets/js/hooks/Mapper/types/mapHandlers.ts
@@ -1,4 +1,4 @@
-import { CommentType, PingData, SystemSignature, UserPermissions } from '@/hooks/Mapper/types';
+import { CommentType, MapOptions, PingData, SystemSignature, UserPermissions } from '@/hooks/Mapper/types';
import { ActivitySummary, CharacterTypeRaw, TrackingCharacter } from '@/hooks/Mapper/types/character.ts';
import { SolarSystemConnection } from '@/hooks/Mapper/types/connection.ts';
import { DetailedKill, Kill } from '@/hooks/Mapper/types/kills.ts';
@@ -94,7 +94,7 @@ export type CommandInit = {
hubs: string[];
user_hubs: string[];
routes: RoutesList;
- options: Record;
+ options: MapOptions;
reset?: boolean;
is_subscription_active?: boolean;
main_character_eve_id?: string | null;
diff --git a/assets/js/hooks/Mapper/types/mapUnionTypes.ts b/assets/js/hooks/Mapper/types/mapUnionTypes.ts
index 31ae4099..d4230dc4 100644
--- a/assets/js/hooks/Mapper/types/mapUnionTypes.ts
+++ b/assets/js/hooks/Mapper/types/mapUnionTypes.ts
@@ -4,7 +4,7 @@ import { CharacterTypeRaw } from '@/hooks/Mapper/types/character.ts';
import { SolarSystemRawType } from '@/hooks/Mapper/types/system.ts';
import { RoutesList } from '@/hooks/Mapper/types/routes.ts';
import { SolarSystemConnection } from '@/hooks/Mapper/types/connection.ts';
-import { PingData, UserPermissions } from '@/hooks/Mapper/types';
+import { MapOptions, PingData, UserPermissions } from '@/hooks/Mapper/types';
import { SystemSignature } from '@/hooks/Mapper/types/signatures';
export type MapUnionTypes = {
@@ -23,7 +23,7 @@ export type MapUnionTypes = {
kills: Record;
connections: SolarSystemConnection[];
userPermissions: Partial;
- options: Record;
+ options: MapOptions;
isSubscriptionActive: boolean;
mainCharacterEveId: string | null;
diff --git a/assets/js/hooks/Mapper/types/options.ts b/assets/js/hooks/Mapper/types/options.ts
new file mode 100644
index 00000000..5b6f0017
--- /dev/null
+++ b/assets/js/hooks/Mapper/types/options.ts
@@ -0,0 +1,14 @@
+import { UserPermission } from '@/hooks/Mapper/types/permissions.ts';
+
+export type StringBoolean = 'true' | 'false';
+
+export type MapOptions = {
+ allowed_copy_for: UserPermission;
+ allowed_paste_for: UserPermission;
+ layout: string;
+ restrict_offline_showing: StringBoolean;
+ show_linked_signature_id: StringBoolean;
+ show_linked_signature_id_temp_name: StringBoolean;
+ show_temp_system_name: StringBoolean;
+ store_custom_labels: StringBoolean;
+};