Compare commits

...

18 Commits

Author SHA1 Message Date
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
CI
da2639786d chore: release version v1.52.1
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-20 07:57:18 +00:00
guarzo
3cf77da293 fix: proper virtual scroller usage (#192) 2025-02-20 11:20:43 +04:00
guarzo
3dd7633194 fix: restore delete key functionality for nodes (#191) 2025-02-20 11:19:20 +04:00
CI
ae7f4edf4a chore: release version v1.52.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-19 20:24:25 +00:00
Dmitry Popov
52eab28f27 feat(Map): Added map characters view 2025-02-19 21:12:51 +01:00
Dmitry Popov
6098d32bce chore: release version v1.51.3 2025-02-19 17:48:13 +01:00
22 changed files with 565 additions and 184 deletions

View File

@@ -2,6 +2,73 @@
<!-- changelog -->
## [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)
### Bug Fixes:
* proper virtual scroller usage (#192)
* restore delete key functionality for nodes (#191)
## [v1.52.0](https://github.com/wanderer-industries/wanderer/compare/v1.51.3...v1.52.0) (2025-02-19)
### Features:
* Map: Added map characters view
## [v1.51.3](https://github.com/wanderer-industries/wanderer/compare/v1.51.2...v1.51.3) (2025-02-19)

View File

@@ -187,7 +187,7 @@ const MapComp = ({
const handleNodesChange = useCallback(
(changes: NodeChange[]) => {
const systemsIdsToRemove: string[] = [];
// const systemsIdsToRemove: string[] = [];
// prevents single node deselection on background / same node click
// allows deseletion of all nodes if multiple are currently selected
@@ -196,26 +196,27 @@ 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];
// if (change.type !== 'remove') {
// }
// 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);
}
// if (systemsIdsToRemove.length > 0) {
// onManualDelete(systemsIdsToRemove);
// }
onNodesChange(nextChanges);
},
@@ -276,7 +277,7 @@ const MapComp = ({
minZoom={0.2}
maxZoom={1.5}
elevateNodesOnSelect
deleteKeyCode={['Delete']}
deleteKeyCode={['']}
{...(isPanAndDrag
? {
selectionOnDrag: true,

View File

@@ -37,7 +37,7 @@ const INITIAL_DATA: MapData = {
userPermissions: {},
systemSignatures: {} as Record<string, SystemSignature[]>,
options: {} as Record<string, string | boolean>,
is_subscription_active: false,
isSubscriptionActive: false,
};
export interface MapContextProps {

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

@@ -1,4 +1,4 @@
import React, { useMemo, useRef, useEffect, useState } from 'react';
import React, { useMemo } from 'react';
import clsx from 'clsx';
import { DetailedKill } from '@/hooks/Mapper/types/kills';
import { VirtualScroller } from 'primereact/virtualscroller';
@@ -6,7 +6,6 @@ import { useSystemKillsItemTemplate } from '../hooks/useSystemKillsItemTemplate'
import classes from './SystemKillsContent.module.scss';
export const ITEM_HEIGHT = 35;
export const CONTENT_MARGINS = 5;
export interface SystemKillsContentProps {
kills: DetailedKill[];
@@ -39,45 +38,21 @@ export const SystemKillsContent: React.FC<SystemKillsContentProps> = ({
}
}, [kills, timeRange, limit]);
const computedHeight = autoSize ? Math.max(processedKills.length, 1) * ITEM_HEIGHT + CONTENT_MARGINS : undefined;
const containerRef = useRef<HTMLDivElement>(null);
const scrollerRef = useRef<VirtualScroller | null>(null);
const [containerHeight, setContainerHeight] = useState<number>(0);
useEffect(() => {
if (!autoSize && containerRef.current) {
const measure = () => {
const newHeight = containerRef.current?.clientHeight || 0;
setContainerHeight(newHeight);
};
measure();
const observer = new ResizeObserver(measure);
observer.observe(containerRef.current);
window.addEventListener('resize', measure);
return () => {
observer.disconnect();
window.removeEventListener('resize', measure);
};
}
}, [autoSize]);
const computedHeight = autoSize ? Math.max(processedKills.length, 1) * ITEM_HEIGHT : undefined;
const scrollerHeight = autoSize ? `${computedHeight}px` : '100%';
const itemTemplate = useSystemKillsItemTemplate(systemNameMap, onlyOneSystem);
const scrollerHeight = autoSize ? `${computedHeight}px` : containerHeight ? `${containerHeight}px` : '100%';
return (
<div ref={autoSize ? undefined : containerRef} className={clsx('w-full h-full', classes.wrapper)}>
<div className={clsx('w-full h-full', classes.wrapper)}>
<VirtualScroller
ref={autoSize ? undefined : scrollerRef}
items={processedKills}
itemSize={ITEM_HEIGHT}
itemTemplate={itemTemplate}
autoSize={autoSize}
scrollWidth="100%"
style={{ height: scrollerHeight }}
className={clsx('w-full h-full custom-scrollbar select-none overflow-x-hidden overflow-y-auto', {
className={clsx('w-full h-full custom-scrollbar select-none', {
[classes.VirtualScroller]: !autoSize,
})}
pt={{
@@ -89,3 +64,5 @@ export const SystemKillsContent: React.FC<SystemKillsContentProps> = ({
</div>
);
};
export default SystemKillsContent;

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,17 @@ 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'], (event: KeyboardEvent) => {
const targetWindow = (event.target as HTMLHtmlElement)?.closest(`[data-window-id="${SIGNATURE_WINDOW_ID}"]`);
if (!targetWindow) {
return;
}
event.preventDefault();
event.stopPropagation();
handleDeleteSelected();
@@ -169,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

@@ -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

@@ -66,6 +66,7 @@ export type CommandInit = {
routes: RoutesList;
options: Record<string, string | boolean>;
reset?: boolean;
is_subscription_active?: boolean;
};
export type CommandAddSystems = SolarSystemRawType[];
export type CommandUpdateSystems = SolarSystemRawType[];

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

@@ -0,0 +1,84 @@
defmodule WandererAppWeb.MapCharacters do
use WandererAppWeb, :live_component
use LiveViewEvents
@impl true
def mount(socket) do
{:ok, socket}
end
@impl true
def update(
assigns,
socket
) do
{:ok,
socket
|> handle_info_or_assign(assigns)}
end
# attr(:groups, :any, required: true)
# attr(:character_settings, :any, required: true)
def render(assigns) do
~H"""
<div id={@id}>
<ul :for={group <- @groups} class="space-y-4 border-t border-b border-gray-200 py-4">
<li :for={character <- group.characters}>
<div class="flex items-center justify-between w-full space-x-2 p-1 hover:bg-gray-900">
<.character_entry character={character} character_settings={@character_settings} />
<button
phx-click="untrack"
phx-value-event-data={character.id}
class="btn btn-sm btn-icon"
>
<.icon name="hero-eye-slash" class="h-5 w-5" /> Untrack
</button>
</div>
</li>
</ul>
</div>
"""
end
attr(:character, :any, required: true)
attr(:character_settings, :any, required: true)
defp character_entry(assigns) do
~H"""
<div class="flex items-center gap-3 text-sm w-[450px]">
<span
:if={is_tracked?(@character.id, @character_settings)}
class="text-green-500 rounded-full px-2 py-1"
>
Tracked
</span>
<div class="avatar">
<div class="rounded-md w-8 h-8">
<img src={member_icon_url(@character.eve_id)} alt={@character.name} />
</div>
</div>
<span><%= @character.name %></span>
<span :if={@character.alliance_ticker}>[<%= @character.alliance_ticker %>]</span>
<span :if={@character.corporation_ticker}>[<%= @character.corporation_ticker %>]</span>
</div>
"""
end
@impl true
def handle_event("undo", %{"event-data" => event_data} = _params, socket) do
# notify_to(socket.assigns.notify_to, socket.assigns.event_name, map_slug)
{:noreply, socket}
end
defp is_tracked?(character_id, character_settings) do
Enum.any?(character_settings, fn setting ->
setting.character_id == character_id && setting.tracked
end)
end
defp get_event_name(name), do: name
defp get_event_data(_name, data), do: Jason.encode!(data)
end

View File

@@ -0,0 +1,151 @@
defmodule WandererAppWeb.MapCharactersLive do
use WandererAppWeb, :live_view
require Logger
alias WandererAppWeb.MapCharacters
def mount(
%{"slug" => map_slug} = _params,
_session,
%{assigns: %{current_user: current_user}} = socket
) do
WandererApp.Maps.check_user_can_delete_map(map_slug, current_user)
|> case do
{:ok,
%{
id: map_id,
name: map_name
} = _map} ->
{:ok,
socket
|> assign(
map_id: map_id,
map_name: map_name,
map_slug: map_slug
)
|> assign(:groups, [])}
_ ->
{:ok,
socket
|> put_flash(:error, "You don't have an access.")
|> push_navigate(to: ~p"/maps")}
end
end
@impl true
def mount(_params, _session, socket) do
{:ok, socket |> assign(user_id: nil)}
end
@impl true
def handle_params(params, _url, socket) do
{:noreply, apply_action(socket, socket.assigns.live_action, params)}
end
@impl true
def handle_info(
_event,
socket
) do
{:noreply, socket}
end
def handle_event(
"untrack",
%{"event-data" => character_id},
%{
assigns: %{
map_id: map_id,
current_user: _current_user,
character_settings: character_settings
}
} = socket
) do
socket =
character_settings
|> Enum.find(&(&1.character_id == character_id))
|> case do
nil ->
socket
character_setting ->
case character_setting.tracked do
true ->
{:ok, map_character_settings} =
character_setting
|> WandererApp.MapCharacterSettingsRepo.untrack()
WandererApp.Map.Server.remove_character(map_id, map_character_settings.character_id)
socket |> put_flash(:info, "Character untracked!") |> load_characters()
_ ->
socket
end
end
{:noreply, socket}
end
@impl true
def handle_event("noop", _, socket) do
{:noreply, socket}
end
@impl true
def handle_event(event, body, socket) do
Logger.warning(fn -> "unhandled event: #{event} #{inspect(body)}" end)
{:noreply, socket}
end
defp apply_action(socket, :index, _params) do
socket
|> assign(:active_page, :map_characters)
|> assign(:page_title, "Map - Characters")
|> load_characters()
end
defp load_characters(%{assigns: %{map_id: map_id}} = socket) do
map_characters =
map_id
|> WandererApp.Map.list_characters()
|> Enum.map(&map_ui_character/1)
groups =
map_characters
|> Enum.group_by(& &1.user_id)
|> Enum.reduce([], fn {user_id, values}, acc ->
acc ++ [%{id: user_id, characters: values}]
end)
{:ok, character_settings} =
case WandererApp.MapCharacterSettingsRepo.get_all_by_map(map_id) do
{:ok, settings} -> {:ok, settings}
_ -> {:ok, []}
end
socket
|> assign(:character_settings, character_settings)
|> assign(:characters_count, map_characters |> length())
|> assign(:groups, groups)
end
defp map_ui_character(character),
do:
character
|> Map.take([
:id,
:user_id,
:eve_id,
:name,
:online,
:corporation_id,
:corporation_name,
:corporation_ticker,
:alliance_id,
:alliance_name,
:alliance_ticker
])
end

View File

@@ -0,0 +1,23 @@
<nav class="fixed top-0 z-100 px-6 pl-20 flex items-center justify-between w-full h-12 pointer-events-auto border-b border-stone-800 bg-opacity-70 bg-neutral-900">
<span className="w-full font-medium text-sm">
<.link navigate={~p"/#{@map_slug}"} class="text-neutral-100">
<%= @map_name %>
</.link>
- Characters [<%= @characters_count %>]
</span>
</nav>
<main
id="map-character-list"
class="pt-20 w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 pb-20 overflow-auto"
>
<div class="flex flex-col gap-4 w-full">
<.live_component
module={MapCharacters}
id="map-characters"
notify_to={self()}
groups={@groups}
character_settings={@character_settings}
event_name="character_event"
/>
</div>
</main>

View File

@@ -29,6 +29,15 @@
>
<.icon name="hero-key-solid" class="w-6 h-6" />
</.link>
<.link
:if={(@user_permissions || %{}) |> Map.get(:delete_map, false)}
id={"map-characters-#{@map_slug}"}
class="h-8 w-8 hover:text-white"
navigate={~p"/#{@map_slug}/characters"}
>
<.icon name="hero-user-group-solid" class="w-6 h-6" />
</.link>
</div>
<.modal

View File

@@ -323,11 +323,17 @@ defmodule WandererAppWeb.MapsLive do
|> push_patch(to: ~p"/maps/#{slug}/edit")}
end
def handle_event("open_audit", %{"data" => slug}, socket) do
{:noreply,
socket
|> push_navigate(to: ~p"/#{slug}/audit?period=1H&activity=all")}
end
def handle_event("open_audit", %{"data" => slug}, socket),
do:
{:noreply,
socket
|> push_navigate(to: ~p"/#{slug}/audit?period=1H&activity=all")}
def handle_event("open_characters", %{"data" => slug}, socket),
do:
{:noreply,
socket
|> push_navigate(to: ~p"/#{slug}/characters")}
def handle_event("open_settings", %{"data" => slug}, socket) do
{:noreply,

View File

@@ -74,6 +74,16 @@
</span>
</h2>
<div class="flex gap-2 justify-end">
<button
:if={WandererApp.Maps.can_edit?(map, @current_user)}
id={"map-characters-#{map.slug}"}
phx-hook="MapAction"
data-event="open_characters"
data-data={map.slug}
class="h-8 w-8 hover:text-white"
>
<.icon name="hero-user-group-solid" class="w-6 h-6" />
</button>
<button
:if={WandererApp.Maps.can_edit?(map, @current_user)}
id={"map-audit-#{map.slug}"}
@@ -257,7 +267,9 @@
:if={@map_subscriptions_enabled?}
class={[
"p-unselectable-text",
classes("p-tabview-selected p-highlight": @active_settings_tab == "subscription")
classes(
"p-tabview-selected p-highlight": @active_settings_tab == "subscription"
)
]}
role="presentation"
data-pc-name=""
@@ -309,7 +321,9 @@
:if={not WandererApp.Env.public_api_disabled?()}
class={[
"p-unselectable-text",
classes("p-tabview-selected p-highlight": @active_settings_tab == "public_api")
classes(
"p-tabview-selected p-highlight": @active_settings_tab == "public_api"
)
]}
role="presentation"
data-pc-name=""
@@ -411,7 +425,10 @@
</div>
<div
:if={@active_settings_tab == "public_api" and not WandererApp.Env.public_api_disabled?()}
:if={
@active_settings_tab == "public_api" and
not WandererApp.Env.public_api_disabled?()
}
class="p-6"
>
<h2 class="text-lg font-semibold mb-4">Public API</h2>
@@ -680,8 +697,10 @@
<.button
:if={@active_settings_tab == "subscription" && not @is_adding_subscription?}
type="button"
disabled={@map_subscriptions |> Enum.at(0) |> Map.get(:status) == :active &&
@map_subscriptions |> Enum.at(0) |> Map.get(:plan) != :alpha}
disabled={
@map_subscriptions |> Enum.at(0) |> Map.get(:status) == :active &&
@map_subscriptions |> Enum.at(0) |> Map.get(:plan) != :alpha
}
phx-click="add_subscription"
>
Add subscription

View File

@@ -143,7 +143,6 @@ defmodule WandererAppWeb.Router do
post "/acls", MapAccessListAPIController, :create
end
scope "/api/characters", WandererAppWeb do
pipe_through [:api, :api_character]
get "/", CharactersAPIController, :index
@@ -260,6 +259,7 @@ defmodule WandererAppWeb.Router do
live "/profile/deposit", ProfileLive, :deposit
live "/profile/subscribe", ProfileLive, :subscribe
live "/:slug/audit", MapAuditLive, :index
live "/:slug/characters", MapCharactersLive, :index
live "/:slug", MapLive, :index
end
end

View File

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