Compare commits

...

20 Commits

Author SHA1 Message Date
CI
dee78b77a9 chore: release version v1.53.0
Some checks are pending
Build / 🚀 Deploy to test env (fly.io) (push) Waiting to run
Build / Manual Approval (push) Blocked by required conditions
Build / 🛠 Build (1.17, 18.x, 27) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/amd64) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/arm64) (push) Blocked by required conditions
Build / merge (push) Blocked by required conditions
Build / 🏷 Create Release (push) Blocked by required conditions
2025-02-26 09:58:30 +00:00
alpha02x
d21705f355 feat: Auto-set connection EOL status and ship size when linking/editing signatures (#194)
* feat: Automatically set connection EOL status and ship size type when linking/updating signatures
2025-02-26 13:33:16 +04:00
CI
9abcd4bd0b chore: release version v1.52.8 2025-02-26 08:34:52 +00:00
Dmitry Popov
b052943e34 fix(Map): Added delete systems hotkey 2025-02-26 09:22:57 +01:00
CI
e1e9b4c2e8 chore: release version v1.52.7
Some checks failed
Build / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build / Manual Approval (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2025-02-24 09:14:05 +00:00
guarzo
42c30e0741 fix: update news image link (#204) 2025-02-24 12:38:15 +04:00
Dmitry Popov
3b45e77e65 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-02-24 09:35:27 +01:00
Dmitry Popov
dcb2b6b912 fix(Map): Block map events for old client versions 2025-02-24 09:35:24 +01:00
CI
638a4e2535 chore: release version v1.52.6
Some checks are pending
Build / 🚀 Deploy to test env (fly.io) (push) Waiting to run
Build / Manual Approval (push) Blocked by required conditions
Build / 🛠 Build (1.17, 18.x, 27) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/amd64) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/arm64) (push) Blocked by required conditions
Build / merge (push) Blocked by required conditions
Build / 🏷 Create Release (push) Blocked by required conditions
2025-02-23 09:16:28 +00:00
Dmitry Popov
489fde16d1 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-02-23 10:04:09 +01:00
Dmitry Popov
35e1c363e5 fix(Map): Fixed delete systems on map changes 2025-02-23 10:04:05 +01:00
CI
6b97d36bf1 chore: release version v1.52.5
Some checks are pending
Build / 🚀 Deploy to test env (fly.io) (push) Waiting to run
Build / Manual Approval (push) Blocked by required conditions
Build / 🛠 Build (1.17, 18.x, 27) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/amd64) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/arm64) (push) Blocked by required conditions
Build / merge (push) Blocked by required conditions
Build / 🏷 Create Release (push) Blocked by required conditions
2025-02-22 08:21:41 +00:00
Dmitry Popov
82f6a7f701 fix(Map): Fixed delete system on signature deletion 2025-02-22 09:10:12 +01:00
Dmitry Popov
2d92dfbafa fix(Map): Fixed delete system on signature deletion 2025-02-22 08:39:50 +01:00
CI
f81f41f555 chore: release version v1.52.4
Some checks are pending
Build / 🚀 Deploy to test env (fly.io) (push) Waiting to run
Build / Manual Approval (push) Blocked by required conditions
Build / 🛠 Build (1.17, 18.x, 27) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/amd64) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/arm64) (push) Blocked by required conditions
Build / merge (push) Blocked by required conditions
Build / 🏷 Create Release (push) Blocked by required conditions
2025-02-21 11:33:25 +00:00
Dmitry Popov
54c7b44d69 fix: signature paste for russian lang 2025-02-21 12:25:35 +01:00
CI
9da6605ccb chore: release version v1.52.3
Some checks are pending
Build / 🚀 Deploy to test env (fly.io) (push) Waiting to run
Build / Manual Approval (push) Blocked by required conditions
Build / 🛠 Build (1.17, 18.x, 27) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/amd64) (push) Blocked by required conditions
Build / 🛠 Build Docker Images (linux/arm64) (push) Blocked by required conditions
Build / merge (push) Blocked by required conditions
Build / 🏷 Create Release (push) Blocked by required conditions
2025-02-21 07:44:16 +00:00
guarzo
a90bf9762a fix: remove signature expiration (#196) 2025-02-21 11:15:06 +04:00
CI
c87cfb3c43 chore: release version v1.52.2 2025-02-21 07:10:35 +00:00
guarzo
85cb9ccfa8 fix: prevent constant full signature widget rerender (#195) 2025-02-21 10:54:20 +04:00
22 changed files with 410 additions and 185 deletions

View File

@@ -2,6 +2,84 @@
<!-- changelog -->
## [v1.53.0](https://github.com/wanderer-industries/wanderer/compare/v1.52.8...v1.53.0) (2025-02-26)
### Features:
* Auto-set connection EOL status and ship size when linking/editing signatures (#194)
* Automatically set connection EOL status and ship size type when linking/updating signatures
## [v1.52.8](https://github.com/wanderer-industries/wanderer/compare/v1.52.7...v1.52.8) (2025-02-26)
### Bug Fixes:
* Map: Added delete systems hotkey
## [v1.52.7](https://github.com/wanderer-industries/wanderer/compare/v1.52.6...v1.52.7) (2025-02-24)
### Bug Fixes:
* update news image link (#204)
* Map: Block map events for old client versions
## [v1.52.6](https://github.com/wanderer-industries/wanderer/compare/v1.52.5...v1.52.6) (2025-02-23)
### Bug Fixes:
* Map: Fixed delete systems on map changes
## [v1.52.5](https://github.com/wanderer-industries/wanderer/compare/v1.52.4...v1.52.5) (2025-02-22)
### Bug Fixes:
* Map: Fixed delete system on signature deletion
* Map: Fixed delete system on signature deletion
## [v1.52.4](https://github.com/wanderer-industries/wanderer/compare/v1.52.3...v1.52.4) (2025-02-21)
### Bug Fixes:
* signature paste for russian lang
## [v1.52.3](https://github.com/wanderer-industries/wanderer/compare/v1.52.2...v1.52.3) (2025-02-21)
### Bug Fixes:
* remove signature expiration (#196)
## [v1.52.2](https://github.com/wanderer-industries/wanderer/compare/v1.52.1...v1.52.2) (2025-02-21)
### Bug Fixes:
* prevent constant full signature widget rerender (#195)
## [v1.52.1](https://github.com/wanderer-industries/wanderer/compare/v1.52.0...v1.52.1) (2025-02-20)

View File

@@ -2,7 +2,6 @@ import { ForwardedRef, forwardRef, MouseEvent, useCallback, useEffect, useMemo }
import ReactFlow, {
Background,
Edge,
EdgeChange,
MiniMap,
Node,
NodeChange,
@@ -79,11 +78,12 @@ const edgeTypes = {
floating: SolarSystemEdge,
};
export const MAP_ROOT_ID = 'MAP_ROOT_ID';
interface MapCompProps {
refn: ForwardedRef<MapHandlers>;
onCommand: OutCommandHandler;
onSelectionChange: OnMapSelectionChange;
onManualDelete(systems: string[]): void;
onConnectionInfoClick?(e: SolarSystemConnection): void;
onAddSystem?: OnMapAddSystemCallback;
onSelectionContextMenu?: NodeSelectionMouseHandler;
@@ -105,7 +105,6 @@ const MapComp = ({
onSystemContextMenu,
onConnectionInfoClick,
onSelectionContextMenu,
onManualDelete,
isShowMinimap,
showKSpaceBG,
isThickConnections,
@@ -114,7 +113,7 @@ const MapComp = ({
theme,
onAddSystem,
}: MapCompProps) => {
const { getNode, getNodes } = useReactFlow();
const { getNodes } = useReactFlow();
const [nodes, , onNodesChange] = useNodesState<Node<SolarSystemRawType>>(initialNodes);
const [edges, , onEdgesChange] = useEdgesState<Edge<SolarSystemConnection>>(initialEdges);
@@ -187,8 +186,6 @@ const MapComp = ({
const handleNodesChange = useCallback(
(changes: NodeChange[]) => {
const systemsIdsToRemove: string[] = [];
// prevents single node deselection on background / same node click
// allows deseletion of all nodes if multiple are currently selected
if (changes.length === 1 && changes[0].type == 'select' && changes[0].selected === false) {
@@ -196,30 +193,12 @@ const MapComp = ({
}
const nextChanges = changes.reduce((acc, change) => {
if (change.type !== 'remove') {
return [...acc, change];
}
const node = getNode(change.id);
if (!node) {
return [...acc, change];
}
if (node.data.locked) {
return acc;
}
systemsIdsToRemove.push(node.data.id);
return [...acc, change];
}, [] as NodeChange[]);
if (systemsIdsToRemove.length > 0) {
onManualDelete(systemsIdsToRemove);
}
onNodesChange(nextChanges);
},
[getNode, getNodes, onManualDelete, onNodesChange],
[getNodes, onNodesChange],
);
useEffect(() => {
@@ -232,7 +211,10 @@ const MapComp = ({
return (
<>
<div className={clsx(classes.MapRoot, { [classes.BackgroundAlternateColor]: isSoftBackground })}>
<div
data-window-id={MAP_ROOT_ID}
className={clsx(classes.MapRoot, { [classes.BackgroundAlternateColor]: isSoftBackground })}
>
<ReactFlow
nodes={nodes}
edges={edges}
@@ -276,7 +258,7 @@ const MapComp = ({
minZoom={0.2}
maxZoom={1.5}
elevateNodesOnSelect
deleteKeyCode={['Delete']}
deleteKeyCode={['']}
{...(isPanAndDrag
? {
selectionOnDrag: true,

View File

@@ -750,6 +750,14 @@ export const SHIP_SIZES_SIZE = {
[ShipSizeStatus.capital]: '2M',
};
export const SHIP_MASSES_SIZE: Record<number, ShipSizeStatus> = {
5_000_000: ShipSizeStatus.small,
62_000_000: ShipSizeStatus.medium,
375_000_000: ShipSizeStatus.large,
1_000_000_000: ShipSizeStatus.freight,
2_000_000_000: ShipSizeStatus.capital,
};
export const SHIP_SIZES_DESCRIPTION = {
[ShipSizeStatus.small]: 'Frigate wormhole - up to Destroyer | 5K t.',
[ShipSizeStatus.medium]: 'Cruise wormhole - up to Battlecruiser | 62K t.',

View File

@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from 'react';
import { Dialog } from 'primereact/dialog';
import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts';
import { SystemSignature } from '@/hooks/Mapper/types';
import { SystemSignature, TimeStatus } from '@/hooks/Mapper/types';
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
import { CommandLinkSignatureToSystem } from '@/hooks/Mapper/types';
import { SystemSignaturesContent } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignaturesContent';
@@ -12,6 +12,8 @@ import {
COSMIC_SIGNATURE,
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignatureSettingsDialog';
import { SignatureGroup } from '@/hooks/Mapper/types';
import { parseSignatureCustomInfo } from '@/hooks/Mapper/helpers/parseSignatureCustomInfo';
import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize';
interface SystemLinkSignatureDialogProps {
data: CommandLinkSignatureToSystem;
@@ -25,7 +27,10 @@ const signatureSettings: Setting[] = [
];
export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignatureDialogProps) => {
const { outCommand } = useMapRootState();
const {
outCommand,
data: { wormholes },
} = useMapRootState();
const ref = useRef({ outCommand });
ref.current = { outCommand };
@@ -35,20 +40,44 @@ export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignat
}, [setVisible]);
const handleSelect = useCallback(
(signature: SystemSignature) => {
async (signature: SystemSignature) => {
if (!signature) {
return;
}
const { outCommand } = ref.current;
outCommand({
await outCommand({
type: OutCommand.linkSignatureToSystem,
data: {
...data,
signature_eve_id: signature.eve_id,
},
});
if (parseSignatureCustomInfo(signature.custom_info).isEOL === true) {
await outCommand({
type: OutCommand.updateConnectionTimeStatus,
data: {
source: data.solar_system_source,
target: data.solar_system_target,
value: TimeStatus.eol,
},
});
}
const whShipSize = getWhSize(wormholes, signature.type);
if (whShipSize) {
await outCommand({
type: OutCommand.updateConnectionShipSizeType,
data: {
source: data.solar_system_source,
target: data.solar_system_target,
value: whShipSize,
},
});
}
setVisible(false);
},
[data, setVisible],

View File

@@ -5,12 +5,14 @@ import clsx from 'clsx';
export interface WidgetProps {
label: React.ReactNode | string;
windowId?: string;
children?: React.ReactNode;
}
export const Widget = ({ label, children }: WidgetProps) => {
export const Widget = ({ label, children, windowId }: WidgetProps) => {
return (
<div
data-window-id={windowId}
className={clsx(
classes.root,
'flex flex-col w-full h-full rounded',

View File

@@ -0,0 +1,96 @@
import React from 'react';
import { SystemView, WdCheckbox, WdImgButton, TooltipPosition } from '@/hooks/Mapper/components/ui-kit';
import { PrimeIcons } from 'primereact/api';
import { CheckboxChangeEvent } from 'primereact/checkbox';
import { InfoDrawer, LayoutEventBlocker } from '@/hooks/Mapper/components/ui-kit';
import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper';
export type HeaderProps = {
systemId: string;
isNotSelectedSystem: boolean;
sigCount: number;
isCompact: boolean;
lazyDeleteValue: boolean;
onLazyDeleteChange: (checked: boolean) => void;
pendingCount: number;
onUndoClick: () => void;
onSettingsClick: () => void;
};
function HeaderImpl({
systemId,
isNotSelectedSystem,
sigCount,
isCompact,
lazyDeleteValue,
onLazyDeleteChange,
pendingCount,
onUndoClick,
onSettingsClick,
}: HeaderProps) {
return (
<div className="flex justify-between items-center text-xs w-full h-full">
<div className="flex justify-between items-center gap-1">
{!isCompact && (
<div className="flex whitespace-nowrap text-ellipsis overflow-hidden text-stone-400">
{sigCount ? `[${sigCount}] ` : ''}Signatures {isNotSelectedSystem ? '' : 'in'}
</div>
)}
{!isNotSelectedSystem && <SystemView systemId={systemId} className="select-none text-center" hideRegion />}
</div>
<LayoutEventBlocker className="flex gap-2.5">
<WdTooltipWrapper content="Enable Lazy delete">
<WdCheckbox
size="xs"
labelSide="left"
label={isCompact ? '' : 'Lazy delete'}
value={lazyDeleteValue}
classNameLabel="text-stone-400 hover:text-stone-200 transition duration-300 whitespace-nowrap text-ellipsis overflow-hidden"
onChange={(event: CheckboxChangeEvent) => onLazyDeleteChange(!!event.checked)}
/>
</WdTooltipWrapper>
{pendingCount > 0 && (
<WdImgButton
className={PrimeIcons.UNDO}
style={{ color: 'red' }}
tooltip={{ content: `Undo pending changes (${pendingCount})` }}
onClick={onUndoClick}
/>
)}
<WdImgButton
className={PrimeIcons.QUESTION_CIRCLE}
tooltip={{
position: TooltipPosition.left,
content: (
<div className="flex flex-col gap-1">
<InfoDrawer title={<b className="text-slate-50">How to add/update signature?</b>}>
In game you need to select one or more signatures <br /> in the list in{' '}
<b className="text-sky-500">Probe scanner</b>. <br /> Use next hotkeys:
<br />
<b className="text-sky-500">Shift + LMB</b> or <b className="text-sky-500">Ctrl + LMB</b>
<br /> or <b className="text-sky-500">Ctrl + A</b> for select all
<br /> and then use <b className="text-sky-500">Ctrl + C</b>, after you need to go <br />
here, select Solar system and paste it with <b className="text-sky-500">Ctrl + V</b>
</InfoDrawer>
<InfoDrawer title={<b className="text-slate-50">How to select?</b>}>
For selecting any signature, click on it <br /> with hotkeys{' '}
<b className="text-sky-500">Shift + LMB</b> or <b className="text-sky-500">Ctrl + LMB</b>
</InfoDrawer>
<InfoDrawer title={<b className="text-slate-50">How to delete?</b>}>
To delete any signature, first select it <br /> and then press <b className="text-sky-500">Del</b>
</InfoDrawer>
</div>
),
}}
/>
<WdImgButton className={PrimeIcons.SLIDERS_H} onClick={onSettingsClick} />
</LayoutEventBlocker>
</div>
);
}
export const SystemSignaturesHeader = React.memo(HeaderImpl);

View File

@@ -1,13 +1,5 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { Widget } from '@/hooks/Mapper/components/mapInterface/components';
import {
InfoDrawer,
LayoutEventBlocker,
SystemView,
TooltipPosition,
WdCheckbox,
WdImgButton,
} from '@/hooks/Mapper/components/ui-kit';
import { SystemSignaturesContent } from './SystemSignaturesContent';
import {
COSMIC_ANOMALY,
@@ -21,15 +13,14 @@ import {
SystemSignatureSettingsDialog,
} from './SystemSignatureSettingsDialog';
import { SignatureGroup, SystemSignature } from '@/hooks/Mapper/types';
import { PrimeIcons } from 'primereact/api';
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
import { CheckboxChangeEvent } from 'primereact/checkbox';
import useMaxWidth from '@/hooks/Mapper/hooks/useMaxWidth';
import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper';
import { useHotkey } from '@/hooks/Mapper/hooks';
import { COMPACT_MAX_WIDTH } from './constants';
import { renderHeaderLabel } from './renders';
const SIGNATURE_SETTINGS_KEY = 'wanderer_system_signature_settings_v5_5';
export const SIGNATURE_WINDOW_ID = 'system_signatures_window';
export const SHOW_DESCRIPTION_COLUMN_SETTING = 'show_description_column_setting';
export const SHOW_UPDATED_COLUMN_SETTING = 'SHOW_UPDATED_COLUMN_SETTING';
export const SHOW_CHARACTER_COLUMN_SETTING = 'SHOW_CHARACTER_COLUMN_SETTING';
@@ -58,7 +49,9 @@ const SETTINGS: Setting[] = [
{ key: SignatureGroup.CombatSite, name: 'Show Combat Sites', value: true, isFilter: true },
];
const getDefaultSettings = (): Setting[] => [...SETTINGS];
function getDefaultSettings(): Setting[] {
return [...SETTINGS];
}
export const SystemSignatures: React.FC = () => {
const {
@@ -85,7 +78,8 @@ export const SystemSignatures: React.FC = () => {
const [sigCount, setSigCount] = useState<number>(0);
const [pendingSigs, setPendingSigs] = useState<SystemSignature[]>([]);
const [undoPending, setUndoPending] = useState<() => void>(() => () => {});
const undoPendingFnRef = useRef<() => void>(() => {});
const handleSigCountChange = useCallback((count: number) => {
setSigCount(count);
@@ -113,86 +107,53 @@ export const SystemSignatures: React.FC = () => {
const containerRef = useRef<HTMLDivElement>(null);
const isCompact = useMaxWidth(containerRef, COMPACT_MAX_WIDTH);
useHotkey(true, ['z'], (event: KeyboardEvent) => {
useHotkey(true, ['z'], event => {
if (pendingSigs.length > 0) {
event.preventDefault();
event.stopPropagation();
undoPending();
undoPendingFnRef.current();
setPendingSigs([]);
}
});
const handleUndoClick = useCallback(() => {
undoPending();
undoPendingFnRef.current();
setPendingSigs([]);
}, [undoPending]);
}, []);
const handleSettingsButtonClick = useCallback(() => {
setVisible(true);
}, []);
const renderLabel = () => (
<div className="flex justify-between items-center text-xs w-full h-full" ref={containerRef}>
<div className="flex justify-between items-center gap-1">
{!isCompact && (
<div className="flex whitespace-nowrap text-ellipsis overflow-hidden text-stone-400">
{sigCount ? `[${sigCount}] ` : ''}Signatures {isNotSelectedSystem ? '' : 'in'}
</div>
)}
{!isNotSelectedSystem && <SystemView systemId={systemId} className="select-none text-center" hideRegion />}
</div>
<LayoutEventBlocker className="flex gap-2.5">
<WdTooltipWrapper content="Enable Lazy delete">
<WdCheckbox
size="xs"
labelSide="left"
label={isCompact ? '' : 'Lazy delete'}
value={lazyDeleteValue}
classNameLabel="text-stone-400 hover:text-stone-200 transition duration-300 whitespace-nowrap text-ellipsis overflow-hidden"
onChange={(event: CheckboxChangeEvent) => handleLazyDeleteChange(!!event.checked)}
/>
</WdTooltipWrapper>
{pendingSigs.length > 0 && (
<WdImgButton
className={PrimeIcons.UNDO}
style={{ color: 'red' }}
tooltip={{ content: `Undo pending changes (${pendingSigs.length})` }}
onClick={handleUndoClick}
/>
)}
<WdImgButton
className={PrimeIcons.QUESTION_CIRCLE}
tooltip={{
position: TooltipPosition.left,
content: (
<div className="flex flex-col gap-1">
<InfoDrawer title={<b className="text-slate-50">How to add/update signature?</b>}>
In game you need to select one or more signatures <br /> in the list in{' '}
<b className="text-sky-500">Probe scanner</b>. <br /> Use next hotkeys:
<br />
<b className="text-sky-500">Shift + LMB</b> or <b className="text-sky-500">Ctrl + LMB</b>
<br /> or <b className="text-sky-500">Ctrl + A</b> for select all
<br /> and then use <b className="text-sky-500">Ctrl + C</b>, after you need to go <br />
here, select Solar system and paste it with <b className="text-sky-500">Ctrl + V</b>
</InfoDrawer>
<InfoDrawer title={<b className="text-slate-50">How to select?</b>}>
For selecting any signature, click on it <br /> with hotkeys{' '}
<b className="text-sky-500">Shift + LMB</b> or <b className="text-sky-500">Ctrl + LMB</b>
</InfoDrawer>
<InfoDrawer title={<b className="text-slate-50">How to delete?</b>}>
To delete any signature, first select it <br /> and then press <b className="text-sky-500">Del</b>
</InfoDrawer>
</div>
) as React.ReactNode,
}}
/>
<WdImgButton className={PrimeIcons.SLIDERS_H} onClick={handleSettingsButtonClick} />
</LayoutEventBlocker>
</div>
);
const handlePendingChange = useCallback((newPending: SystemSignature[], newUndo: () => void) => {
setPendingSigs(prev => {
if (newPending.length === prev.length && newPending.every(np => prev.some(pp => pp.eve_id === np.eve_id))) {
return prev;
}
return newPending;
});
undoPendingFnRef.current = newUndo;
}, []);
return (
<Widget label={renderLabel()}>
<Widget
label={
<div ref={containerRef} className="w-full">
{renderHeaderLabel({
systemId,
isNotSelectedSystem,
isCompact,
sigCount,
lazyDeleteValue,
pendingCount: pendingSigs.length,
onLazyDeleteChange: handleLazyDeleteChange,
onUndoClick: handleUndoClick,
onSettingsClick: handleSettingsButtonClick,
})}
</div>
}
windowId={SIGNATURE_WINDOW_ID}
>
{isNotSelectedSystem ? (
<div className="w-full h-full flex justify-center items-center select-none text-center text-stone-400/80 text-sm">
System is not selected
@@ -203,10 +164,7 @@ export const SystemSignatures: React.FC = () => {
settings={currentSettings}
onLazyDeleteChange={handleLazyDeleteChange}
onCountChange={handleSigCountChange}
onPendingChange={(pending, undo) => {
setPendingSigs(pending);
setUndoPending(() => undo);
}}
onPendingChange={handlePendingChange}
/>
)}
{visible && (

View File

@@ -13,14 +13,15 @@ import {
GROUPS_LIST,
MEDIUM_MAX_WIDTH,
OTHER_COLUMNS_WIDTH,
getGroupIdByRawGroup,
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/constants';
import {
KEEP_LAZY_DELETE_SETTING,
LAZY_DELETE_SIGNATURES_SETTING,
SHOW_DESCRIPTION_COLUMN_SETTING,
SHOW_UPDATED_COLUMN_SETTING,
SHOW_CHARACTER_COLUMN_SETTING,
SIGNATURE_WINDOW_ID,
} from '../SystemSignatures';
import { COSMIC_SIGNATURE } from '../SystemSignatureSettingsDialog';
import {
renderAddedTimeLeft,
@@ -89,9 +90,6 @@ export function SystemSignaturesContent({
const isCompact = useMaxWidth(tableRef, COMPACT_MAX_WIDTH);
const isMedium = useMaxWidth(tableRef, MEDIUM_MAX_WIDTH);
const lazyDeleteEnabled = settings.find(s => s.key === LAZY_DELETE_SIGNATURES_SETTING)?.value ?? false;
const keepLazyDeleteEnabled = settings.find(s => s.key === KEEP_LAZY_DELETE_SETTING)?.value ?? false;
const { clipboardContent, setClipboardContent } = useClipboard();
useEffect(() => {
if (selectable) return;
@@ -99,22 +97,21 @@ export function SystemSignaturesContent({
handlePaste(clipboardContent.text);
if (lazyDeleteEnabled && !keepLazyDeleteEnabled) {
onLazyDeleteChange?.(false);
}
setClipboardContent(null);
}, [
selectable,
clipboardContent,
handlePaste,
setClipboardContent,
lazyDeleteEnabled,
keepLazyDeleteEnabled,
onLazyDeleteChange,
]);
}, [selectable, clipboardContent]);
useHotkey(true, ['a'], handleSelectAll);
useHotkey(false, ['Backspace', 'Delete'], handleDeleteSelected);
useHotkey(false, ['Backspace', 'Delete'], (event: KeyboardEvent) => {
const targetWindow = (event.target as HTMLHtmlElement)?.closest(`[data-window-id="${SIGNATURE_WINDOW_ID}"]`);
if (!targetWindow) {
return;
}
event.preventDefault();
event.stopPropagation();
handleDeleteSelected();
});
const [nameColumnWidth, setNameColumnWidth] = useState('auto');
const handleResize = useCallback(() => {
@@ -165,11 +162,14 @@ export function SystemSignaturesContent({
if (hideLinkedSignatures && sig.linked_system) {
return false;
}
if (sig.kind === COSMIC_SIGNATURE) {
const isCosmicSignature = sig.kind === COSMIC_SIGNATURE;
if (isCosmicSignature) {
const showCosmic = settings.find(y => y.key === COSMIC_SIGNATURE)?.value;
if (!showCosmic) return false;
if (sig.group) {
return enabledGroups.includes(sig.group);
const preparedGroup = getGroupIdByRawGroup(sig.group);
return enabledGroups.includes(preparedGroup);
}
return true;
} else {

View File

@@ -13,8 +13,6 @@ import { useSignatureFetching } from './useSignatureFetching';
import { usePendingAdditions } from './usePendingAdditions';
import { usePendingDeletions } from './usePendingDeletions';
import { UseSystemSignaturesDataProps } from './types';
import { TIME_ONE_DAY, TIME_ONE_WEEK } from '../constants';
import { SignatureGroup } from '@/hooks/Mapper/types';
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
export function useSystemSignaturesData({
@@ -159,21 +157,6 @@ export function useSystemSignaturesData({
onPendingChange?.(combined, undoPending);
}, [localPendingDeletions, pendingUndoAdditions, onPendingChange, undoPending]);
useEffect(() => {
if (!systemId) return;
const now = Date.now();
const oldOnes = signaturesRef.current.filter(sig => {
if (!sig.inserted_at) return false;
const inserted = new Date(sig.inserted_at).getTime();
const threshold = sig.group === SignatureGroup.Wormhole ? TIME_ONE_DAY : TIME_ONE_WEEK;
return now - inserted > threshold;
});
if (oldOnes.length) {
const remain = signaturesRef.current.filter(x => !oldOnes.includes(x));
handleUpdateSignatures(remain, false, true);
}
}, [systemId, handleUpdateSignatures, signaturesRef]);
useMapEventListener(event => {
if (event.name === Commands.signaturesUpdated && String(event.data) === String(systemId)) {
handleGetSignatures();

View File

@@ -5,3 +5,4 @@ export * from './renderAddedTimeLeft';
export * from './renderUpdatedTimeLeft';
export * from './renderLinkedSystem';
export * from './renderInfoColumn';
export * from './renderHeaderLabel';

View File

@@ -0,0 +1,5 @@
import { SystemSignaturesHeader, HeaderProps } from '../SystemSignatureHeader/SystemSignatureHeader';
export function renderHeaderLabel(props: HeaderProps) {
return <SystemSignaturesHeader {...props} />;
}

View File

@@ -1,6 +1,6 @@
import { Dialog } from 'primereact/dialog';
import { useCallback, useEffect } from 'react';
import { OutCommand, SignatureGroup, SystemSignature } from '@/hooks/Mapper/types';
import { OutCommand, SignatureGroup, SystemSignature, TimeStatus } from '@/hooks/Mapper/types';
import { Controller, FormProvider, useForm } from 'react-hook-form';
import {
SignatureGroupContent,
@@ -10,6 +10,7 @@ import { InputText } from 'primereact/inputtext';
import { SystemsSettingsProvider } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/Provider.tsx';
import { Button } from 'primereact/button';
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize';
type SystemSignaturePrepared = Omit<SystemSignature, 'linked_system'> & { linked_system: string };
@@ -21,7 +22,10 @@ export interface MapSettingsProps {
}
export const SignatureSettings = ({ systemId, show, onHide, signatureData }: MapSettingsProps) => {
const { outCommand } = useMapRootState();
const {
outCommand,
data: { wormholes },
} = useMapRootState();
const handleShow = async () => {};
const signatureForm = useForm<Partial<SystemSignaturePrepared>>({});
@@ -47,6 +51,31 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
solar_system_target: values.linked_system,
},
});
if (values.isEOL) {
await outCommand({
type: OutCommand.updateConnectionTimeStatus,
data: {
source: systemId,
target: values.linked_system,
value: TimeStatus.eol,
},
});
}
if (values.type) {
const whShipSize = getWhSize(wormholes, values.type);
if (whShipSize) {
outCommand({
type: OutCommand.updateConnectionShipSizeType,
data: {
source: systemId,
target: values.linked_system,
value: whShipSize,
},
});
}
}
}
out = {

View File

@@ -1,4 +1,4 @@
import { Map } from '@/hooks/Mapper/components/map/Map.tsx';
import { Map, MAP_ROOT_ID } from '@/hooks/Mapper/components/map/Map.tsx';
import { useCallback, useRef, useState } from 'react';
import { OutCommand, OutCommandHandler, SolarSystemConnection } from '@/hooks/Mapper/types';
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
@@ -15,7 +15,7 @@ import { Connections } from '@/hooks/Mapper/components/mapRootContent/components
import { ContextMenuSystemMultiple, useContextMenuSystemMultipleHandlers } from '../contexts/ContextMenuSystemMultiple';
import { getSystemById } from '@/hooks/Mapper/helpers';
import { Commands } from '@/hooks/Mapper/types/mapHandlers.ts';
import { Node, XYPosition } from 'reactflow';
import { Node, useReactFlow, XYPosition } from 'reactflow';
import { useCommandsSystems } from '@/hooks/Mapper/mapRootProvider/hooks/api';
import { emitMapEvent, useMapEventListener } from '@/hooks/Mapper/events';
@@ -27,6 +27,7 @@ import {
AddSystemDialog,
SearchOnSubmitCallback,
} from '@/hooks/Mapper/components/mapInterface/components/AddSystemDialog';
import { useHotkey } from '../../hooks/useHotkey';
// TODO: INFO - this component needs for abstract work with Map instance
export const MapWrapper = () => {
@@ -46,6 +47,7 @@ export const MapWrapper = () => {
} = useMapRootState();
const { deleteSystems } = useDeleteSystems();
const { mapRef, runCommand } = useCommonMapEventProcessor();
const { getNodes } = useReactFlow();
const { updateLinkSignatureToSystem } = useCommandsSystems();
const { open, ...systemContextProps } = useContextMenuSystemHandlers({ systems, hubs, outCommand });
@@ -114,12 +116,14 @@ export const MapWrapper = () => {
const handleConnectionDbClick = useCallback((e: SolarSystemConnection) => setSelectedConnection(e), []);
const handleManualDelete = useCallback((toDelete: string[]) => {
const restDel = toDelete.filter(x => ref.current.systems.some(y => y.id === x));
const handleDeleteSelected = useCallback(() => {
const restDel = getNodes()
.filter(x => x.selected && !x.data.locked)
.map(x => x.data.id);
if (restDel.length > 0) {
ref.current.deleteSystems(restDel);
}
}, []);
}, [getNodes]);
const onAddSystem: OnMapAddSystemCallback = useCallback(({ coordinates }) => {
setOpenAddSystem(coordinates);
@@ -143,6 +147,18 @@ export const MapWrapper = () => {
[openAddSystem, outCommand],
);
useHotkey(false, ['Delete'], (event: KeyboardEvent) => {
const targetWindow = (event.target as HTMLHtmlElement)?.closest(`[data-window-id="${MAP_ROOT_ID}"]`);
if (!targetWindow) {
return;
}
event.preventDefault();
event.stopPropagation();
handleDeleteSelected();
});
return (
<>
<Map
@@ -155,7 +171,6 @@ export const MapWrapper = () => {
minimapClasses={!isShowMenu ? classes.MiniMap : undefined}
isShowMinimap={isShowMinimap}
showKSpaceBG={isShowKSpace}
onManualDelete={handleManualDelete}
isThickConnections={isThickConnections}
isShowBackgroundPattern={isShowBackgroundPattern}
isSoftBackground={isSoftBackground}

View File

@@ -0,0 +1,13 @@
import { SHIP_MASSES_SIZE } from '../components/map/constants';
import { ShipSizeStatus } from '../types/connection';
import { WormholeDataRaw } from '../types/wormholes';
export const getWhSize = (whDatas: WormholeDataRaw[], whType: string): ShipSizeStatus | null => {
if (whType === 'K162' || whType == null) return null;
const wormholeData = whDatas.find(wh => wh.name === whType);
if (!wormholeData?.max_mass_per_jump) return null;
return SHIP_MASSES_SIZE[wormholeData.max_mass_per_jump] ?? ShipSizeStatus.large;
};

View File

@@ -16,13 +16,15 @@ export const parseSignatures = (value: string, availableKeys: string[]): SystemS
const kind = MAPPING_TYPE_TO_ENG[sigArrInfo[1] as SignatureKind];
outArr.push({
const signature: SystemSignature = {
eve_id: sigArrInfo[0],
kind: availableKeys.includes(kind) ? kind : SignatureKind.CosmicSignature,
group: sigArrInfo[2] as SignatureGroup,
name: sigArrInfo[3],
type: '',
});
};
outArr.push(signature);
}
return outArr;

View File

@@ -1,6 +1,9 @@
import { createRoot } from 'react-dom/client';
import Mapper from './MapRoot';
const LAST_VERSION_KEY = 'wandererLastVersion';
const UI_LOADED_EVENT = 'ui_loaded';
export default {
_rootEl: null,
_errorCount: 0,
@@ -8,7 +11,7 @@ export default {
mounted() {
// create react root element
const rootEl = document.getElementById(this.el.id);
this._version = this.el.dataset.version;
const activeVersion = localStorage.getItem(LAST_VERSION_KEY);
this._rootEl = createRoot(rootEl!);
const handleError = (error: Error, componentStack: string) => {
@@ -22,7 +25,7 @@ export default {
onError: handleError,
});
this.pushEvent('ui_loaded');
this.pushEvent(UI_LOADED_EVENT, { version: activeVersion });
},
handleEventWrapper(event: string, handler: (payload: any) => void) {
@@ -32,7 +35,8 @@ export default {
},
reconnected() {
this.pushEvent('ui_loaded');
const activeVersion = localStorage.getItem(LAST_VERSION_KEY);
this.pushEvent(UI_LOADED_EVENT, { version: activeVersion });
},
async pushEventAsync(event: string, payload: any) {

View File

@@ -1,4 +1,4 @@
import { CharacterTypeRaw, SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
export enum SignatureGroup {
CosmicSignature = 'Cosmic Signature',
@@ -33,7 +33,7 @@ export type SignatureCustomInfo = {
export type SystemSignature = {
eve_id: string;
character_eve_id: string;
character_eve_id?: string;
character_name?: string;
kind: SignatureKind;
name: string;

View File

@@ -128,18 +128,26 @@ defmodule WandererAppWeb.MapCoreEventHandler do
socket
end
def handle_ui_event("ui_loaded", _body, %{assigns: %{map_slug: map_slug} = assigns} = socket) do
assigns
|> Map.get(:map_id)
|> case do
map_id when not is_nil(map_id) ->
maybe_start_map(map_id)
def handle_ui_event(
"ui_loaded",
%{"version" => version},
%{assigns: %{map_slug: map_slug, app_version: app_version} = assigns} = socket
) do
is_version_valid? = to_string(version) == to_string(app_version)
_ ->
WandererApp.Cache.insert("map_#{map_slug}:ui_loaded", true)
if is_version_valid? do
assigns
|> Map.get(:map_id)
|> case do
map_id when not is_nil(map_id) ->
maybe_start_map(map_id)
_ ->
WandererApp.Cache.insert("map_#{map_slug}:ui_loaded", true)
end
end
{:noreply, socket}
{:noreply, socket |> assign(:is_version_valid?, is_version_valid?)}
end
def handle_ui_event(

View File

@@ -257,13 +257,23 @@ defmodule WandererAppWeb.MapEventHandler do
end
end
def push_map_event(socket, type, body),
do:
socket
|> Phoenix.LiveView.Utils.push_event("map_event", %{
type: type,
body: body
})
def push_map_event(
%{
assigns: %{
is_version_valid?: true
}
} = socket,
type,
body
),
do:
socket
|> Phoenix.LiveView.Utils.push_event("map_event", %{
type: type,
body: body
})
def push_map_event(socket, _type, _body), do: socket
def map_ui_character_stat(character),
do:

View File

@@ -28,7 +28,8 @@ defmodule WandererAppWeb.MapsLive do
map_subscriptions_enabled?: WandererApp.Env.map_subscriptions_enabled?(),
restrict_maps_creation?: WandererApp.Env.restrict_maps_creation?(),
acls: [],
location: nil
location: nil,
is_version_valid?: false
)
|> assign_async(:maps, fn ->
_load_maps(current_user)
@@ -43,7 +44,8 @@ defmodule WandererAppWeb.MapsLive do
maps: [],
characters: [],
location: nil,
map_subscriptions: []
map_subscriptions: [],
is_version_valid?: false
)}
end

View File

@@ -3,7 +3,7 @@ defmodule WandererApp.MixProject do
@source_url "https://github.com/wanderer-industries/wanderer"
@version "1.52.1"
@version "1.53.0"
def project do
[

View File

@@ -1,7 +1,7 @@
%{
title: "User Guide: Characters & ACL API Endpoints",
author: "Wanderer Team",
cover_image_uri: "/images/news/02-20-acl-api/generate-key.png",
cover_image_uri: "/images/news/02-20-acl-api/generate-acl-key.png",
tags: ~w(acl characters guide interface),
description: "Learn how to retrieve and manage Access Lists and Characters through the Wanderer public APIs. This guide covers available endpoints, request examples, and sample responses."
}