mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-11 18:26:04 +00:00
fix(Map): Add support for Bridge. Made all tooltips left and right paddings.
This commit is contained in:
@@ -8,6 +8,10 @@
|
|||||||
background-image: linear-gradient(207deg, transparent, var(--conn-frigate));
|
background-image: linear-gradient(207deg, transparent, var(--conn-frigate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ConnectionBridge {
|
||||||
|
background-image: linear-gradient(207deg, transparent, var(--conn-bridge));
|
||||||
|
}
|
||||||
|
|
||||||
.ConnectionSave {
|
.ConnectionSave {
|
||||||
background-image: linear-gradient(207deg, transparent, var(--conn-save));
|
background-image: linear-gradient(207deg, transparent, var(--conn-save));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import { MenuItem } from 'primereact/menuitem';
|
|||||||
import React, { RefObject, useMemo } from 'react';
|
import React, { RefObject, useMemo } from 'react';
|
||||||
import { Edge } from 'reactflow';
|
import { Edge } from 'reactflow';
|
||||||
import classes from './ContextMenuConnection.module.scss';
|
import classes from './ContextMenuConnection.module.scss';
|
||||||
|
import { getSystemStaticInfo } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic.ts';
|
||||||
|
import { isNullsecSpace } from '@/hooks/Mapper/components/map/helpers/isKnownSpace.ts';
|
||||||
|
|
||||||
export interface ContextMenuConnectionProps {
|
export interface ContextMenuConnectionProps {
|
||||||
contextMenuRef: RefObject<ContextMenu>;
|
contextMenuRef: RefObject<ContextMenu>;
|
||||||
@@ -21,6 +23,7 @@ export interface ContextMenuConnectionProps {
|
|||||||
onChangeTimeState(): void;
|
onChangeTimeState(): void;
|
||||||
onChangeMassState(state: MassState): void;
|
onChangeMassState(state: MassState): void;
|
||||||
onChangeShipSizeStatus(state: ShipSizeStatus): void;
|
onChangeShipSizeStatus(state: ShipSizeStatus): void;
|
||||||
|
onChangeType(type: ConnectionType): void;
|
||||||
onToggleMassSave(isLocked: boolean): void;
|
onToggleMassSave(isLocked: boolean): void;
|
||||||
onHide(): void;
|
onHide(): void;
|
||||||
edge?: Edge<SolarSystemConnection>;
|
edge?: Edge<SolarSystemConnection>;
|
||||||
@@ -32,6 +35,7 @@ export const ContextMenuConnection: React.FC<ContextMenuConnectionProps> = ({
|
|||||||
onChangeTimeState,
|
onChangeTimeState,
|
||||||
onChangeMassState,
|
onChangeMassState,
|
||||||
onChangeShipSizeStatus,
|
onChangeShipSizeStatus,
|
||||||
|
onChangeType,
|
||||||
onToggleMassSave,
|
onToggleMassSave,
|
||||||
onHide,
|
onHide,
|
||||||
edge,
|
edge,
|
||||||
@@ -41,84 +45,127 @@ export const ContextMenuConnection: React.FC<ContextMenuConnectionProps> = ({
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sourceInfo = getSystemStaticInfo(edge.data?.source);
|
||||||
|
const targetInfo = getSystemStaticInfo(edge.data?.target);
|
||||||
|
|
||||||
|
const bothNullsec =
|
||||||
|
sourceInfo && targetInfo && isNullsecSpace(sourceInfo.system_class) && isNullsecSpace(targetInfo.system_class);
|
||||||
|
|
||||||
const isFrigateSize = edge.data?.ship_size_type === ShipSizeStatus.small;
|
const isFrigateSize = edge.data?.ship_size_type === ShipSizeStatus.small;
|
||||||
const isWormhole = edge.data?.type === ConnectionType.wormhole;
|
|
||||||
|
if (edge.data?.type === ConnectionType.bridge) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: `Set as Wormhole`,
|
||||||
|
icon: 'pi hero-arrow-uturn-left',
|
||||||
|
command: () => onChangeType(ConnectionType.wormhole),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Disconnect',
|
||||||
|
icon: PrimeIcons.TRASH,
|
||||||
|
command: onDeleteConnection,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (edge.data?.type === ConnectionType.gate) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: 'Disconnect',
|
||||||
|
icon: PrimeIcons.TRASH,
|
||||||
|
command: onDeleteConnection,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...(isWormhole
|
{
|
||||||
|
label: `EOL`,
|
||||||
|
className: clsx({
|
||||||
|
[classes.ConnectionTimeEOL]: edge.data?.time_status === TimeStatus.eol,
|
||||||
|
}),
|
||||||
|
icon: PrimeIcons.CLOCK,
|
||||||
|
command: onChangeTimeState,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `Frigate`,
|
||||||
|
className: clsx({
|
||||||
|
[classes.ConnectionFrigate]: isFrigateSize,
|
||||||
|
}),
|
||||||
|
icon: PrimeIcons.CLOUD,
|
||||||
|
command: () =>
|
||||||
|
onChangeShipSizeStatus(
|
||||||
|
edge.data?.ship_size_type === ShipSizeStatus.small ? ShipSizeStatus.large : ShipSizeStatus.small,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: `Save mass`,
|
||||||
|
className: clsx({
|
||||||
|
[classes.ConnectionSave]: edge.data?.locked,
|
||||||
|
}),
|
||||||
|
icon: PrimeIcons.LOCK,
|
||||||
|
command: () => onToggleMassSave(!edge.data?.locked),
|
||||||
|
},
|
||||||
|
...(!isFrigateSize
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
label: `EOL`,
|
label: `Mass status`,
|
||||||
className: clsx({
|
icon: PrimeIcons.CHART_PIE,
|
||||||
[classes.ConnectionTimeEOL]: edge.data?.time_status === TimeStatus.eol,
|
items: MASS_STATE_NAMES_ORDER.map(x => ({
|
||||||
}),
|
label: MASS_STATE_NAMES[x],
|
||||||
icon: PrimeIcons.CLOCK,
|
|
||||||
command: onChangeTimeState,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: `Frigate`,
|
|
||||||
className: clsx({
|
|
||||||
[classes.ConnectionFrigate]: isFrigateSize,
|
|
||||||
}),
|
|
||||||
icon: PrimeIcons.CLOUD,
|
|
||||||
command: () =>
|
|
||||||
onChangeShipSizeStatus(
|
|
||||||
edge.data?.ship_size_type === ShipSizeStatus.small ? ShipSizeStatus.large : ShipSizeStatus.small,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: `Save mass`,
|
|
||||||
className: clsx({
|
|
||||||
[classes.ConnectionSave]: edge.data?.locked,
|
|
||||||
}),
|
|
||||||
icon: PrimeIcons.LOCK,
|
|
||||||
command: () => onToggleMassSave(!edge.data?.locked),
|
|
||||||
},
|
|
||||||
...(!isFrigateSize
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
label: `Mass status`,
|
|
||||||
icon: PrimeIcons.CHART_PIE,
|
|
||||||
items: MASS_STATE_NAMES_ORDER.map(x => ({
|
|
||||||
label: MASS_STATE_NAMES[x],
|
|
||||||
className: clsx({
|
|
||||||
[classes.SelectedItem]: edge.data?.mass_status === x,
|
|
||||||
}),
|
|
||||||
command: () => onChangeMassState(x),
|
|
||||||
})),
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: []),
|
|
||||||
|
|
||||||
{
|
|
||||||
label: `Ship Size`,
|
|
||||||
icon: PrimeIcons.CLOUD,
|
|
||||||
items: SHIP_SIZES_NAMES_ORDER.map(x => ({
|
|
||||||
label: (
|
|
||||||
<div className="grid grid-cols-[20px_120px_1fr_40px] gap-2 items-center">
|
|
||||||
<div className="text-[12px] font-bold text-stone-400">{SHIP_SIZES_NAMES_SHORT[x]}</div>
|
|
||||||
<div>{SHIP_SIZES_NAMES[x]}</div>
|
|
||||||
<div></div>
|
|
||||||
<div className="flex justify-end whitespace-nowrap text-[12px] font-bold text-stone-500">
|
|
||||||
{SHIP_SIZES_SIZE[x]} t.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) as unknown as string, // TODO my lovely kostyl
|
|
||||||
className: clsx({
|
className: clsx({
|
||||||
[classes.SelectedItem]: edge.data?.ship_size_type === x,
|
[classes.SelectedItem]: edge.data?.mass_status === x,
|
||||||
}),
|
}),
|
||||||
command: () => onChangeShipSizeStatus(x),
|
command: () => onChangeMassState(x),
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
: []),
|
: []),
|
||||||
|
|
||||||
|
{
|
||||||
|
label: `Ship Size`,
|
||||||
|
icon: PrimeIcons.CLOUD,
|
||||||
|
items: SHIP_SIZES_NAMES_ORDER.map(x => ({
|
||||||
|
label: (
|
||||||
|
<div className="grid grid-cols-[20px_120px_1fr_40px] gap-2 items-center">
|
||||||
|
<div className="text-[12px] font-bold text-stone-400">{SHIP_SIZES_NAMES_SHORT[x]}</div>
|
||||||
|
<div>{SHIP_SIZES_NAMES[x]}</div>
|
||||||
|
<div></div>
|
||||||
|
<div className="flex justify-end whitespace-nowrap text-[12px] font-bold text-stone-500">
|
||||||
|
{SHIP_SIZES_SIZE[x]} t.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) as unknown as string, // TODO my lovely kostyl
|
||||||
|
className: clsx({
|
||||||
|
[classes.SelectedItem]: edge.data?.ship_size_type === x,
|
||||||
|
}),
|
||||||
|
command: () => onChangeShipSizeStatus(x),
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
...(bothNullsec
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: `Set as Bridge`,
|
||||||
|
icon: 'pi hero-forward',
|
||||||
|
command: () => onChangeType(ConnectionType.bridge),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
label: 'Disconnect',
|
label: 'Disconnect',
|
||||||
icon: PrimeIcons.TRASH,
|
icon: PrimeIcons.TRASH,
|
||||||
command: onDeleteConnection,
|
command: onDeleteConnection,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}, [edge, onChangeTimeState, onDeleteConnection, onChangeShipSizeStatus, onToggleMassSave, onChangeMassState]);
|
}, [
|
||||||
|
edge,
|
||||||
|
onChangeTimeState,
|
||||||
|
onDeleteConnection,
|
||||||
|
onChangeType,
|
||||||
|
onChangeShipSizeStatus,
|
||||||
|
onToggleMassSave,
|
||||||
|
onChangeMassState,
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ export const KillsCounter = ({
|
|||||||
className={className}
|
className={className}
|
||||||
tooltipClassName="!px-0"
|
tooltipClassName="!px-0"
|
||||||
size={size}
|
size={size}
|
||||||
interactive={true}
|
interactive
|
||||||
|
smallPaddings
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</WdTooltipWrapper>
|
</WdTooltipWrapper>
|
||||||
|
|||||||
@@ -46,7 +46,13 @@ export const LocalCounter = ({ localCounterCharacters, hasUserCharacters, showIc
|
|||||||
[classes.Pathfinder]: theme === AvailableThemes.pathfinder,
|
[classes.Pathfinder]: theme === AvailableThemes.pathfinder,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<WdTooltipWrapper content={pilotTooltipContent} position={TooltipPosition.right} offset={0} interactive={true}>
|
<WdTooltipWrapper
|
||||||
|
content={pilotTooltipContent}
|
||||||
|
position={TooltipPosition.right}
|
||||||
|
offset={0}
|
||||||
|
interactive={true}
|
||||||
|
smallPaddings
|
||||||
|
>
|
||||||
<div className={clsx(classes.hoverTarget)}>
|
<div className={clsx(classes.hoverTarget)}>
|
||||||
<div
|
<div
|
||||||
className={clsx(classes.localCounter, {
|
className={clsx(classes.localCounter, {
|
||||||
|
|||||||
@@ -29,6 +29,13 @@
|
|||||||
&.Gate {
|
&.Gate {
|
||||||
stroke: #9aff40;
|
stroke: #9aff40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.Bridge {
|
||||||
|
stroke: #9aff40;
|
||||||
|
|
||||||
|
stroke-dasharray: 10 5;
|
||||||
|
stroke-linecap: round;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.EdgePathFront {
|
.EdgePathFront {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { PrimeIcons } from 'primereact/api';
|
|||||||
import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper';
|
import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper';
|
||||||
import { useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
import { useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
||||||
import { SHIP_SIZES_DESCRIPTION, SHIP_SIZES_NAMES_SHORT } from '@/hooks/Mapper/components/map/constants.ts';
|
import { SHIP_SIZES_DESCRIPTION, SHIP_SIZES_NAMES_SHORT } from '@/hooks/Mapper/components/map/constants.ts';
|
||||||
|
import { TooltipPosition } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
const MAP_TRANSLATES: Record<string, string> = {
|
const MAP_TRANSLATES: Record<string, string> = {
|
||||||
[Position.Top]: 'translate(-48%, 0%)',
|
[Position.Top]: 'translate(-48%, 0%)',
|
||||||
@@ -43,6 +44,8 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
const sourceNode = useStore(useCallback(store => store.nodeInternals.get(source), [source]));
|
const sourceNode = useStore(useCallback(store => store.nodeInternals.get(source), [source]));
|
||||||
const targetNode = useStore(useCallback(store => store.nodeInternals.get(target), [target]));
|
const targetNode = useStore(useCallback(store => store.nodeInternals.get(target), [target]));
|
||||||
const isWormhole = data?.type === ConnectionType.wormhole;
|
const isWormhole = data?.type === ConnectionType.wormhole;
|
||||||
|
const isGate = data?.type === ConnectionType.gate;
|
||||||
|
const isBridge = data?.type === ConnectionType.bridge;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: { isThickConnections },
|
data: { isThickConnections },
|
||||||
@@ -55,9 +58,7 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
|
|
||||||
const offset = isThickConnections ? MAP_OFFSETS_TICK[targetPos] : MAP_OFFSETS[targetPos];
|
const offset = isThickConnections ? MAP_OFFSETS_TICK[targetPos] : MAP_OFFSETS[targetPos];
|
||||||
|
|
||||||
const method = isWormhole ? getBezierPath : getBezierPath;
|
const [edgePath, labelX, labelY] = getBezierPath({
|
||||||
|
|
||||||
const [edgePath, labelX, labelY] = method({
|
|
||||||
sourceX: sx - offset.x,
|
sourceX: sx - offset.x,
|
||||||
sourceY: sy - offset.y,
|
sourceY: sy - offset.y,
|
||||||
sourcePosition: sourcePos,
|
sourcePosition: sourcePos,
|
||||||
@@ -67,7 +68,7 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
});
|
});
|
||||||
|
|
||||||
return [edgePath, labelX, labelY, sx, sy, tx, ty, sourcePos, targetPos];
|
return [edgePath, labelX, labelY, sx, sy, tx, ty, sourcePos, targetPos];
|
||||||
}, [isThickConnections, sourceNode, targetNode, isWormhole]);
|
}, [isThickConnections, sourceNode, targetNode]);
|
||||||
|
|
||||||
if (!sourceNode || !targetNode || !data) {
|
if (!sourceNode || !targetNode || !data) {
|
||||||
return null;
|
return null;
|
||||||
@@ -81,7 +82,8 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
[classes.Tick]: isThickConnections,
|
[classes.Tick]: isThickConnections,
|
||||||
[classes.TimeCrit]: isWormhole && data.time_status === TimeStatus.eol,
|
[classes.TimeCrit]: isWormhole && data.time_status === TimeStatus.eol,
|
||||||
[classes.Hovered]: hovered,
|
[classes.Hovered]: hovered,
|
||||||
[classes.Gate]: !isWormhole,
|
[classes.Gate]: isGate,
|
||||||
|
[classes.Bridge]: isBridge,
|
||||||
})}
|
})}
|
||||||
d={path}
|
d={path}
|
||||||
markerEnd={markerEnd}
|
markerEnd={markerEnd}
|
||||||
@@ -95,7 +97,8 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
[classes.MassVerge]: isWormhole && data.mass_status === MassState.verge,
|
[classes.MassVerge]: isWormhole && data.mass_status === MassState.verge,
|
||||||
[classes.MassHalf]: isWormhole && data.mass_status === MassState.half,
|
[classes.MassHalf]: isWormhole && data.mass_status === MassState.half,
|
||||||
[classes.Frigate]: isWormhole && data.ship_size_type === ShipSizeStatus.small,
|
[classes.Frigate]: isWormhole && data.ship_size_type === ShipSizeStatus.small,
|
||||||
[classes.Gate]: !isWormhole,
|
[classes.Gate]: isGate,
|
||||||
|
[classes.Bridge]: isBridge,
|
||||||
})}
|
})}
|
||||||
d={path}
|
d={path}
|
||||||
markerEnd={markerEnd}
|
markerEnd={markerEnd}
|
||||||
@@ -147,6 +150,19 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
</WdTooltipWrapper>
|
</WdTooltipWrapper>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{isBridge && (
|
||||||
|
<WdTooltipWrapper
|
||||||
|
content="Ansiblex Jump Bridge"
|
||||||
|
position={TooltipPosition.top}
|
||||||
|
className={clsx(
|
||||||
|
classes.LinkLabel,
|
||||||
|
'pointer-events-auto bg-lime-300 rounded opacity-100 cursor-auto text-neutral-900',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
B
|
||||||
|
</WdTooltipWrapper>
|
||||||
|
)}
|
||||||
|
|
||||||
{isWormhole && data.ship_size_type !== ShipSizeStatus.large && (
|
{isWormhole && data.ship_size_type !== ShipSizeStatus.large && (
|
||||||
<WdTooltipWrapper
|
<WdTooltipWrapper
|
||||||
content={SHIP_SIZES_DESCRIPTION[data.ship_size_type]}
|
content={SHIP_SIZES_DESCRIPTION[data.ship_size_type]}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export const UnsplashedSignature = ({ signature }: UnsplashedSignatureProps) =>
|
|||||||
</InfoDrawer>
|
</InfoDrawer>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
smallPaddings
|
||||||
>
|
>
|
||||||
<div className={clsx(classes.Box, whClassStyle)}>
|
<div className={clsx(classes.Box, whClassStyle)}>
|
||||||
<svg width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg">
|
<svg width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
|||||||
@@ -716,12 +716,12 @@ export const STATUS_CLASSES: Record<number, string> = {
|
|||||||
[STATUSES.dangerous]: 'eve-system-status-dangerous',
|
[STATUSES.dangerous]: 'eve-system-status-dangerous',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TYPE_NAMES_ORDER = [ConnectionType.wormhole, ConnectionType.gate, ConnectionType.jumpgate];
|
export const TYPE_NAMES_ORDER = [ConnectionType.wormhole, ConnectionType.gate, ConnectionType.bridge];
|
||||||
|
|
||||||
export const TYPE_NAMES = {
|
export const TYPE_NAMES = {
|
||||||
[ConnectionType.wormhole]: 'Wormhole',
|
[ConnectionType.wormhole]: 'Wormhole',
|
||||||
[ConnectionType.gate]: 'Gate',
|
[ConnectionType.gate]: 'Gate',
|
||||||
[ConnectionType.jumpgate]: 'Jumpgate',
|
[ConnectionType.bridge]: 'Jumpgate',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MASS_STATE_NAMES_ORDER = [MassState.verge, MassState.half, MassState.normal];
|
export const MASS_STATE_NAMES_ORDER = [MassState.verge, MassState.half, MassState.normal];
|
||||||
|
|||||||
@@ -15,3 +15,12 @@ export const isKnownSpace = (wormholeClassID: number) => {
|
|||||||
export const isPossibleSpace = (spaces: number[], wormholeClassID: number) => {
|
export const isPossibleSpace = (spaces: number[], wormholeClassID: number) => {
|
||||||
return spaces.includes(wormholeClassID);
|
return spaces.includes(wormholeClassID);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isNullsecSpace = (wormholeClassID: number) => {
|
||||||
|
switch (wormholeClassID) {
|
||||||
|
case SOLAR_SYSTEM_CLASS_IDS.ns:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|||||||
@@ -49,87 +49,91 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
|
|||||||
const { charactersUpdated, presentCharacters, characterAdded, characterRemoved, characterUpdated } =
|
const { charactersUpdated, presentCharacters, characterAdded, characterRemoved, characterUpdated } =
|
||||||
useCommandsCharacters();
|
useCommandsCharacters();
|
||||||
|
|
||||||
useImperativeHandle(ref, () => {
|
useImperativeHandle(
|
||||||
return {
|
ref,
|
||||||
command(type, data) {
|
() => {
|
||||||
switch (type) {
|
return {
|
||||||
case Commands.init:
|
command(type, data) {
|
||||||
mapInit(data as CommandInit);
|
switch (type) {
|
||||||
break;
|
case Commands.init:
|
||||||
case Commands.addSystems:
|
mapInit(data as CommandInit);
|
||||||
setTimeout(() => mapAddSystems(data as CommandAddSystems), 100);
|
break;
|
||||||
break;
|
case Commands.addSystems:
|
||||||
case Commands.updateSystems:
|
setTimeout(() => mapAddSystems(data as CommandAddSystems), 100);
|
||||||
mapUpdateSystems(data as CommandUpdateSystems);
|
break;
|
||||||
break;
|
case Commands.updateSystems:
|
||||||
case Commands.removeSystems:
|
mapUpdateSystems(data as CommandUpdateSystems);
|
||||||
setTimeout(() => removeSystems(data as CommandRemoveSystems), 100);
|
break;
|
||||||
break;
|
case Commands.removeSystems:
|
||||||
case Commands.addConnections:
|
setTimeout(() => removeSystems(data as CommandRemoveSystems), 100);
|
||||||
setTimeout(() => addConnections(data as CommandAddConnections), 100);
|
break;
|
||||||
break;
|
case Commands.addConnections:
|
||||||
case Commands.removeConnections:
|
setTimeout(() => addConnections(data as CommandAddConnections), 100);
|
||||||
setTimeout(() => removeConnections(data as CommandRemoveConnections), 100);
|
break;
|
||||||
break;
|
case Commands.removeConnections:
|
||||||
case Commands.charactersUpdated:
|
setTimeout(() => removeConnections(data as CommandRemoveConnections), 100);
|
||||||
charactersUpdated(data as CommandCharactersUpdated);
|
break;
|
||||||
break;
|
case Commands.charactersUpdated:
|
||||||
case Commands.characterAdded:
|
charactersUpdated(data as CommandCharactersUpdated);
|
||||||
characterAdded(data as CommandCharacterAdded);
|
break;
|
||||||
break;
|
case Commands.characterAdded:
|
||||||
case Commands.characterRemoved:
|
characterAdded(data as CommandCharacterAdded);
|
||||||
characterRemoved(data as CommandCharacterRemoved);
|
break;
|
||||||
break;
|
case Commands.characterRemoved:
|
||||||
case Commands.characterUpdated:
|
characterRemoved(data as CommandCharacterRemoved);
|
||||||
characterUpdated(data as CommandCharacterUpdated);
|
break;
|
||||||
break;
|
case Commands.characterUpdated:
|
||||||
case Commands.presentCharacters:
|
characterUpdated(data as CommandCharacterUpdated);
|
||||||
presentCharacters(data as CommandPresentCharacters);
|
break;
|
||||||
break;
|
case Commands.presentCharacters:
|
||||||
case Commands.updateConnection:
|
presentCharacters(data as CommandPresentCharacters);
|
||||||
updateConnection(data as CommandUpdateConnection);
|
break;
|
||||||
break;
|
case Commands.updateConnection:
|
||||||
case Commands.mapUpdated:
|
updateConnection(data as CommandUpdateConnection);
|
||||||
mapUpdated(data as CommandMapUpdated);
|
break;
|
||||||
break;
|
case Commands.mapUpdated:
|
||||||
case Commands.killsUpdated:
|
mapUpdated(data as CommandMapUpdated);
|
||||||
killsUpdated(data as CommandKillsUpdated);
|
break;
|
||||||
break;
|
case Commands.killsUpdated:
|
||||||
|
killsUpdated(data as CommandKillsUpdated);
|
||||||
|
break;
|
||||||
|
|
||||||
case Commands.centerSystem:
|
case Commands.centerSystem:
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const systemId = `${data}`;
|
const systemId = `${data}`;
|
||||||
centerSystem(systemId as CommandSelectSystem);
|
centerSystem(systemId as CommandSelectSystem);
|
||||||
}, 100);
|
}, 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.selectSystem:
|
case Commands.selectSystem:
|
||||||
selectSystems({ systems: [data as string], delay: 500 });
|
selectSystems({ systems: [data as string], delay: 500 });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.selectSystems:
|
case Commands.selectSystems:
|
||||||
selectSystems(data as CommandSelectSystems);
|
selectSystems(data as CommandSelectSystems);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.pingAdded:
|
case Commands.pingAdded:
|
||||||
case Commands.pingCancelled:
|
case Commands.pingCancelled:
|
||||||
case Commands.routes:
|
case Commands.routes:
|
||||||
case Commands.signaturesUpdated:
|
case Commands.signaturesUpdated:
|
||||||
case Commands.linkSignatureToSystem:
|
case Commands.linkSignatureToSystem:
|
||||||
case Commands.detailedKillsUpdated:
|
case Commands.detailedKillsUpdated:
|
||||||
case Commands.characterActivityData:
|
case Commands.characterActivityData:
|
||||||
case Commands.trackingCharactersData:
|
case Commands.trackingCharactersData:
|
||||||
case Commands.updateActivity:
|
case Commands.updateActivity:
|
||||||
case Commands.updateTracking:
|
case Commands.updateTracking:
|
||||||
case Commands.userSettingsUpdated:
|
case Commands.userSettingsUpdated:
|
||||||
// do nothing
|
// do nothing
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.warn(`Map handlers: Unknown command: ${type}`, data);
|
console.warn(`Map handlers: Unknown command: ${type}`, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}, []);
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ $homeDark30: color.adjust($homeBase, $lightness: -30%);
|
|||||||
|
|
||||||
--conn-time-eol: #7452c3e3;
|
--conn-time-eol: #7452c3e3;
|
||||||
--conn-frigate: #325d88;
|
--conn-frigate: #325d88;
|
||||||
|
--conn-bridge: rgba(135, 185, 93, 0.85);
|
||||||
--conn-save: rgba(155, 102, 45, 0.85);
|
--conn-save: rgba(155, 102, 45, 0.85);
|
||||||
--selected-item-bg: rgba(98, 98, 98, 0.33);
|
--selected-item-bg: rgba(98, 98, 98, 0.33);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export interface TooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|||||||
content: (() => React.ReactNode) | React.ReactNode;
|
content: (() => React.ReactNode) | React.ReactNode;
|
||||||
targetSelector?: string;
|
targetSelector?: string;
|
||||||
interactive?: boolean;
|
interactive?: boolean;
|
||||||
|
smallPaddings?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OffsetPosition {
|
export interface OffsetPosition {
|
||||||
@@ -47,6 +48,7 @@ export const WdTooltip = forwardRef(
|
|||||||
position: tPosition = TooltipPosition.default,
|
position: tPosition = TooltipPosition.default,
|
||||||
offset = 5,
|
offset = 5,
|
||||||
interactive = false,
|
interactive = false,
|
||||||
|
smallPaddings = false,
|
||||||
className,
|
className,
|
||||||
...restProps
|
...restProps
|
||||||
}: TooltipProps,
|
}: TooltipProps,
|
||||||
@@ -264,10 +266,14 @@ export const WdTooltip = forwardRef(
|
|||||||
ref={tooltipRef}
|
ref={tooltipRef}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
classes.tooltip,
|
classes.tooltip,
|
||||||
interactive ? 'pointer-events-auto' : 'pointer-events-none',
|
'absolute px-2 py-1',
|
||||||
'absolute px-1 py-1',
|
|
||||||
'border rounded-sm border-green-300 border-opacity-10 bg-stone-900 bg-opacity-90',
|
'border rounded-sm border-green-300 border-opacity-10 bg-stone-900 bg-opacity-90',
|
||||||
pos == null && 'invisible',
|
{
|
||||||
|
'pointer-events-auto': interactive,
|
||||||
|
'pointer-events-none': !interactive,
|
||||||
|
invisible: pos == null,
|
||||||
|
'!px-1': smallPaddings,
|
||||||
|
},
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -8,13 +8,26 @@ export type WdTooltipWrapperProps = {
|
|||||||
content?: (() => ReactNode) | ReactNode;
|
content?: (() => ReactNode) | ReactNode;
|
||||||
size?: TooltipSize;
|
size?: TooltipSize;
|
||||||
interactive?: boolean;
|
interactive?: boolean;
|
||||||
|
smallPaddings?: boolean;
|
||||||
tooltipClassName?: string;
|
tooltipClassName?: string;
|
||||||
} & Omit<HTMLProps<HTMLDivElement>, 'content' | 'size'> &
|
} & Omit<HTMLProps<HTMLDivElement>, 'content' | 'size'> &
|
||||||
Omit<TooltipProps, 'content'>;
|
Omit<TooltipProps, 'content'>;
|
||||||
|
|
||||||
export const WdTooltipWrapper = forwardRef<WdTooltipHandlers, WdTooltipWrapperProps>(
|
export const WdTooltipWrapper = forwardRef<WdTooltipHandlers, WdTooltipWrapperProps>(
|
||||||
(
|
(
|
||||||
{ className, children, content, offset, position, targetSelector, interactive, size, tooltipClassName, ...props },
|
{
|
||||||
|
className,
|
||||||
|
children,
|
||||||
|
content,
|
||||||
|
offset,
|
||||||
|
position,
|
||||||
|
targetSelector,
|
||||||
|
interactive,
|
||||||
|
smallPaddings,
|
||||||
|
size,
|
||||||
|
tooltipClassName,
|
||||||
|
...props
|
||||||
|
},
|
||||||
forwardedRef,
|
forwardedRef,
|
||||||
) => {
|
) => {
|
||||||
const suffix = useMemo(() => Math.random().toString(36).slice(2, 7), []);
|
const suffix = useMemo(() => Math.random().toString(36).slice(2, 7), []);
|
||||||
@@ -31,6 +44,7 @@ export const WdTooltipWrapper = forwardRef<WdTooltipHandlers, WdTooltipWrapperPr
|
|||||||
position={position}
|
position={position}
|
||||||
content={content}
|
content={content}
|
||||||
interactive={interactive}
|
interactive={interactive}
|
||||||
|
smallPaddings={smallPaddings}
|
||||||
targetSelector={finalTargetSelector}
|
targetSelector={finalTargetSelector}
|
||||||
className={clsx(size && sizeClass(size), tooltipClassName)}
|
className={clsx(size && sizeClass(size), tooltipClassName)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export enum ConnectionType {
|
export enum ConnectionType {
|
||||||
wormhole,
|
wormhole,
|
||||||
gate,
|
gate,
|
||||||
jumpgate,
|
bridge,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MassState {
|
export enum MassState {
|
||||||
|
|||||||
Reference in New Issue
Block a user