mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-07 00:05:34 +00:00
Compare commits
189 Commits
v1.75.14
...
update-lif
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36f424da0b | ||
|
|
c0a65d5a23 | ||
|
|
02e31333d2 | ||
|
|
d69616119d | ||
|
|
dbc770d40b | ||
|
|
e69a8fece5 | ||
|
|
cf20be8a77 | ||
|
|
450bcb649c | ||
|
|
a00395351e | ||
|
|
3b24c760ff | ||
|
|
3801f0be18 | ||
|
|
f3104db2e4 | ||
|
|
602b1028c3 | ||
|
|
4f98e979a2 | ||
|
|
e0f46c4af7 | ||
|
|
bc8a9a2b85 | ||
|
|
c2b03f925d | ||
|
|
efa2e52054 | ||
|
|
cedf5761f8 | ||
|
|
f601bb8751 | ||
|
|
c39d2a56d2 | ||
|
|
805722bbe8 | ||
|
|
fe3e38343b | ||
|
|
616e82c497 | ||
|
|
ab7e47b91f | ||
|
|
cf1c103a46 | ||
|
|
71202a4a29 | ||
|
|
a7e0ceac4c | ||
|
|
6bce701aab | ||
|
|
f8b9e206a5 | ||
|
|
4c1ec2004b | ||
|
|
ebed74d239 | ||
|
|
c789b69b54 | ||
|
|
24c32511d8 | ||
|
|
302fb0642d | ||
|
|
06e7b6e3eb | ||
|
|
33acd55eaa | ||
|
|
dec82e89c2 | ||
|
|
f5ac5bc4ec | ||
|
|
b6c680e802 | ||
|
|
5fa57c13b4 | ||
|
|
acc81fda44 | ||
|
|
7ab5acf45f | ||
|
|
0d4ffbcc22 | ||
|
|
a9253ac2df | ||
|
|
d00b4843a7 | ||
|
|
6068de2c71 | ||
|
|
73da427c6b | ||
|
|
9b7ec0ddfe | ||
|
|
c2f5f14c44 | ||
|
|
0b7c3588d5 | ||
|
|
a51fac5736 | ||
|
|
726c3d0704 | ||
|
|
8dd564dbd0 | ||
|
|
e33c65cddc | ||
|
|
f2fbd2ead0 | ||
|
|
123a2e45eb | ||
|
|
f8d2d9c680 | ||
|
|
9dcbef9a79 | ||
|
|
0b14857a12 | ||
|
|
bd3d516f60 | ||
|
|
40d0bd8cea | ||
|
|
873946a1a6 | ||
|
|
968deeb254 | ||
|
|
959041be52 | ||
|
|
3319520179 | ||
|
|
580fcf3657 | ||
|
|
53dae7c520 | ||
|
|
6d59d709f1 | ||
|
|
4343e9070c | ||
|
|
b62373fb5f | ||
|
|
3da98f8e56 | ||
|
|
494d24952e | ||
|
|
8a6b17bd7b | ||
|
|
d2e859a74e | ||
|
|
4a78d55d22 | ||
|
|
dc252b8c4b | ||
|
|
c433205e89 | ||
|
|
d6bc5b57b1 | ||
|
|
280a286266 | ||
|
|
d5c18b5de3 | ||
|
|
7452e5d011 | ||
|
|
71674b0d52 | ||
|
|
5b4824bd5d | ||
|
|
deda16a7da | ||
|
|
0b7c067de7 | ||
|
|
0d0db8c129 | ||
|
|
9f1b7994a3 | ||
|
|
378df0ac70 | ||
|
|
0e4a132f69 | ||
|
|
631746375d | ||
|
|
7dc01dad54 | ||
|
|
8a9807d3e5 | ||
|
|
39df3c97ce | ||
|
|
46c1ccdfcc | ||
|
|
8817536038 | ||
|
|
c3bb23a6ee | ||
|
|
7e9c4c575e | ||
|
|
5a70eee91e | ||
|
|
228f6990a1 | ||
|
|
d80ed0e70e | ||
|
|
4576c75737 | ||
|
|
67764faaa7 | ||
|
|
91dd0b27ae | ||
|
|
99dcf49fbc | ||
|
|
6fb3edbfd6 | ||
|
|
26f13ce857 | ||
|
|
e9b475c0a8 | ||
|
|
7752010092 | ||
|
|
d3705b3ed7 | ||
|
|
1394e2897e | ||
|
|
5117a1c5af | ||
|
|
3c62403f33 | ||
|
|
a4760f5162 | ||
|
|
b071070431 | ||
|
|
3bcb9628e7 | ||
|
|
e62c4cf5bf | ||
|
|
af46962ce4 | ||
|
|
0b0967830b | ||
|
|
172251a208 | ||
|
|
8a6fb63d55 | ||
|
|
9652959e5e | ||
|
|
825ef46d41 | ||
|
|
ad9f7c6b95 | ||
|
|
b960b5c149 | ||
|
|
0f092d21f9 | ||
|
|
031576caa6 | ||
|
|
7a97a96c42 | ||
|
|
2efb2daba0 | ||
|
|
4374c39924 | ||
|
|
15711495c7 | ||
|
|
236f803427 | ||
|
|
6772130f2a | ||
|
|
ddd72f3fac | ||
|
|
6e262835ef | ||
|
|
2f3b8ddc5f | ||
|
|
cea3a74b34 | ||
|
|
867941a233 | ||
|
|
3ff388a16d | ||
|
|
f4248e9ab9 | ||
|
|
507b3289c7 | ||
|
|
9e1dfc48d5 | ||
|
|
518cbc7b5d | ||
|
|
ccc8db0620 | ||
|
|
7cfb663efd | ||
|
|
e5103cc925 | ||
|
|
26458f5a19 | ||
|
|
79d5ec6caf | ||
|
|
034d461ab6 | ||
|
|
2e9c1c170c | ||
|
|
24ad3b2c61 | ||
|
|
288f55dc2f | ||
|
|
78dbea6267 | ||
|
|
6a9e53141d | ||
|
|
05e6994520 | ||
|
|
1a4dc67eb9 | ||
|
|
31d87a116b | ||
|
|
c47796d590 | ||
|
|
c7138a41ee | ||
|
|
96f04c70a9 | ||
|
|
87a8bc09ab | ||
|
|
5f5661d559 | ||
|
|
35ca87790e | ||
|
|
ae43e4a57c | ||
|
|
b91712a01a | ||
|
|
b20007b341 | ||
|
|
6a24e1188b | ||
|
|
5894efc1aa | ||
|
|
a05612d243 | ||
|
|
48de874d6b | ||
|
|
91e6da316f | ||
|
|
fa60bd81a1 | ||
|
|
a08a69c5be | ||
|
|
18d450a41a | ||
|
|
36cdee61c0 | ||
|
|
797e188259 | ||
|
|
91b581668a | ||
|
|
ad01fec28f | ||
|
|
357d3a0df6 | ||
|
|
5ce6022761 | ||
|
|
235a0c5aea | ||
|
|
9b81fa6ebb | ||
|
|
8792d5ab0e | ||
|
|
d46ed0c078 | ||
|
|
73c433fcd2 | ||
|
|
74f7ad155d | ||
|
|
f58ebad0ec | ||
|
|
7ca4eb3b8f | ||
|
|
854524a03c |
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -96,6 +96,7 @@ jobs:
|
|||||||
git config --global user.name 'CI'
|
git config --global user.name 'CI'
|
||||||
git config --global user.email 'ci@users.noreply.github.com'
|
git config --global user.email 'ci@users.noreply.github.com'
|
||||||
mix git_ops.release --force-patch --yes
|
mix git_ops.release --force-patch --yes
|
||||||
|
git commit --allow-empty -m 'chore: [skip ci]'
|
||||||
git push --follow-tags
|
git push --follow-tags
|
||||||
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|||||||
11
.github/workflows/docker-arm.yml
vendored
11
.github/workflows/docker-arm.yml
vendored
@@ -43,6 +43,11 @@ jobs:
|
|||||||
platform=${{ matrix.platform }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: ⬇️ Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get Release Tag
|
- name: Get Release Tag
|
||||||
id: get-latest-tag
|
id: get-latest-tag
|
||||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||||
@@ -118,11 +123,9 @@ jobs:
|
|||||||
id: get-content
|
id: get-content
|
||||||
with:
|
with:
|
||||||
stringToTruncate: |
|
stringToTruncate: |
|
||||||
📣 Wanderer **ARM** release available 🎉
|
📣 Wanderer **ARM** release available 🎉
|
||||||
|
|
||||||
[wandererltd/community-edition-arm:${{ steps.get-latest-tag.outputs.tag }}](https://hub.docker.com/r/wandererltd/community-edition-arm/tags)
|
**Version**: :${{ steps.get-latest-tag.outputs.tag }}
|
||||||
|
|
||||||
**Version**: ${{ steps.get-latest-tag.outputs.tag }}
|
|
||||||
|
|
||||||
${{ steps.extract-changelog.outputs.body }}
|
${{ steps.extract-changelog.outputs.body }}
|
||||||
maxLength: 500
|
maxLength: 500
|
||||||
|
|||||||
7
.github/workflows/docker.yml
vendored
7
.github/workflows/docker.yml
vendored
@@ -43,6 +43,11 @@ jobs:
|
|||||||
platform=${{ matrix.platform }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: ⬇️ Checkout repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get Release Tag
|
- name: Get Release Tag
|
||||||
id: get-latest-tag
|
id: get-latest-tag
|
||||||
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
uses: "WyriHaximus/github-action-get-previous-tag@v1"
|
||||||
@@ -120,8 +125,6 @@ jobs:
|
|||||||
stringToTruncate: |
|
stringToTruncate: |
|
||||||
📣 Wanderer new release available 🎉
|
📣 Wanderer new release available 🎉
|
||||||
|
|
||||||
[wandererltd/community-edition:${{ steps.get-latest-tag.outputs.tag }}](https://hub.docker.com/r/wandererltd/community-edition/tags)
|
|
||||||
|
|
||||||
**Version**: ${{ steps.get-latest-tag.outputs.tag }}
|
**Version**: ${{ steps.get-latest-tag.outputs.tag }}
|
||||||
|
|
||||||
${{ steps.extract-changelog.outputs.body }}
|
${{ steps.extract-changelog.outputs.body }}
|
||||||
|
|||||||
1974
CHANGELOG.md
1974
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -18,5 +18,28 @@ module.exports = {
|
|||||||
'react/react-in-jsx-scope': 'off',
|
'react/react-in-jsx-scope': 'off',
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
"linebreak-style": "off",
|
"linebreak-style": "off",
|
||||||
|
"no-restricted-imports": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"name": "primereact/button",
|
||||||
|
"importNames": ["Button"],
|
||||||
|
"message": "Use WdButton instead Button"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"react/forbid-elements": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"forbid": [
|
||||||
|
{
|
||||||
|
"element": "Button",
|
||||||
|
"message": "Use WdButton instead Button"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
// import './tailwind.css';
|
// import './tailwind.css';
|
||||||
//@import 'primereact/resources/themes/bootstrap4-dark-blue/theme.css';
|
@use 'primereact/resources/primereact.min.css';
|
||||||
//@import 'primereact/resources/themes/lara-dark-purple/theme.css';
|
@use 'primeicons/primeicons.css';
|
||||||
//@import "prime-fixes";
|
|
||||||
@import 'primereact/resources/primereact.min.css';
|
|
||||||
//@import 'primeflex/primeflex.css';
|
|
||||||
@import 'primeicons/primeicons.css';
|
|
||||||
//@import 'primereact/resources/primereact.css';
|
|
||||||
|
|
||||||
|
|
||||||
@import "fixes";
|
@use "fixes";
|
||||||
@import "prime-fixes";
|
@use "prime-fixes";
|
||||||
@import "custom-scrollbar";
|
@use "custom-scrollbar";
|
||||||
@import "tooltip";
|
@use "tooltip";
|
||||||
@import "context-menu";
|
@use "context-menu";
|
||||||
|
|
||||||
|
|
||||||
.fixedImportant {
|
.fixedImportant {
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
@import "fix-dialog";
|
@use "fix-dialog";
|
||||||
@import "fix-popup";
|
@use "fix-popup";
|
||||||
@import "fix-tabs";
|
@use "fix-tabs";
|
||||||
//@import "fix-input";
|
|
||||||
|
|
||||||
//@import "theme";
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import { SolarSystemRawType } from '@/hooks/Mapper/types';
|
|||||||
import { getSystemById } from '@/hooks/Mapper/helpers';
|
import { getSystemById } from '@/hooks/Mapper/helpers';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { GRADIENT_MENU_ACTIVE_CLASSES } from '@/hooks/Mapper/constants.ts';
|
import { GRADIENT_MENU_ACTIVE_CLASSES } from '@/hooks/Mapper/constants.ts';
|
||||||
import { LayoutEventBlocker } from '@/hooks/Mapper/components/ui-kit';
|
import { LayoutEventBlocker, WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
|
|
||||||
const AVAILABLE_TAGS = [
|
const AVAILABLE_TAGS = [
|
||||||
'A',
|
'A',
|
||||||
@@ -61,7 +60,7 @@ export const useTagMenu = (
|
|||||||
<LayoutEventBlocker className="flex flex-col gap-1 w-[200px] h-full px-2">
|
<LayoutEventBlocker className="flex flex-col gap-1 w-[200px] h-full px-2">
|
||||||
<div className="grid grid-cols-[auto_auto_auto_auto_auto_auto] gap-1">
|
<div className="grid grid-cols-[auto_auto_auto_auto_auto_auto] gap-1">
|
||||||
{AVAILABLE_TAGS.map(x => (
|
{AVAILABLE_TAGS.map(x => (
|
||||||
<Button
|
<WdButton
|
||||||
outlined={system?.tag !== x}
|
outlined={system?.tag !== x}
|
||||||
severity="warning"
|
severity="warning"
|
||||||
key={x}
|
key={x}
|
||||||
@@ -71,9 +70,9 @@ export const useTagMenu = (
|
|||||||
onClick={() => system?.tag !== x && onSystemTag(x)}
|
onClick={() => system?.tag !== x && onSystemTag(x)}
|
||||||
>
|
>
|
||||||
{x}
|
{x}
|
||||||
</Button>
|
</WdButton>
|
||||||
))}
|
))}
|
||||||
<Button
|
<WdButton
|
||||||
disabled={!isSelectedTag}
|
disabled={!isSelectedTag}
|
||||||
icon="pi pi-ban"
|
icon="pi pi-ban"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -81,7 +80,7 @@ export const useTagMenu = (
|
|||||||
outlined
|
outlined
|
||||||
severity="help"
|
severity="help"
|
||||||
onClick={() => onSystemTag()}
|
onClick={() => onSystemTag()}
|
||||||
></Button>
|
></WdButton>
|
||||||
</div>
|
</div>
|
||||||
</LayoutEventBlocker>
|
</LayoutEventBlocker>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
import { NodeSelectionMouseHandler } from '@/hooks/Mapper/components/contexts/types.ts';
|
||||||
|
import { SESSION_KEY } from '@/hooks/Mapper/constants.ts';
|
||||||
|
import { PingData, SolarSystemConnection, SolarSystemRawType } from '@/hooks/Mapper/types';
|
||||||
|
import { MapHandlers, OutCommand, OutCommandHandler } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
|
import { ctxManager } from '@/hooks/Mapper/utils/contextManager.ts';
|
||||||
|
import type { PanelPosition } from '@reactflow/core';
|
||||||
|
import clsx from 'clsx';
|
||||||
import { ForwardedRef, forwardRef, MouseEvent, useCallback, useEffect, useMemo } from 'react';
|
import { ForwardedRef, forwardRef, MouseEvent, useCallback, useEffect, useMemo } from 'react';
|
||||||
import ReactFlow, {
|
import ReactFlow, {
|
||||||
Background,
|
Background,
|
||||||
@@ -16,8 +23,6 @@ import ReactFlow, {
|
|||||||
import 'reactflow/dist/style.css';
|
import 'reactflow/dist/style.css';
|
||||||
import classes from './Map.module.scss';
|
import classes from './Map.module.scss';
|
||||||
import { MapProvider, useMapState } from './MapProvider';
|
import { MapProvider, useMapState } from './MapProvider';
|
||||||
import { useEdgesState, useMapHandlers, useNodesState, useUpdateNodes } from './hooks';
|
|
||||||
import { MapHandlers, OutCommand, OutCommandHandler } from '@/hooks/Mapper/types/mapHandlers.ts';
|
|
||||||
import {
|
import {
|
||||||
ContextMenuConnection,
|
ContextMenuConnection,
|
||||||
ContextMenuRoot,
|
ContextMenuRoot,
|
||||||
@@ -26,14 +31,9 @@ import {
|
|||||||
useContextMenuRootHandlers,
|
useContextMenuRootHandlers,
|
||||||
} from './components';
|
} from './components';
|
||||||
import { getBehaviorForTheme } from './helpers/getThemeBehavior';
|
import { getBehaviorForTheme } from './helpers/getThemeBehavior';
|
||||||
import { OnMapAddSystemCallback, OnMapSelectionChange } from './map.types';
|
import { useEdgesState, useMapHandlers, useNodesState, useUpdateNodes } from './hooks';
|
||||||
import { SESSION_KEY } from '@/hooks/Mapper/constants.ts';
|
|
||||||
import { PingData, SolarSystemConnection, SolarSystemRawType } from '@/hooks/Mapper/types';
|
|
||||||
import { ctxManager } from '@/hooks/Mapper/utils/contextManager.ts';
|
|
||||||
import { NodeSelectionMouseHandler } from '@/hooks/Mapper/components/contexts/types.ts';
|
|
||||||
import clsx from 'clsx';
|
|
||||||
import { useBackgroundVars } from './hooks/useBackgroundVars';
|
import { useBackgroundVars } from './hooks/useBackgroundVars';
|
||||||
import type { PanelPosition } from '@reactflow/core';
|
import { OnMapAddSystemCallback, OnMapSelectionChange } from './map.types';
|
||||||
|
|
||||||
const DEFAULT_VIEW_PORT = { zoom: 1, x: 0, y: 0 };
|
const DEFAULT_VIEW_PORT = { zoom: 1, x: 0, y: 0 };
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
@use '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
||||||
|
|
||||||
.ConnectionTimeEOL {
|
.ConnectionTimeEOL {
|
||||||
background-image: linear-gradient(207deg, transparent, var(--conn-time-eol));
|
background-image: linear-gradient(207deg, transparent, var(--conn-time-eol));
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
@@ -15,3 +19,14 @@
|
|||||||
.SelectedItem {
|
.SelectedItem {
|
||||||
background-color: var(--selected-item-bg);
|
background-color: var(--selected-item-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.FastActions {
|
||||||
|
:global {
|
||||||
|
.p-menuitem-content {
|
||||||
|
background-color: initial !important;
|
||||||
|
}
|
||||||
|
.p-menuitem-content:hover {
|
||||||
|
background-color: initial !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
import React, { RefObject, useMemo } from 'react';
|
|
||||||
import { ContextMenu } from 'primereact/contextmenu';
|
|
||||||
import { PrimeIcons } from 'primereact/api';
|
|
||||||
import { MenuItem } from 'primereact/menuitem';
|
|
||||||
import { ConnectionType, MassState, ShipSizeStatus, SolarSystemConnection, TimeStatus } from '@/hooks/Mapper/types';
|
|
||||||
import clsx from 'clsx';
|
|
||||||
import classes from './ContextMenuConnection.module.scss';
|
|
||||||
import {
|
import {
|
||||||
MASS_STATE_NAMES,
|
MASS_STATE_NAMES,
|
||||||
MASS_STATE_NAMES_ORDER,
|
MASS_STATE_NAMES_ORDER,
|
||||||
@@ -13,14 +6,25 @@ import {
|
|||||||
SHIP_SIZES_NAMES_SHORT,
|
SHIP_SIZES_NAMES_SHORT,
|
||||||
SHIP_SIZES_SIZE,
|
SHIP_SIZES_SIZE,
|
||||||
} from '@/hooks/Mapper/components/map/constants.ts';
|
} from '@/hooks/Mapper/components/map/constants.ts';
|
||||||
|
import { ConnectionType, MassState, ShipSizeStatus, SolarSystemConnection, TimeStatus } from '@/hooks/Mapper/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
import { PrimeIcons } from 'primereact/api';
|
||||||
|
import { ContextMenu } from 'primereact/contextmenu';
|
||||||
|
import { MenuItem } from 'primereact/menuitem';
|
||||||
|
import React, { RefObject, useMemo } from 'react';
|
||||||
import { Edge } from 'reactflow';
|
import { Edge } from 'reactflow';
|
||||||
|
import { LifetimeActionsWrapper } from '@/hooks/Mapper/components/map/components/ContextMenuConnection/LifetimeActionsWrapper.tsx';
|
||||||
|
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>;
|
||||||
onDeleteConnection(): void;
|
onDeleteConnection(): void;
|
||||||
onChangeTimeState(): void;
|
onChangeTimeState(lifetime: TimeStatus): 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 +36,7 @@ export const ContextMenuConnection: React.FC<ContextMenuConnectionProps> = ({
|
|||||||
onChangeTimeState,
|
onChangeTimeState,
|
||||||
onChangeMassState,
|
onChangeMassState,
|
||||||
onChangeShipSizeStatus,
|
onChangeShipSizeStatus,
|
||||||
|
onChangeType,
|
||||||
onToggleMassSave,
|
onToggleMassSave,
|
||||||
onHide,
|
onHide,
|
||||||
edge,
|
edge,
|
||||||
@@ -41,88 +46,128 @@ 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.gate;
|
|
||||||
|
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
|
{
|
||||||
|
className: clsx(classes.FastActions, '!h-[54px]'),
|
||||||
|
template: () => {
|
||||||
|
return <LifetimeActionsWrapper lifetime={edge.data?.time_status} onChangeLifetime={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 (
|
||||||
<>
|
<>
|
||||||
<ContextMenu model={items} ref={contextMenuRef} onHide={onHide} breakpoint="767px" />
|
<ContextMenu model={items} ref={contextMenuRef} onHide={onHide} breakpoint="767px" className="!w-[250px]" />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { LayoutEventBlocker } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
import { WdLifetimeSelector, WdLifetimeSelectorProps } from '@/hooks/Mapper/components/ui-kit/WdLifetimeSelector.tsx';
|
||||||
|
|
||||||
|
export const LifetimeActionsWrapper = (props: WdLifetimeSelectorProps) => {
|
||||||
|
return (
|
||||||
|
<LayoutEventBlocker className="flex flex-col gap-1 w-[100%] h-full px-2 pt-[4px]">
|
||||||
|
<div className="text-[12px] text-stone-500 font-semibold">Life time:</div>
|
||||||
|
|
||||||
|
<WdLifetimeSelector {...props} />
|
||||||
|
</LayoutEventBlocker>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -30,7 +30,7 @@ export const useContextMenuConnectionHandlers = () => {
|
|||||||
setEdge(undefined);
|
setEdge(undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangeTimeState = () => {
|
const onChangeTimeState = (lifetime: TimeStatus) => {
|
||||||
if (!edge || !edge.data) {
|
if (!edge || !edge.data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ export const useContextMenuConnectionHandlers = () => {
|
|||||||
data: {
|
data: {
|
||||||
source: edge.source,
|
source: edge.source,
|
||||||
target: edge.target,
|
target: edge.target,
|
||||||
value: edge.data.time_status === TimeStatus.default ? TimeStatus.eol : TimeStatus.default,
|
value: lifetime,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
setEdge(undefined);
|
setEdge(undefined);
|
||||||
|
|||||||
@@ -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, {
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
@import '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
@use '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
||||||
|
|
||||||
.EdgePathBack {
|
.EdgePathBack {
|
||||||
fill: none;
|
fill: none;
|
||||||
stroke: #80a5c5;
|
stroke: #80a5c5;
|
||||||
stroke-width: 3px;
|
stroke-width: 3px;
|
||||||
|
|
||||||
|
&.time1 {
|
||||||
|
stroke: #f11ab2;
|
||||||
|
stroke-width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.time4 {
|
||||||
|
stroke: #a654e3;
|
||||||
|
stroke-width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
&.TimeCrit {
|
&.TimeCrit {
|
||||||
stroke: #f11ab2;
|
stroke: #f11ab2;
|
||||||
stroke-width: 4px;
|
stroke-width: 4px;
|
||||||
@@ -29,6 +39,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%)',
|
||||||
@@ -42,7 +43,9 @@ export const SHIP_SIZES_COLORS = {
|
|||||||
export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }: EdgeProps<SolarSystemConnection>) => {
|
export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }: EdgeProps<SolarSystemConnection>) => {
|
||||||
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.gate;
|
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;
|
||||||
@@ -79,9 +80,11 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }:
|
|||||||
id={`back_${id}`}
|
id={`back_${id}`}
|
||||||
className={clsx(classes.EdgePathBack, {
|
className={clsx(classes.EdgePathBack, {
|
||||||
[classes.Tick]: isThickConnections,
|
[classes.Tick]: isThickConnections,
|
||||||
[classes.TimeCrit]: isWormhole && data.time_status === TimeStatus.eol,
|
[classes.time1]: isWormhole && data.time_status === TimeStatus._1h,
|
||||||
|
[classes.time4]: isWormhole && data.time_status === TimeStatus._4h,
|
||||||
[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 +98,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 +151,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]}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@import '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
@use "sass:color";
|
||||||
|
@use '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
||||||
|
|
||||||
$pastel-blue: #5a7d9a;
|
$pastel-blue: #5a7d9a;
|
||||||
$pastel-pink: rgb(30, 161, 255);
|
$pastel-pink: rgb(30, 161, 255);
|
||||||
@@ -34,7 +35,7 @@ $neon-color-3: rgba(27, 132, 236, 0.40);
|
|||||||
color: var(--rf-text-color, #ffffff);
|
color: var(--rf-text-color, #ffffff);
|
||||||
|
|
||||||
box-shadow: 0 0 5px rgba($dark-bg, 0.5);
|
box-shadow: 0 0 5px rgba($dark-bg, 0.5);
|
||||||
border: 1px solid darken($pastel-blue, 10%);
|
border: 1px solid color.adjust($pastel-blue, $lightness: -10%);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import './SolarSystemNodeDefault.module.scss';
|
@use './SolarSystemNodeDefault.module.scss';
|
||||||
|
|
||||||
/* ---------------------------------------------
|
/* ---------------------------------------------
|
||||||
Only override what's different from the base
|
Only override what's different from the base
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
@use '@/hooks/Mapper/components/map/styles/eve-common-variables';
|
||||||
|
|
||||||
.Signature {
|
.Signature {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -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,11 +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];
|
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.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;
|
||||||
|
};
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ export * from './useCommandsCharacters';
|
|||||||
export * from './useCommandsConnections';
|
export * from './useCommandsConnections';
|
||||||
export * from './useCommandsConnections';
|
export * from './useCommandsConnections';
|
||||||
export * from './useCenterSystem';
|
export * from './useCenterSystem';
|
||||||
export * from './useSelectSystem';
|
export * from './useSelectSystems';
|
||||||
export * from './useMapCommands';
|
export * from './useMapCommands';
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { MapData, useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
import { MapData, useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
||||||
|
import { useEventBuffer } from '@/hooks/Mapper/hooks';
|
||||||
|
import { SolarSystemConnection, SolarSystemRawType } from '@/hooks/Mapper/types';
|
||||||
import { CommandInit } from '@/hooks/Mapper/types/mapHandlers.ts';
|
import { CommandInit } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
import { useCallback, useRef } from 'react';
|
import { useCallback, useRef } from 'react';
|
||||||
import { useReactFlow } from 'reactflow';
|
import { useReactFlow } from 'reactflow';
|
||||||
@@ -11,6 +13,20 @@ export const useMapInit = () => {
|
|||||||
const ref = useRef({ rf, data, update });
|
const ref = useRef({ rf, data, update });
|
||||||
ref.current = { update, data, rf };
|
ref.current = { update, data, rf };
|
||||||
|
|
||||||
|
const updateSystems = useCallback((systems: SolarSystemRawType[]) => {
|
||||||
|
const { rf } = ref.current;
|
||||||
|
rf.setNodes(systems.map(convertSystem2Node));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const { handleEvent: handleUpdateSystems } = useEventBuffer<any>(updateSystems);
|
||||||
|
|
||||||
|
const updateEdges = useCallback((connections: SolarSystemConnection[]) => {
|
||||||
|
const { rf } = ref.current;
|
||||||
|
rf.setEdges(connections.map(convertConnection2Edge));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const { handleEvent: handleUpdateConnections } = useEventBuffer<any>(updateEdges);
|
||||||
|
|
||||||
return useCallback(
|
return useCallback(
|
||||||
({
|
({
|
||||||
systems,
|
systems,
|
||||||
@@ -24,7 +40,6 @@ export const useMapInit = () => {
|
|||||||
hubs,
|
hubs,
|
||||||
}: CommandInit) => {
|
}: CommandInit) => {
|
||||||
const { update } = ref.current;
|
const { update } = ref.current;
|
||||||
const { rf } = ref.current;
|
|
||||||
|
|
||||||
const updateData: Partial<MapData> = {};
|
const updateData: Partial<MapData> = {};
|
||||||
|
|
||||||
@@ -63,11 +78,13 @@ export const useMapInit = () => {
|
|||||||
update(updateData);
|
update(updateData);
|
||||||
|
|
||||||
if (systems) {
|
if (systems) {
|
||||||
rf.setNodes(systems.map(convertSystem2Node));
|
handleUpdateSystems(systems);
|
||||||
|
// rf.setNodes(systems.map(convertSystem2Node));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connections) {
|
if (connections) {
|
||||||
rf.setEdges(connections.map(convertConnection2Edge));
|
handleUpdateConnections(connections);
|
||||||
|
// rf.setEdges(connections.map(convertConnection2Edge));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[],
|
[],
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
import { useReactFlow } from 'reactflow';
|
|
||||||
import { useCallback, useRef } from 'react';
|
|
||||||
import { CommandSelectSystem } from '@/hooks/Mapper/types';
|
|
||||||
|
|
||||||
export const useSelectSystem = () => {
|
|
||||||
const rf = useReactFlow();
|
|
||||||
|
|
||||||
const ref = useRef({ rf });
|
|
||||||
ref.current = { rf };
|
|
||||||
|
|
||||||
return useCallback((systemId: CommandSelectSystem) => {
|
|
||||||
ref.current.rf.setNodes(nds =>
|
|
||||||
nds.map(node => {
|
|
||||||
return {
|
|
||||||
...node,
|
|
||||||
selected: node.id === systemId,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}, []);
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
||||||
|
import { CommandSelectSystems } from '@/hooks/Mapper/types';
|
||||||
|
import { useCallback, useRef } from 'react';
|
||||||
|
import { useReactFlow } from 'reactflow';
|
||||||
|
|
||||||
|
export const useSelectSystems = (onSelectionChange: OnMapSelectionChange) => {
|
||||||
|
const rf = useReactFlow();
|
||||||
|
|
||||||
|
const ref = useRef({ rf, onSelectionChange });
|
||||||
|
ref.current = { rf, onSelectionChange };
|
||||||
|
|
||||||
|
return useCallback(({ systems, delay }: CommandSelectSystems) => {
|
||||||
|
const run = () => {
|
||||||
|
ref.current.rf.setNodes(nds =>
|
||||||
|
nds.map(node => {
|
||||||
|
return {
|
||||||
|
...node,
|
||||||
|
selected: systems.includes(node.id),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (delay == null || delay === 0) {
|
||||||
|
run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(run, delay);
|
||||||
|
}, []);
|
||||||
|
};
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ForwardedRef, useImperativeHandle, useRef } from 'react';
|
|
||||||
import {
|
import {
|
||||||
CommandAddConnections,
|
CommandAddConnections,
|
||||||
CommandAddSystems,
|
CommandAddSystems,
|
||||||
@@ -14,12 +13,16 @@ import {
|
|||||||
CommandRemoveSystems,
|
CommandRemoveSystems,
|
||||||
Commands,
|
Commands,
|
||||||
CommandSelectSystem,
|
CommandSelectSystem,
|
||||||
|
CommandSelectSystems,
|
||||||
CommandUpdateConnection,
|
CommandUpdateConnection,
|
||||||
CommandUpdateSystems,
|
CommandUpdateSystems,
|
||||||
MapHandlers,
|
MapHandlers,
|
||||||
} from '@/hooks/Mapper/types/mapHandlers.ts';
|
} from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
|
import { ForwardedRef, useImperativeHandle, useRef } from 'react';
|
||||||
|
|
||||||
|
import { OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
||||||
import {
|
import {
|
||||||
|
useCenterSystem,
|
||||||
useCommandsCharacters,
|
useCommandsCharacters,
|
||||||
useCommandsConnections,
|
useCommandsConnections,
|
||||||
useMapAddSystems,
|
useMapAddSystems,
|
||||||
@@ -27,10 +30,8 @@ import {
|
|||||||
useMapInit,
|
useMapInit,
|
||||||
useMapRemoveSystems,
|
useMapRemoveSystems,
|
||||||
useMapUpdateSystems,
|
useMapUpdateSystems,
|
||||||
useCenterSystem,
|
useSelectSystems,
|
||||||
useSelectSystem,
|
|
||||||
} from './api';
|
} from './api';
|
||||||
import { OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
|
||||||
|
|
||||||
export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange: OnMapSelectionChange) => {
|
export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange: OnMapSelectionChange) => {
|
||||||
const mapInit = useMapInit();
|
const mapInit = useMapInit();
|
||||||
@@ -38,7 +39,7 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
|
|||||||
const mapUpdateSystems = useMapUpdateSystems();
|
const mapUpdateSystems = useMapUpdateSystems();
|
||||||
const removeSystems = useMapRemoveSystems(onSelectionChange);
|
const removeSystems = useMapRemoveSystems(onSelectionChange);
|
||||||
const centerSystem = useCenterSystem();
|
const centerSystem = useCenterSystem();
|
||||||
const selectSystem = useSelectSystem();
|
const selectSystems = useSelectSystems(onSelectionChange);
|
||||||
|
|
||||||
const selectRef = useRef({ onSelectionChange });
|
const selectRef = useRef({ onSelectionChange });
|
||||||
selectRef.current = { onSelectionChange };
|
selectRef.current = { onSelectionChange };
|
||||||
@@ -105,14 +106,11 @@ export const useMapHandlers = (ref: ForwardedRef<MapHandlers>, onSelectionChange
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.selectSystem:
|
case Commands.selectSystem:
|
||||||
setTimeout(() => {
|
selectSystems({ systems: [data as string], delay: 500 });
|
||||||
const systemId = `${data}`;
|
break;
|
||||||
selectRef.current.onSelectionChange({
|
|
||||||
systems: [systemId],
|
case Commands.selectSystems:
|
||||||
connections: [],
|
selectSystems(data as CommandSelectSystems);
|
||||||
});
|
|
||||||
selectSystem(systemId as CommandSelectSystem);
|
|
||||||
}, 500);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.pingAdded:
|
case Commands.pingAdded:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useCallback, useEffect, useRef } from 'react';
|
|
||||||
import { Node, useOnViewportChange, useReactFlow } from 'reactflow';
|
|
||||||
import { useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
import { useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx';
|
||||||
import { SolarSystemRawType } from '@/hooks/Mapper/types';
|
import { SolarSystemRawType } from '@/hooks/Mapper/types';
|
||||||
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
|
import { Node, useOnViewportChange, useReactFlow } from 'reactflow';
|
||||||
|
|
||||||
const useThrottle = () => {
|
const useThrottle = () => {
|
||||||
const throttleSeed = useRef<number | null>(null);
|
const throttleSeed = useRef<number | null>(null);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@import './eve-common-variables';
|
@use './eve-common-variables';
|
||||||
@import './eve-common';
|
@use './eve-common';
|
||||||
|
|
||||||
.default-theme {
|
.default-theme {
|
||||||
--rf-bg-color: #0C0A09;
|
--rf-bg-color: #0C0A09;
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
|
@use "sass:color";
|
||||||
|
|
||||||
$friendlyBase: #3bbd39;
|
$friendlyBase: #3bbd39;
|
||||||
$friendlyAlpha: #3bbd3952;
|
$friendlyAlpha: #3bbd3952;
|
||||||
$friendlyDark20: darken($friendlyBase, 20%);
|
$friendlyDark20: color.adjust($friendlyBase, $lightness: -20%);
|
||||||
$friendlyDark30: darken($friendlyBase, 30%);
|
$friendlyDark30: color.adjust($friendlyBase, $lightness: -30%);
|
||||||
$friendlyDark5: darken($friendlyBase, 5%);
|
$friendlyDark5: color.adjust($friendlyBase, $lightness: -5%);
|
||||||
|
|
||||||
$lookingForBase: #43c2fd;
|
$lookingForBase: #43c2fd;
|
||||||
$lookingForAlpha: rgba(67, 176, 253, 0.48);
|
$lookingForAlpha: rgba(67, 176, 253, 0.48);
|
||||||
$lookingForDark15: darken($lookingForBase, 15%);
|
$lookingForDark15: color.adjust($lookingForBase, $lightness: -15%);
|
||||||
|
|
||||||
$homeBase: rgb(179, 253, 67);
|
$homeBase: rgb(179, 253, 67);
|
||||||
$homeAlpha: rgba(186, 248, 48, 0.32);
|
$homeAlpha: rgba(186, 248, 48, 0.32);
|
||||||
$homeBackground: #a0fa5636;
|
$homeBackground: #a0fa5636;
|
||||||
$homeDark30: darken($homeBase, 30%);
|
$homeDark30: color.adjust($homeBase, $lightness: -30%);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--pastel-blue: #5a7d9a;
|
--pastel-blue: #5a7d9a;
|
||||||
@@ -117,6 +118,7 @@ $homeDark30: darken($homeBase, 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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import './eve-common-variables';
|
@use './eve-common-variables';
|
||||||
|
|
||||||
|
|
||||||
.eve-wh-effect-color-pulsar {
|
.eve-wh-effect-color-pulsar {
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
@import './default-theme.scss';
|
@use './default-theme.scss';
|
||||||
@import './pathfinder-theme.scss';
|
@use './pathfinder-theme.scss';
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
@import './eve-common-variables';
|
@use "sass:color";
|
||||||
@import './eve-common';
|
@use './eve-common-variables';
|
||||||
|
@use './eve-common';
|
||||||
@import url('https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap');
|
||||||
|
|
||||||
$homeBase: rgb(197, 253, 67);
|
$homeBase: rgb(197, 253, 67);
|
||||||
$homeAlpha: rgba(197, 253, 67, 0.32);
|
$homeAlpha: rgba(197, 253, 67, 0.32);
|
||||||
$homeDark30: darken($homeBase, 30%);
|
$homeDark30: color.adjust($homeBase, $lightness: -30%);
|
||||||
|
|
||||||
.pathfinder-theme {
|
.pathfinder-theme {
|
||||||
/* -- Override values from the default theme -- */
|
/* -- Override values from the default theme -- */
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { IconField } from 'primereact/iconfield';
|
import { IconField } from 'primereact/iconfield';
|
||||||
import { AutoComplete } from 'primereact/autocomplete';
|
import { AutoComplete } from 'primereact/autocomplete';
|
||||||
import { OutCommand, SearchSystemItem } from '@/hooks/Mapper/types';
|
import { OutCommand, SearchSystemItem } from '@/hooks/Mapper/types';
|
||||||
import { SystemViewStandalone, WHClassView, WHEffectView } from '@/hooks/Mapper/components/ui-kit';
|
import { SystemViewStandalone, WdButton, WHClassView, WHEffectView } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import classes from './AddSystemDialog.module.scss';
|
import classes from './AddSystemDialog.module.scss';
|
||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
@@ -34,6 +33,7 @@ export const AddSystemDialog = ({
|
|||||||
data: { wormholesData },
|
data: { wormholesData },
|
||||||
} = useMapRootState();
|
} = useMapRootState();
|
||||||
|
|
||||||
|
// TODO fix it
|
||||||
const inputRef = useRef<any>();
|
const inputRef = useRef<any>();
|
||||||
const onShow = useCallback(() => {
|
const onShow = useCallback(() => {
|
||||||
inputRef.current?.focus();
|
inputRef.current?.focus();
|
||||||
@@ -62,6 +62,7 @@ export const AddSystemDialog = ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO fix it
|
||||||
let prepared = (result.systems as SearchSystemItem[]).sort((a, b) => {
|
let prepared = (result.systems as SearchSystemItem[]).sort((a, b) => {
|
||||||
const amatch = a.label.indexOf(query);
|
const amatch = a.label.indexOf(query);
|
||||||
const bmatch = b.label.indexOf(query);
|
const bmatch = b.label.indexOf(query);
|
||||||
@@ -189,7 +190,7 @@ export const AddSystemDialog = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button
|
<WdButton
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
outlined
|
outlined
|
||||||
disabled={!selectedItem || selectedItem.length !== 1}
|
disabled={!selectedItem || selectedItem.length !== 1}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
SystemView,
|
SystemView,
|
||||||
TimeAgo,
|
TimeAgo,
|
||||||
TooltipPosition,
|
TooltipPosition,
|
||||||
|
WdButton,
|
||||||
WdImgButton,
|
WdImgButton,
|
||||||
WdImgButtonTooltip,
|
WdImgButtonTooltip,
|
||||||
} from '@/hooks/Mapper/components/ui-kit';
|
} from '@/hooks/Mapper/components/ui-kit';
|
||||||
@@ -13,7 +14,6 @@ import { PingsPlacement } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
|||||||
import { Commands, OutCommand, PingType } from '@/hooks/Mapper/types';
|
import { Commands, OutCommand, PingType } from '@/hooks/Mapper/types';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { PrimeIcons } from 'primereact/api';
|
import { PrimeIcons } from 'primereact/api';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { ConfirmPopup } from 'primereact/confirmpopup';
|
import { ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
@@ -256,7 +256,7 @@ export const PingsInterface = ({ hasLeftOffset }: PingsInterfaceProps) => {
|
|||||||
)}
|
)}
|
||||||
></Toast>
|
></Toast>
|
||||||
|
|
||||||
<Button
|
<WdButton
|
||||||
icon="pi pi-bell"
|
icon="pi pi-bell"
|
||||||
severity="warning"
|
severity="warning"
|
||||||
aria-label="Notification"
|
aria-label="Notification"
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ import { Dialog } from 'primereact/dialog';
|
|||||||
import { getSystemById } from '@/hooks/Mapper/helpers';
|
import { getSystemById } from '@/hooks/Mapper/helpers';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { IconField } from 'primereact/iconfield';
|
import { IconField } from 'primereact/iconfield';
|
||||||
import { LabelsManager } from '@/hooks/Mapper/utils/labelsManager.ts';
|
import { LabelsManager } from '@/hooks/Mapper/utils/labelsManager.ts';
|
||||||
import { WdImageSize, WdImgButton, TooltipPosition } from '@/hooks/Mapper/components/ui-kit';
|
import { TooltipPosition, WdButton, WdImageSize, WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
interface SystemCustomLabelDialog {
|
interface SystemCustomLabelDialog {
|
||||||
systemId: string;
|
systemId: string;
|
||||||
@@ -126,7 +125,7 @@ export const SystemCustomLabelDialog = ({ systemId, visible, setVisible }: Syste
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button onClick={handleSave} outlined size="small" label="Save"></Button>
|
<WdButton onClick={handleSave} outlined size="small" label="Save"></WdButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ import {
|
|||||||
} from '@/hooks/Mapper/components/map/constants.ts';
|
} from '@/hooks/Mapper/components/map/constants.ts';
|
||||||
import { SystemSignaturesContent } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignaturesContent';
|
import { SystemSignaturesContent } from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/SystemSignaturesContent';
|
||||||
import { K162_TYPES_MAP } from '@/hooks/Mapper/constants.ts';
|
import { K162_TYPES_MAP } from '@/hooks/Mapper/constants.ts';
|
||||||
import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize';
|
|
||||||
import { parseSignatureCustomInfo } from '@/hooks/Mapper/helpers/parseSignatureCustomInfo';
|
import { parseSignatureCustomInfo } from '@/hooks/Mapper/helpers/parseSignatureCustomInfo';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { CommandLinkSignatureToSystem, SignatureGroup, SystemSignature, TimeStatus } from '@/hooks/Mapper/types';
|
import { CommandLinkSignatureToSystem, SignatureGroup, SystemSignature } from '@/hooks/Mapper/types';
|
||||||
import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts';
|
import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
import { SETTINGS_KEYS, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures';
|
import { SETTINGS_KEYS, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures';
|
||||||
|
|
||||||
@@ -116,14 +115,14 @@ export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignat
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleSelect = useCallback(
|
const handleSelect = useCallback(
|
||||||
async (signature: SystemSignature) => {
|
(signature: SystemSignature) => {
|
||||||
if (!signature) {
|
if (!signature) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { outCommand } = ref.current;
|
const { outCommand } = ref.current;
|
||||||
|
|
||||||
await outCommand({
|
outCommand({
|
||||||
type: OutCommand.linkSignatureToSystem,
|
type: OutCommand.linkSignatureToSystem,
|
||||||
data: {
|
data: {
|
||||||
...data,
|
...data,
|
||||||
@@ -131,32 +130,9 @@ export const SystemLinkSignatureDialog = ({ data, setVisible }: SystemLinkSignat
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
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 !== undefined && whShipSize !== null) {
|
|
||||||
await outCommand({
|
|
||||||
type: OutCommand.updateConnectionShipSizeType,
|
|
||||||
data: {
|
|
||||||
source: data.solar_system_source,
|
|
||||||
target: data.solar_system_target,
|
|
||||||
value: whShipSize,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
},
|
},
|
||||||
[data, setVisible, wormholes],
|
[data, setVisible],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -2,10 +2,9 @@ import { InputTextarea } from 'primereact/inputtextarea';
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { PingType } from '@/hooks/Mapper/types/ping.ts';
|
import { PingType } from '@/hooks/Mapper/types/ping.ts';
|
||||||
import { SystemView } from '@/hooks/Mapper/components/ui-kit';
|
import { SystemView, WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
||||||
const PING_TITLES = {
|
const PING_TITLES = {
|
||||||
@@ -92,7 +91,7 @@ export const SystemPingDialog = ({ systemId, type, visible, setVisible }: System
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button onClick={handleSave} size="small" severity="danger" label="Ping!"></Button>
|
<WdButton onClick={handleSave} size="small" severity="danger" label="Ping!" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ import { getSystemById } from '@/hooks/Mapper/helpers';
|
|||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useMapGetOption } from '@/hooks/Mapper/mapRootProvider/hooks/api';
|
import { useMapGetOption } from '@/hooks/Mapper/mapRootProvider/hooks/api';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { IconField } from 'primereact/iconfield';
|
import { IconField } from 'primereact/iconfield';
|
||||||
import { TooltipPosition, WdImageSize, WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
import { TooltipPosition, WdButton, WdImageSize, WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { LabelsManager } from '@/hooks/Mapper/utils/labelsManager.ts';
|
import { LabelsManager } from '@/hooks/Mapper/utils/labelsManager.ts';
|
||||||
import { getSystemStaticInfo } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic';
|
import { getSystemStaticInfo } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic';
|
||||||
|
|
||||||
@@ -114,7 +113,7 @@ export const SystemSettingsDialog = ({ systemId, visible, setVisible }: SystemSe
|
|||||||
<Dialog
|
<Dialog
|
||||||
header="System settings"
|
header="System settings"
|
||||||
visible={visible}
|
visible={visible}
|
||||||
draggable={false}
|
draggable={true}
|
||||||
style={{ width: '450px' }}
|
style={{ width: '450px' }}
|
||||||
onShow={onShow}
|
onShow={onShow}
|
||||||
onHide={() => {
|
onHide={() => {
|
||||||
@@ -226,7 +225,7 @@ export const SystemSettingsDialog = ({ systemId, visible, setVisible }: SystemSe
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button onClick={handleSave} outlined size="small" label="Save"></Button>
|
<WdButton onClick={handleSave} outlined size="small" label="Save" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
import { useRouteProvider } from '@/hooks/Mapper/components/mapInterface/widgets/RoutesWidget/RoutesProvider.tsx';
|
||||||
import {
|
|
||||||
RoutesType,
|
|
||||||
useRouteProvider,
|
|
||||||
} from '@/hooks/Mapper/components/mapInterface/widgets/RoutesWidget/RoutesProvider.tsx';
|
|
||||||
import { PrettySwitchbox } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/components';
|
import { PrettySwitchbox } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/components';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
import { RoutesType } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
||||||
|
|
||||||
interface RoutesSettingsDialog {
|
interface RoutesSettingsDialog {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -83,7 +81,7 @@ export const RoutesSettingsDialog = ({ visible, setVisible }: RoutesSettingsDial
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button onClick={handleSave} outlined size="small" label="Apply"></Button>
|
<WdButton onClick={handleSave} outlined size="small" label="Apply"></WdButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|||||||
import { RoutesType } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
import { RoutesType } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
||||||
import { LoadRoutesCommand } from '@/hooks/Mapper/components/mapInterface/widgets/RoutesWidget/types.ts';
|
import { LoadRoutesCommand } from '@/hooks/Mapper/components/mapInterface/widgets/RoutesWidget/types.ts';
|
||||||
import { RoutesList } from '@/hooks/Mapper/types/routes.ts';
|
import { RoutesList } from '@/hooks/Mapper/types/routes.ts';
|
||||||
|
import { flattenValues } from '@/hooks/Mapper/utils/flattenValues.ts';
|
||||||
|
|
||||||
function usePrevious<T>(value: T): T | undefined {
|
function usePrevious<T>(value: T): T | undefined {
|
||||||
const ref = useRef<T>();
|
const ref = useRef<T>();
|
||||||
@@ -64,12 +65,8 @@ export const useLoadRoutes = ({
|
|||||||
systems?.length,
|
systems?.length,
|
||||||
connections,
|
connections,
|
||||||
hubs,
|
hubs,
|
||||||
routesSettings,
|
// we need make it flat recursively
|
||||||
...Object.keys(routesSettings)
|
...flattenValues(routesSettings),
|
||||||
.sort()
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-expect-error
|
|
||||||
.map(x => routesSettings[x]),
|
|
||||||
...deps,
|
...deps,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { TabPanel, TabView } from 'primereact/tabview';
|
import { TabPanel, TabView } from 'primereact/tabview';
|
||||||
import { PrettySwitchbox } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/components';
|
import { PrettySwitchbox } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/components';
|
||||||
import { Dropdown } from 'primereact/dropdown';
|
import { Dropdown } from 'primereact/dropdown';
|
||||||
@@ -10,6 +9,7 @@ import {
|
|||||||
SIGNATURE_SETTINGS,
|
SIGNATURE_SETTINGS,
|
||||||
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/constants.ts';
|
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/constants.ts';
|
||||||
import { SignatureSettingsType } from '@/hooks/Mapper/constants/signatures.ts';
|
import { SignatureSettingsType } from '@/hooks/Mapper/constants/signatures.ts';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
interface SystemSignatureSettingsDialogProps {
|
interface SystemSignatureSettingsDialogProps {
|
||||||
settings: SignatureSettingsType;
|
settings: SignatureSettingsType;
|
||||||
@@ -92,7 +92,7 @@ export const SystemSignatureSettingsDialog = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end">
|
||||||
<Button onClick={handleSave} outlined size="small" label="Save"></Button>
|
<WdButton onClick={handleSave} outlined size="small" label="Save" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ import {
|
|||||||
renderInfoColumn,
|
renderInfoColumn,
|
||||||
renderUpdatedTimeLeft,
|
renderUpdatedTimeLeft,
|
||||||
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/renders';
|
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/renders';
|
||||||
|
import { SETTINGS_KEYS, SIGNATURE_WINDOW_ID, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures.ts';
|
||||||
import { useClipboard, useHotkey } from '@/hooks/Mapper/hooks';
|
import { useClipboard, useHotkey } from '@/hooks/Mapper/hooks';
|
||||||
import useMaxWidth from '@/hooks/Mapper/hooks/useMaxWidth';
|
import useMaxWidth from '@/hooks/Mapper/hooks/useMaxWidth';
|
||||||
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { getSignatureRowClass } from '../helpers/rowStyles';
|
import { getSignatureRowClass } from '../helpers/rowStyles';
|
||||||
import { useSystemSignaturesData } from '../hooks/useSystemSignaturesData';
|
import { useSystemSignaturesData } from '../hooks/useSystemSignaturesData';
|
||||||
import { SETTINGS_KEYS, SIGNATURE_WINDOW_ID, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures.ts';
|
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
||||||
|
|
||||||
const renderColIcon = (sig: SystemSignature) => renderIcon(sig);
|
const renderColIcon = (sig: SystemSignature) => renderIcon(sig);
|
||||||
|
|
||||||
@@ -157,9 +157,18 @@ export const SystemSignaturesContent = ({
|
|||||||
[onSelect, selectable, setSelectedSignatures, deletedSignatures],
|
[onSelect, selectable, setSelectedSignatures, deletedSignatures],
|
||||||
);
|
);
|
||||||
|
|
||||||
const { showDescriptionColumn, showUpdatedColumn, showCharacterColumn, showCharacterPortrait } = useMemo(
|
const {
|
||||||
|
showGroupColumn,
|
||||||
|
showDescriptionColumn,
|
||||||
|
showAddedColumn,
|
||||||
|
showUpdatedColumn,
|
||||||
|
showCharacterColumn,
|
||||||
|
showCharacterPortrait,
|
||||||
|
} = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
|
showGroupColumn: settings[SETTINGS_KEYS.SHOW_GROUP_COLUMN] as boolean,
|
||||||
showDescriptionColumn: settings[SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN] as boolean,
|
showDescriptionColumn: settings[SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN] as boolean,
|
||||||
|
showAddedColumn: settings[SETTINGS_KEYS.SHOW_ADDED_COLUMN] as boolean,
|
||||||
showUpdatedColumn: settings[SETTINGS_KEYS.SHOW_UPDATED_COLUMN] as boolean,
|
showUpdatedColumn: settings[SETTINGS_KEYS.SHOW_UPDATED_COLUMN] as boolean,
|
||||||
showCharacterColumn: settings[SETTINGS_KEYS.SHOW_CHARACTER_COLUMN] as boolean,
|
showCharacterColumn: settings[SETTINGS_KEYS.SHOW_CHARACTER_COLUMN] as boolean,
|
||||||
showCharacterPortrait: settings[SETTINGS_KEYS.SHOW_CHARACTER_PORTRAIT] as boolean,
|
showCharacterPortrait: settings[SETTINGS_KEYS.SHOW_CHARACTER_PORTRAIT] as boolean,
|
||||||
@@ -309,15 +318,17 @@ export const SystemSignaturesContent = ({
|
|||||||
style={{ maxWidth: 72, minWidth: 72, width: 72 }}
|
style={{ maxWidth: 72, minWidth: 72, width: 72 }}
|
||||||
sortable
|
sortable
|
||||||
/>
|
/>
|
||||||
<Column
|
{showGroupColumn && (
|
||||||
field="group"
|
<Column
|
||||||
header="Group"
|
field="group"
|
||||||
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
|
header="Group"
|
||||||
style={{ maxWidth: 110, minWidth: 110, width: 110 }}
|
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
|
||||||
body={sig => sig.group ?? ''}
|
style={{ maxWidth: 110, minWidth: 110, width: 110 }}
|
||||||
hidden={isCompact}
|
body={sig => sig.group ?? ''}
|
||||||
sortable
|
hidden={isCompact}
|
||||||
/>
|
sortable
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Column
|
<Column
|
||||||
field="info"
|
field="info"
|
||||||
header="Info"
|
header="Info"
|
||||||
@@ -336,15 +347,17 @@ export const SystemSignaturesContent = ({
|
|||||||
sortable
|
sortable
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Column
|
{showAddedColumn && (
|
||||||
field="inserted_at"
|
<Column
|
||||||
header="Added"
|
field="inserted_at"
|
||||||
dataType="date"
|
header="Added"
|
||||||
body={renderAddedTimeLeft}
|
dataType="date"
|
||||||
style={{ minWidth: 70, maxWidth: 80 }}
|
body={renderAddedTimeLeft}
|
||||||
bodyClassName="ssc-header text-ellipsis overflow-hidden whitespace-nowrap"
|
style={{ minWidth: 70, maxWidth: 80 }}
|
||||||
sortable
|
bodyClassName="ssc-header text-ellipsis overflow-hidden whitespace-nowrap"
|
||||||
/>
|
sortable
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{showUpdatedColumn && (
|
{showUpdatedColumn && (
|
||||||
<Column
|
<Column
|
||||||
field="updated_at"
|
field="updated_at"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { SETTINGS_KEYS, SIGNATURES_DELETION_TIMING, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures';
|
||||||
import {
|
import {
|
||||||
GroupType,
|
GroupType,
|
||||||
SignatureGroup,
|
SignatureGroup,
|
||||||
@@ -11,7 +12,6 @@ import {
|
|||||||
SignatureKindFR,
|
SignatureKindFR,
|
||||||
SignatureKindRU,
|
SignatureKindRU,
|
||||||
} from '@/hooks/Mapper/types';
|
} from '@/hooks/Mapper/types';
|
||||||
import { SETTINGS_KEYS, SIGNATURES_DELETION_TIMING, SignatureSettingsType } from '@/hooks/Mapper/constants/signatures';
|
|
||||||
|
|
||||||
export const TIME_ONE_MINUTE = 1000 * 60;
|
export const TIME_ONE_MINUTE = 1000 * 60;
|
||||||
export const TIME_TEN_MINUTES = TIME_ONE_MINUTE * 10;
|
export const TIME_TEN_MINUTES = TIME_ONE_MINUTE * 10;
|
||||||
@@ -130,6 +130,8 @@ export const SIGNATURE_SETTINGS = {
|
|||||||
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.COMBAT_SITE, name: 'Show Combat Sites' },
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.COMBAT_SITE, name: 'Show Combat Sites' },
|
||||||
],
|
],
|
||||||
uiFlags: [
|
uiFlags: [
|
||||||
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_GROUP_COLUMN, name: 'Show Group Column' },
|
||||||
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_ADDED_COLUMN, name: 'Show Added Column' },
|
||||||
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_UPDATED_COLUMN, name: 'Show Updated Column' },
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_UPDATED_COLUMN, name: 'Show Updated Column' },
|
||||||
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN, name: 'Show Description Column' },
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN, name: 'Show Description Column' },
|
||||||
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_CHARACTER_COLUMN, name: 'Show Character Column' },
|
{ type: SettingsTypes.flag, key: SETTINGS_KEYS.SHOW_CHARACTER_COLUMN, name: 'Show Character Column' },
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import React, { useEffect, useState, useCallback } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { AutoComplete } from 'primereact/autocomplete';
|
import { AutoComplete } from 'primereact/autocomplete';
|
||||||
import { Calendar } from 'primereact/calendar';
|
import { Calendar } from 'primereact/calendar';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
|
||||||
import { StructureItem, StructureStatus, statusesRequiringTimer, formatToISO } from '../helpers';
|
import { formatToISO, statusesRequiringTimer, StructureItem, StructureStatus } from '../helpers';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
interface StructuresEditDialogProps {
|
interface StructuresEditDialogProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -54,14 +54,13 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
|
|
||||||
// If user typed more text but we have partial match in prevResults
|
// If user typed more text but we have partial match in prevResults
|
||||||
if (newQuery.startsWith(prevQuery) && prevResults.length > 0) {
|
if (newQuery.startsWith(prevQuery) && prevResults.length > 0) {
|
||||||
const filtered = prevResults.filter(item =>
|
const filtered = prevResults.filter(item => item.label.toLowerCase().includes(newQuery.toLowerCase()));
|
||||||
item.label.toLowerCase().includes(newQuery.toLowerCase()),
|
|
||||||
);
|
|
||||||
setOwnerSuggestions(filtered);
|
setOwnerSuggestions(filtered);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// TODO fix it
|
||||||
const { results = [] } = await outCommand({
|
const { results = [] } = await outCommand({
|
||||||
type: OutCommand.getCorporationNames,
|
type: OutCommand.getCorporationNames,
|
||||||
data: { search: newQuery },
|
data: { search: newQuery },
|
||||||
@@ -96,9 +95,7 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
// when user picks a corp from auto-complete
|
// when user picks a corp from auto-complete
|
||||||
const handleSelectOwner = (selected: { label: string; value: string }) => {
|
const handleSelectOwner = (selected: { label: string; value: string }) => {
|
||||||
setOwnerInput(selected.label);
|
setOwnerInput(selected.label);
|
||||||
setEditData(prev =>
|
setEditData(prev => (prev ? { ...prev, ownerName: selected.label, ownerId: selected.value } : null));
|
||||||
prev ? { ...prev, ownerName: selected.label, ownerId: selected.value } : null,
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleStatusChange = (val: string) => {
|
const handleStatusChange = (val: string) => {
|
||||||
@@ -125,6 +122,7 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
// fetch corporation ticker if we have an ownerId
|
// fetch corporation ticker if we have an ownerId
|
||||||
if (editData.ownerId) {
|
if (editData.ownerId) {
|
||||||
try {
|
try {
|
||||||
|
// TODO fix it
|
||||||
const { ticker } = await outCommand({
|
const { ticker } = await outCommand({
|
||||||
type: OutCommand.getCorporationTicker,
|
type: OutCommand.getCorporationTicker,
|
||||||
data: { corp_id: editData.ownerId },
|
data: { corp_id: editData.ownerId },
|
||||||
@@ -157,11 +155,7 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
<div className="flex flex-col gap-2 text-[14px]">
|
<div className="flex flex-col gap-2 text-[14px]">
|
||||||
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
||||||
<span>Type:</span>
|
<span>Type:</span>
|
||||||
<input
|
<input readOnly className="p-inputtext p-component cursor-not-allowed" value={editData.structureType ?? ''} />
|
||||||
readOnly
|
|
||||||
className="p-inputtext p-component cursor-not-allowed"
|
|
||||||
value={editData.structureType ?? ''}
|
|
||||||
/>
|
|
||||||
</label>
|
</label>
|
||||||
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
||||||
<span>Name:</span>
|
<span>Name:</span>
|
||||||
@@ -204,10 +198,12 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
|
|
||||||
{statusesRequiringTimer.includes(editData.status) && (
|
{statusesRequiringTimer.includes(editData.status) && (
|
||||||
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center">
|
||||||
<span>Timer <br /> (Eve Time):</span>
|
<span>
|
||||||
|
Timer <br /> (Eve Time):
|
||||||
|
</span>
|
||||||
<Calendar
|
<Calendar
|
||||||
value={editData.endTime ? new Date(editData.endTime) : undefined}
|
value={editData.endTime ? new Date(editData.endTime) : undefined}
|
||||||
onChange={(e) => handleChange('endTime', e.value ?? '')}
|
onChange={e => handleChange('endTime', e.value ?? '')}
|
||||||
showTime
|
showTime
|
||||||
hourFormat="24"
|
hourFormat="24"
|
||||||
dateFormat="yy-mm-dd"
|
dateFormat="yy-mm-dd"
|
||||||
@@ -227,8 +223,8 @@ export const SystemStructuresDialog: React.FC<StructuresEditDialogProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-end items-center gap-2 mt-4">
|
<div className="flex justify-end items-center gap-2 mt-4">
|
||||||
<Button label="Delete" severity="danger" className="p-button-sm" onClick={handleDeleteClick} />
|
<WdButton label="Delete" severity="danger" className="p-button-sm" onClick={handleDeleteClick} />
|
||||||
<Button label="Save" className="p-button-sm" onClick={handleSaveClick} />
|
<WdButton label="Save" className="p-button-sm" onClick={handleSaveClick} />
|
||||||
</div>
|
</div>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,8 +16,21 @@ const SystemKillsContent = () => {
|
|||||||
} = useMapRootState();
|
} = useMapRootState();
|
||||||
|
|
||||||
const [systemId] = selectedSystems || [];
|
const [systemId] = selectedSystems || [];
|
||||||
|
const whCacheRef = useMemo(() => new Map<number, boolean>(), []);
|
||||||
|
|
||||||
const systemStaticInfo = getSystemStaticInfo(systemId)!;
|
const isWormholeSystem = useCallback(
|
||||||
|
(systemId: number): boolean => {
|
||||||
|
const cached = whCacheRef.get(systemId);
|
||||||
|
if (cached !== undefined) return cached;
|
||||||
|
|
||||||
|
const info = getSystemStaticInfo(systemId);
|
||||||
|
const isWH = info?.system_class != null ? isWormholeSpace(Number(info.system_class)) : false;
|
||||||
|
|
||||||
|
whCacheRef.set(systemId, isWH);
|
||||||
|
return isWH;
|
||||||
|
},
|
||||||
|
[whCacheRef],
|
||||||
|
);
|
||||||
|
|
||||||
const { kills, isLoading, error } = useSystemKills({
|
const { kills, isLoading, error } = useSystemKills({
|
||||||
systemId,
|
systemId,
|
||||||
@@ -30,15 +43,9 @@ const SystemKillsContent = () => {
|
|||||||
const showLoading = isLoading && kills.length === 0;
|
const showLoading = isLoading && kills.length === 0;
|
||||||
|
|
||||||
const filteredKills = useMemo(() => {
|
const filteredKills = useMemo(() => {
|
||||||
if (!settingsKills.whOnly || !settingsKills.showAll) return kills;
|
if (!settingsKills.whOnly) return kills;
|
||||||
return kills.filter(kill => {
|
return kills.filter(kill => isWormholeSystem(Number(kill.solar_system_id)));
|
||||||
if (!systemStaticInfo) {
|
}, [kills, settingsKills.whOnly, isWormholeSystem]);
|
||||||
console.warn(`System with id ${kill.solar_system_id} not found.`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return isWormholeSpace(systemStaticInfo.system_class);
|
|
||||||
});
|
|
||||||
}, [kills, settingsKills.whOnly, systemStaticInfo, settingsKills.showAll]);
|
|
||||||
|
|
||||||
if (!isSubscriptionActive) {
|
if (!isSubscriptionActive) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Dialog } from 'primereact/dialog';
|
import { Dialog } from 'primereact/dialog';
|
||||||
import { Button } from 'primereact/button';
|
import { SystemView, TooltipPosition, WdButton, WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { WdImgButton } from '@/hooks/Mapper/components/ui-kit';
|
|
||||||
import { PrimeIcons } from 'primereact/api';
|
import { PrimeIcons } from 'primereact/api';
|
||||||
import {
|
import {
|
||||||
AddSystemDialog,
|
AddSystemDialog,
|
||||||
SearchOnSubmitCallback,
|
SearchOnSubmitCallback,
|
||||||
} from '@/hooks/Mapper/components/mapInterface/components/AddSystemDialog';
|
} from '@/hooks/Mapper/components/mapInterface/components/AddSystemDialog';
|
||||||
import { SystemView, TooltipPosition } from '@/hooks/Mapper/components/ui-kit';
|
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
|
|
||||||
interface KillsSettingsDialogProps {
|
interface KillsSettingsDialogProps {
|
||||||
@@ -158,7 +156,7 @@ export const KillsSettingsDialog: React.FC<KillsSettingsDialogProps> = ({ visibl
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end mt-4">
|
<div className="flex gap-2 justify-end mt-4">
|
||||||
<Button onClick={handleApply} label="Apply" outlined size="small" />
|
<WdButton onClick={handleApply} label="Apply" outlined size="small" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
import classes from './Connections.module.scss';
|
|
||||||
import { Sidebar } from 'primereact/sidebar';
|
|
||||||
import { useEffect, useMemo, useState, useCallback } from 'react';
|
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { VirtualScroller, VirtualScrollerTemplateOptions } from 'primereact/virtualscroller';
|
|
||||||
import clsx from 'clsx';
|
|
||||||
import {
|
import {
|
||||||
ConnectionType,
|
|
||||||
ConnectionOutput,
|
|
||||||
ConnectionInfoOutput,
|
ConnectionInfoOutput,
|
||||||
|
ConnectionOutput,
|
||||||
|
ConnectionType,
|
||||||
OutCommand,
|
OutCommand,
|
||||||
Passage,
|
Passage,
|
||||||
SolarSystemConnection,
|
SolarSystemConnection,
|
||||||
} from '@/hooks/Mapper/types';
|
} from '@/hooks/Mapper/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
import { Sidebar } from 'primereact/sidebar';
|
||||||
|
import { VirtualScroller, VirtualScrollerTemplateOptions } from 'primereact/virtualscroller';
|
||||||
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
import classes from './Connections.module.scss';
|
||||||
|
|
||||||
import { PassageCard } from './PassageCard';
|
import { InfoDrawer, SystemView, TimeAgo } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { InfoDrawer, SystemView } from '@/hooks/Mapper/components/ui-kit';
|
|
||||||
import { kgToTons } from '@/hooks/Mapper/utils/kgToTons.ts';
|
import { kgToTons } from '@/hooks/Mapper/utils/kgToTons.ts';
|
||||||
import { TimeAgo } from '@/hooks/Mapper/components/ui-kit';
|
import { PassageCard } from './PassageCard';
|
||||||
|
|
||||||
const sortByDate = (a: string, b: string) => new Date(a).getTime() - new Date(b).getTime();
|
const sortByDate = (a: string, b: string) => new Date(a).getTime() - new Date(b).getTime();
|
||||||
|
|
||||||
@@ -78,7 +77,7 @@ export const Connections = ({ selectedConnection, onHide }: OnTheMapProps) => {
|
|||||||
}, [connections, selectedConnection]);
|
}, [connections, selectedConnection]);
|
||||||
|
|
||||||
const isWormhole = useMemo(() => {
|
const isWormhole = useMemo(() => {
|
||||||
return cnInfo?.type !== ConnectionType.gate;
|
return cnInfo?.type === ConnectionType.wormhole;
|
||||||
}, [cnInfo]);
|
}, [cnInfo]);
|
||||||
|
|
||||||
const [passages, setPassages] = useState<Passage[]>([]);
|
const [passages, setPassages] = useState<Passage[]>([]);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { callToastError, callToastSuccess, callToastWarn } from '@/hooks/Mapper/helpers';
|
import { callToastError, callToastSuccess, callToastWarn } from '@/hooks/Mapper/helpers';
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { ConfirmPopup } from 'primereact/confirmpopup';
|
import { ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
@@ -10,6 +9,7 @@ import { MapUserSettings, RemoteAdminSettingsResponse } from '@/hooks/Mapper/map
|
|||||||
import { parseMapUserSettings } from '@/hooks/Mapper/components/helpers';
|
import { parseMapUserSettings } from '@/hooks/Mapper/components/helpers';
|
||||||
import fastDeepEqual from 'fast-deep-equal';
|
import fastDeepEqual from 'fast-deep-equal';
|
||||||
import { useDetectSettingsChanged } from '@/hooks/Mapper/components/hooks';
|
import { useDetectSettingsChanged } from '@/hooks/Mapper/components/hooks';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
export const AdminSettings = () => {
|
export const AdminSettings = () => {
|
||||||
const {
|
const {
|
||||||
@@ -92,7 +92,7 @@ export const AdminSettings = () => {
|
|||||||
<div className="w-full h-full flex flex-col gap-5">
|
<div className="w-full h-full flex flex-col gap-5">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<WdButton
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ref={cfRef}
|
ref={cfRef}
|
||||||
onClick={cfShow}
|
onClick={cfShow}
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {
|
|||||||
import { useMapSettings } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettingsProvider.tsx';
|
import { useMapSettings } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettingsProvider.tsx';
|
||||||
import { SettingsListItem } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/types.ts';
|
import { SettingsListItem } from '@/hooks/Mapper/components/mapRootContent/components/MapSettings/types.ts';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
import { TooltipPosition, WdButton, WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { TooltipPosition, WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit';
|
|
||||||
import { ConfirmPopup } from 'primereact/confirmpopup';
|
import { ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ export const CommonSettings = () => {
|
|||||||
<div className="grid grid-cols-[1fr_auto]">
|
<div className="grid grid-cols-[1fr_auto]">
|
||||||
<div />
|
<div />
|
||||||
<WdTooltipWrapper content="This dangerous action. And can not be undone" position={TooltipPosition.top}>
|
<WdTooltipWrapper content="This dangerous action. And can not be undone" position={TooltipPosition.top}>
|
||||||
<Button
|
<WdButton
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ref={cfRef}
|
ref={cfRef}
|
||||||
className="py-[4px]"
|
className="py-[4px]"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { Divider } from 'primereact/divider';
|
import { Divider } from 'primereact/divider';
|
||||||
import { callToastError, callToastSuccess, callToastWarn } from '@/hooks/Mapper/helpers';
|
import { callToastError, callToastSuccess, callToastWarn } from '@/hooks/Mapper/helpers';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
type SaveDefaultSettingsReturn = { success: boolean; error: string };
|
type SaveDefaultSettingsReturn = { success: boolean; error: string };
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ export const DefaultSettings = () => {
|
|||||||
|
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<WdButton
|
||||||
onClick={handleSaveAsDefault}
|
onClick={handleSaveAsDefault}
|
||||||
icon="pi pi-save"
|
icon="pi pi-save"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|||||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { Toast } from 'primereact/toast';
|
import { Toast } from 'primereact/toast';
|
||||||
import { parseMapUserSettings } from '@/hooks/Mapper/components/helpers';
|
import { parseMapUserSettings } from '@/hooks/Mapper/components/helpers';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { OutCommand } from '@/hooks/Mapper/types';
|
import { OutCommand } from '@/hooks/Mapper/types';
|
||||||
import { createDefaultWidgetSettings } from '@/hooks/Mapper/mapRootProvider/helpers/createDefaultWidgetSettings.ts';
|
import { createDefaultWidgetSettings } from '@/hooks/Mapper/mapRootProvider/helpers/createDefaultWidgetSettings.ts';
|
||||||
import { callToastSuccess } from '@/hooks/Mapper/helpers';
|
import { callToastSuccess } from '@/hooks/Mapper/helpers';
|
||||||
import { ConfirmPopup } from 'primereact/confirmpopup';
|
import { ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
||||||
import { RemoteAdminSettingsResponse } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
import { RemoteAdminSettingsResponse } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
export const ServerSettings = () => {
|
export const ServerSettings = () => {
|
||||||
const {
|
const {
|
||||||
@@ -64,7 +64,7 @@ export const ServerSettings = () => {
|
|||||||
<div className="w-full h-full flex flex-col gap-5">
|
<div className="w-full h-full flex flex-col gap-5">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<WdButton
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ref={cfRef}
|
ref={cfRef}
|
||||||
onClick={cfShow}
|
onClick={cfShow}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import { PrettySwitchbox } from '@/hooks/Mapper/components/mapRootContent/compon
|
|||||||
import { WIDGETS_CHECKBOXES_PROPS, WidgetsIds } from '@/hooks/Mapper/components/mapInterface/constants.tsx';
|
import { WIDGETS_CHECKBOXES_PROPS, WidgetsIds } from '@/hooks/Mapper/components/mapInterface/constants.tsx';
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
|
|
||||||
export interface WidgetsSettingsProps {}
|
export interface WidgetsSettingsProps {}
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ export const WidgetsSettings = ({}: WidgetsSettingsProps) => {
|
|||||||
|
|
||||||
<div className="grid grid-cols-[1fr_auto]">
|
<div className="grid grid-cols-[1fr_auto]">
|
||||||
<div />
|
<div />
|
||||||
<Button className="py-[4px]" onClick={resetWidgets} outlined size="small" label="Reset Widgets"></Button>
|
<WdButton className="py-[4px]" onClick={resetWidgets} outlined size="small" label="Reset Widgets" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { Dialog } from 'primereact/dialog';
|
import { DEFAULT_SIGNATURE_SETTINGS } from '@/hooks/Mapper/constants/signatures.ts';
|
||||||
import { Button } from 'primereact/button';
|
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
||||||
import { ConfirmPopup } from 'primereact/confirmpopup';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useCallback, useRef } from 'react';
|
|
||||||
import { MapUserSettings } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
|
||||||
import {
|
import {
|
||||||
DEFAULT_KILLS_WIDGET_SETTINGS,
|
DEFAULT_KILLS_WIDGET_SETTINGS,
|
||||||
DEFAULT_ON_THE_MAP_SETTINGS,
|
DEFAULT_ON_THE_MAP_SETTINGS,
|
||||||
@@ -11,11 +9,13 @@ import {
|
|||||||
getDefaultWidgetProps,
|
getDefaultWidgetProps,
|
||||||
STORED_INTERFACE_DEFAULT_VALUES,
|
STORED_INTERFACE_DEFAULT_VALUES,
|
||||||
} from '@/hooks/Mapper/mapRootProvider/constants.ts';
|
} from '@/hooks/Mapper/mapRootProvider/constants.ts';
|
||||||
import { DEFAULT_SIGNATURE_SETTINGS } from '@/hooks/Mapper/constants/signatures.ts';
|
import { MapUserSettings } from '@/hooks/Mapper/mapRootProvider/types.ts';
|
||||||
import { Toast } from 'primereact/toast';
|
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
||||||
import { saveTextFile } from '@/hooks/Mapper/utils';
|
import { saveTextFile } from '@/hooks/Mapper/utils';
|
||||||
import { useConfirmPopup } from '@/hooks/Mapper/hooks';
|
import { ConfirmPopup } from 'primereact/confirmpopup';
|
||||||
|
import { Dialog } from 'primereact/dialog';
|
||||||
|
import { Toast } from 'primereact/toast';
|
||||||
|
import { useCallback, useRef } from 'react';
|
||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
const createSettings = function <T>(lsSettings: string | null, defaultValues: T) {
|
const createSettings = function <T>(lsSettings: string | null, defaultValues: T) {
|
||||||
return {
|
return {
|
||||||
@@ -41,7 +41,7 @@ export const OldSettingsDialog = () => {
|
|||||||
const widgetKills = localStorage.getItem('kills:widget:settings');
|
const widgetKills = localStorage.getItem('kills:widget:settings');
|
||||||
const onTheMapOld = localStorage.getItem('window:onTheMap:settings');
|
const onTheMapOld = localStorage.getItem('window:onTheMap:settings');
|
||||||
const widgetsOld = localStorage.getItem('windows:settings:v2');
|
const widgetsOld = localStorage.getItem('windows:settings:v2');
|
||||||
const signatures = localStorage.getItem('wanderer_system_signature_settings_v6_5');
|
const signatures = localStorage.getItem('wanderer_system_signature_settings_v6_6');
|
||||||
|
|
||||||
const out: MapUserSettings = {
|
const out: MapUserSettings = {
|
||||||
killsWidget: createSettings(widgetKills, DEFAULT_KILLS_WIDGET_SETTINGS),
|
killsWidget: createSettings(widgetKills, DEFAULT_KILLS_WIDGET_SETTINGS),
|
||||||
@@ -118,7 +118,7 @@ export const OldSettingsDialog = () => {
|
|||||||
localStorage.removeItem('kills:widget:settings');
|
localStorage.removeItem('kills:widget:settings');
|
||||||
localStorage.removeItem('window:onTheMap:settings');
|
localStorage.removeItem('window:onTheMap:settings');
|
||||||
localStorage.removeItem('windows:settings:v2');
|
localStorage.removeItem('windows:settings:v2');
|
||||||
localStorage.removeItem('wanderer_system_signature_settings_v6_5');
|
localStorage.removeItem('wanderer_system_signature_settings_v6_6');
|
||||||
|
|
||||||
checkOldSettings();
|
checkOldSettings();
|
||||||
}, [checkOldSettings]);
|
}, [checkOldSettings]);
|
||||||
@@ -139,7 +139,7 @@ export const OldSettingsDialog = () => {
|
|||||||
className="w-[640px] h-[400px] text-text-color min-h-0"
|
className="w-[640px] h-[400px] text-text-color min-h-0"
|
||||||
footer={
|
footer={
|
||||||
<div className="flex items-center justify-end">
|
<div className="flex items-center justify-end">
|
||||||
<Button
|
<WdButton
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
ref={cfRef}
|
ref={cfRef}
|
||||||
onClick={cfShow}
|
onClick={cfShow}
|
||||||
@@ -168,7 +168,7 @@ export const OldSettingsDialog = () => {
|
|||||||
<div className="h-[30px]"></div>
|
<div className="h-[30px]"></div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<Button
|
<WdButton
|
||||||
onClick={handleExportClipboard}
|
onClick={handleExportClipboard}
|
||||||
icon="pi pi-copy"
|
icon="pi pi-copy"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -176,7 +176,7 @@ export const OldSettingsDialog = () => {
|
|||||||
label="Export to Clipboard"
|
label="Export to Clipboard"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<WdButton
|
||||||
onClick={handleExportAsFile}
|
onClick={handleExportAsFile}
|
||||||
icon="pi pi-download"
|
icon="pi pi-download"
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@@ -8,11 +8,14 @@ import {
|
|||||||
} from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components';
|
} from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components';
|
||||||
import { InputText } from 'primereact/inputtext';
|
import { InputText } from 'primereact/inputtext';
|
||||||
import { SystemsSettingsProvider } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/Provider.tsx';
|
import { SystemsSettingsProvider } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/Provider.tsx';
|
||||||
import { Button } from 'primereact/button';
|
|
||||||
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { getWhSize } from '@/hooks/Mapper/helpers/getWhSize';
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit';
|
||||||
|
|
||||||
type SystemSignaturePrepared = Omit<SystemSignature, 'linked_system'> & { linked_system: string };
|
type SystemSignaturePrepared = Omit<SystemSignature, 'linked_system'> & {
|
||||||
|
linked_system: string;
|
||||||
|
k162Type: string;
|
||||||
|
time_status: TimeStatus;
|
||||||
|
};
|
||||||
|
|
||||||
export interface MapSettingsProps {
|
export interface MapSettingsProps {
|
||||||
systemId: string;
|
systemId: string;
|
||||||
@@ -22,10 +25,7 @@ export interface MapSettingsProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const SignatureSettings = ({ systemId, show, onHide, signatureData }: MapSettingsProps) => {
|
export const SignatureSettings = ({ systemId, show, onHide, signatureData }: MapSettingsProps) => {
|
||||||
const {
|
const { outCommand } = useMapRootState();
|
||||||
outCommand,
|
|
||||||
data: { wormholes },
|
|
||||||
} = useMapRootState();
|
|
||||||
|
|
||||||
const handleShow = async () => {};
|
const handleShow = async () => {};
|
||||||
const signatureForm = useForm<Partial<SystemSignaturePrepared>>({});
|
const signatureForm = useForm<Partial<SystemSignaturePrepared>>({});
|
||||||
@@ -52,41 +52,13 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
solar_system_target: values.linked_system,
|
solar_system_target: values.linked_system,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: need fix
|
|
||||||
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 !== undefined && whShipSize !== null) {
|
|
||||||
await outCommand({
|
|
||||||
type: OutCommand.updateConnectionShipSizeType,
|
|
||||||
data: {
|
|
||||||
source: systemId,
|
|
||||||
target: values.linked_system,
|
|
||||||
value: whShipSize,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
out = {
|
out = {
|
||||||
...out,
|
...out,
|
||||||
custom_info: JSON.stringify({
|
custom_info: JSON.stringify({
|
||||||
// TODO: need fix
|
|
||||||
k162Type: values.k162Type,
|
k162Type: values.k162Type,
|
||||||
// TODO: need fix
|
time_status: values.time_status,
|
||||||
isEOL: values.isEOL,
|
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,6 +66,10 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
out = { ...out, type: values.type };
|
out = { ...out, type: values.type };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (values.temporary_name != null) {
|
||||||
|
out = { ...out, temporary_name: values.temporary_name };
|
||||||
|
}
|
||||||
|
|
||||||
if (signatureData.group !== SignatureGroup.Wormhole) {
|
if (signatureData.group !== SignatureGroup.Wormhole) {
|
||||||
out = { ...out, name: '' };
|
out = { ...out, name: '' };
|
||||||
}
|
}
|
||||||
@@ -149,7 +125,7 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
signatureForm.reset();
|
signatureForm.reset();
|
||||||
onHide();
|
onHide();
|
||||||
},
|
},
|
||||||
[signatureData, signatureForm, outCommand, systemId, onHide, wormholes],
|
[signatureData, signatureForm, outCommand, systemId, onHide],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -161,18 +137,17 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
const { linked_system, custom_info, ...rest } = signatureData;
|
const { linked_system, custom_info, ...rest } = signatureData;
|
||||||
|
|
||||||
let k162Type = null;
|
let k162Type = null;
|
||||||
let isEOL = false;
|
let time_status = TimeStatus._24h;
|
||||||
if (custom_info) {
|
if (custom_info) {
|
||||||
const customInfo = JSON.parse(custom_info);
|
const customInfo = JSON.parse(custom_info);
|
||||||
k162Type = customInfo.k162Type;
|
k162Type = customInfo.k162Type;
|
||||||
isEOL = customInfo.isEOL;
|
time_status = customInfo.time_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
signatureForm.reset({
|
signatureForm.reset({
|
||||||
linked_system: linked_system?.solar_system_id.toString() ?? undefined,
|
linked_system: linked_system?.solar_system_id.toString() ?? undefined,
|
||||||
// TODO: need fix
|
|
||||||
k162Type: k162Type,
|
k162Type: k162Type,
|
||||||
isEOL: isEOL,
|
time_status: time_status,
|
||||||
...rest,
|
...rest,
|
||||||
});
|
});
|
||||||
}, [signatureForm, signatureData]);
|
}, [signatureForm, signatureData]);
|
||||||
@@ -181,7 +156,8 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
<Dialog
|
<Dialog
|
||||||
header={`Signature Edit [${signatureData?.eve_id}]`}
|
header={`Signature Edit [${signatureData?.eve_id}]`}
|
||||||
visible={show}
|
visible={show}
|
||||||
draggable={false}
|
draggable
|
||||||
|
resizable={false}
|
||||||
style={{ width: '390px' }}
|
style={{ width: '390px' }}
|
||||||
onShow={handleShow}
|
onShow={handleShow}
|
||||||
onHide={() => {
|
onHide={() => {
|
||||||
@@ -216,8 +192,8 @@ export const SignatureSettings = ({ systemId, show, onHide, signatureData }: Map
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 justify-end">
|
<div className="flex gap-2 justify-end px-[0.75rem] pb-[0.5rem]">
|
||||||
<Button onClick={handleSave} outlined size="small" label="Save"></Button>
|
<WdButton type="submit" outlined size="small" label="Save" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import { InputSwitch } from 'primereact/inputswitch';
|
|
||||||
import { Controller, useFormContext } from 'react-hook-form';
|
|
||||||
import { SystemSignature } from '@/hooks/Mapper/types';
|
|
||||||
|
|
||||||
export interface SignatureEOLCheckboxProps {
|
|
||||||
name: string;
|
|
||||||
defaultValue?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const SignatureEOLCheckbox = ({ name, defaultValue = false }: SignatureEOLCheckboxProps) => {
|
|
||||||
const { control } = useFormContext<SystemSignature>();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Controller
|
|
||||||
// @ts-ignore
|
|
||||||
name={name}
|
|
||||||
control={control}
|
|
||||||
defaultValue={defaultValue}
|
|
||||||
render={({ field }) => {
|
|
||||||
return <InputSwitch className="my-1" checked={!!field.value} onChange={e => field.onChange(e.value)} />;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
export * from './SignatureEOLCheckbox.tsx';
|
|
||||||
@@ -3,7 +3,8 @@ import { SystemSignature } from '@/hooks/Mapper/types';
|
|||||||
import { SignatureWormholeTypeSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect';
|
import { SignatureWormholeTypeSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect';
|
||||||
import { SignatureK162TypeSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureK162TypeSelect';
|
import { SignatureK162TypeSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureK162TypeSelect';
|
||||||
import { SignatureLeadsToSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureLeadsToSelect';
|
import { SignatureLeadsToSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureLeadsToSelect';
|
||||||
import { SignatureEOLCheckbox } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureEOLCheckbox';
|
import { SignatureLifetimeSelect } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureLifetimeSelect.tsx';
|
||||||
|
import { SignatureTempName } from '@/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureTempName.tsx';
|
||||||
|
|
||||||
export const SignatureGroupContentWormholes = () => {
|
export const SignatureGroupContentWormholes = () => {
|
||||||
const { watch } = useFormContext<SystemSignature>();
|
const { watch } = useFormContext<SystemSignature>();
|
||||||
@@ -28,9 +29,14 @@ export const SignatureGroupContentWormholes = () => {
|
|||||||
<SignatureLeadsToSelect name="linked_system" />
|
<SignatureLeadsToSelect name="linked_system" />
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-[100px_250px_1fr] gap-2 items-center text-[14px]">
|
||||||
|
<span>Lifetime:</span>
|
||||||
|
<SignatureLifetimeSelect name="time_status" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center text-[14px]">
|
<label className="grid grid-cols-[100px_250px_1fr] gap-2 items-center text-[14px]">
|
||||||
<span>EOL:</span>
|
<span>Temp. Name:</span>
|
||||||
<SignatureEOLCheckbox name="isEOL" />
|
<SignatureTempName />
|
||||||
</label>
|
</label>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
|
import { SystemSignature } from '@/hooks/Mapper/types';
|
||||||
|
import { WdLifetimeSelector } from '@/hooks/Mapper/components/ui-kit/WdLifetimeSelector.tsx';
|
||||||
|
|
||||||
|
export interface SignatureEOLCheckboxProps {
|
||||||
|
name: string;
|
||||||
|
defaultValue?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SignatureLifetimeSelect = ({ name, defaultValue = false }: SignatureEOLCheckboxProps) => {
|
||||||
|
const { control } = useFormContext<SystemSignature>();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="my-1">
|
||||||
|
<Controller
|
||||||
|
// @ts-ignore
|
||||||
|
name={name}
|
||||||
|
control={control}
|
||||||
|
defaultValue={defaultValue}
|
||||||
|
render={({ field }) => {
|
||||||
|
// @ts-ignore
|
||||||
|
return <WdLifetimeSelector lifetime={field.value} onChangeLifetime={e => field.onChange(e)} />;
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { Controller, useFormContext } from 'react-hook-form';
|
||||||
|
import { InputText } from 'primereact/inputtext';
|
||||||
|
import { SystemSignature } from '@/hooks/Mapper/types';
|
||||||
|
|
||||||
|
export const SignatureTempName = () => {
|
||||||
|
const { control } = useFormContext<SystemSignature>();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Controller
|
||||||
|
name="temporary_name"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => <InputText placeholder="Temporary Name" value={field.value} onChange={field.onChange} />}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from './SignatureGroupSelect';
|
export * from './SignatureGroupSelect';
|
||||||
export * from './SignatureGroupContent';
|
export * from './SignatureGroupContent';
|
||||||
export * from './SignatureK162TypeSelect';
|
export * from './SignatureK162TypeSelect';
|
||||||
|
export * from './SignatureLifetimeSelect';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Map, MAP_ROOT_ID } from '@/hooks/Mapper/components/map/Map.tsx';
|
import { Map, MAP_ROOT_ID } from '@/hooks/Mapper/components/map/Map.tsx';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { OutCommand, OutCommandHandler, SolarSystemConnection } from '@/hooks/Mapper/types';
|
import { CommandSelectSystems, OutCommand, OutCommandHandler, SolarSystemConnection } from '@/hooks/Mapper/types';
|
||||||
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { OnMapAddSystemCallback, OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
import { OnMapAddSystemCallback, OnMapSelectionChange } from '@/hooks/Mapper/components/map/map.types.ts';
|
||||||
import isEqual from 'lodash.isequal';
|
import isEqual from 'lodash.isequal';
|
||||||
@@ -88,6 +88,18 @@ export const MapWrapper = () => {
|
|||||||
|
|
||||||
useMapEventListener(event => {
|
useMapEventListener(event => {
|
||||||
runCommand(event);
|
runCommand(event);
|
||||||
|
|
||||||
|
if (event.name === Commands.init) {
|
||||||
|
const { selectedSystems } = ref.current;
|
||||||
|
if (selectedSystems.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
runCommand({
|
||||||
|
name: Commands.selectSystems,
|
||||||
|
data: { systems: selectedSystems } as CommandSelectSystems,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSelectionChange: OnMapSelectionChange = useCallback(
|
const onSelectionChange: OnMapSelectionChange = useCallback(
|
||||||
|
|||||||
7
assets/js/hooks/Mapper/components/ui-kit/WdButton.tsx
Normal file
7
assets/js/hooks/Mapper/components/ui-kit/WdButton.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
|
import { Button, ButtonProps } from 'primereact/button';
|
||||||
|
|
||||||
|
export const WdButton = ({ type = 'button', ...props }: ButtonProps) => {
|
||||||
|
// eslint-disable-next-line react/forbid-elements
|
||||||
|
return <Button {...props} type={type} />;
|
||||||
|
};
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { WdButton } from '@/hooks/Mapper/components/ui-kit/WdButton.tsx';
|
||||||
|
import { TimeStatus } from '@/hooks/Mapper/types';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
import { BUILT_IN_TOOLTIP_OPTIONS } from './constants.ts';
|
||||||
|
|
||||||
|
const LIFE_TIME = [
|
||||||
|
{
|
||||||
|
id: TimeStatus._1h,
|
||||||
|
label: '1H',
|
||||||
|
className: 'bg-purple-400 hover:!bg-purple-400',
|
||||||
|
inactiveClassName: 'bg-purple-400/30',
|
||||||
|
description: 'Less than one 1 hours remaining',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TimeStatus._4h,
|
||||||
|
label: '4H',
|
||||||
|
className: 'bg-purple-300 hover:!bg-purple-300',
|
||||||
|
inactiveClassName: 'bg-purple-300/30',
|
||||||
|
description: 'Less than one 4 hours remaining',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TimeStatus._4h30m,
|
||||||
|
label: '4.5H',
|
||||||
|
className: 'bg-indigo-300 hover:!bg-indigo-300',
|
||||||
|
inactiveClassName: 'bg-indigo-300/30',
|
||||||
|
description: 'Less than one 4.5 hours remaining. All small holes have such lifetime.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TimeStatus._16h,
|
||||||
|
label: '16H',
|
||||||
|
className: 'bg-orange-300 hover:!bg-orange-300',
|
||||||
|
inactiveClassName: 'bg-orange-400/30',
|
||||||
|
description: 'Less than one 16 hours remaining',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TimeStatus._24h,
|
||||||
|
label: '24H',
|
||||||
|
className: 'bg-orange-300 hover:!bg-orange-300',
|
||||||
|
inactiveClassName: 'bg-orange-400/30',
|
||||||
|
description: 'Less than one 24 hours remaining',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: TimeStatus._48h,
|
||||||
|
label: '48H',
|
||||||
|
className: 'bg-orange-300 hover:!bg-orange-300',
|
||||||
|
inactiveClassName: 'bg-orange-400/30',
|
||||||
|
description: 'Less than one 24 hours remaining. Related only with C6. B041, B520, U319, C391.',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export interface WdLifetimeSelectorProps {
|
||||||
|
lifetime?: TimeStatus;
|
||||||
|
onChangeLifetime(lifetime: TimeStatus): void;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const WdLifetimeSelector = ({
|
||||||
|
lifetime = TimeStatus._24h,
|
||||||
|
onChangeLifetime,
|
||||||
|
className,
|
||||||
|
}: WdLifetimeSelectorProps) => {
|
||||||
|
return (
|
||||||
|
<form>
|
||||||
|
<div className={clsx('grid grid-cols-[1fr_1fr_1fr_1fr_1fr_1fr] gap-1', className)}>
|
||||||
|
{LIFE_TIME.map(x => (
|
||||||
|
<WdButton
|
||||||
|
key={x.id}
|
||||||
|
outlined={false}
|
||||||
|
value={x.label}
|
||||||
|
tooltip={x.description}
|
||||||
|
tooltipOptions={BUILT_IN_TOOLTIP_OPTIONS}
|
||||||
|
size="small"
|
||||||
|
className={clsx(
|
||||||
|
`py-[1px] justify-center min-w-auto w-auto border-0 text-[12px] font-bold leading-[20px]`,
|
||||||
|
{ [x.inactiveClassName]: lifetime !== x.id },
|
||||||
|
x.className,
|
||||||
|
)}
|
||||||
|
onClick={() => onChangeLifetime(x.id)}
|
||||||
|
>
|
||||||
|
{x.label}
|
||||||
|
</WdButton>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -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)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
6
assets/js/hooks/Mapper/components/ui-kit/constants.ts
Normal file
6
assets/js/hooks/Mapper/components/ui-kit/constants.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const BUILT_IN_TOOLTIP_OPTIONS = {
|
||||||
|
mouseTrack: true,
|
||||||
|
mouseTrackLeft: 10,
|
||||||
|
className:
|
||||||
|
'rounded-[3px] bg-stone-900/90 px-1 py-1 [&_.p-tooltip-text]:!text-stone-300 text-[13px] [&_.p-tooltip-text]:!p-1',
|
||||||
|
};
|
||||||
@@ -21,3 +21,5 @@ export * from './LoadingWrapper';
|
|||||||
export * from './WdMenuItem';
|
export * from './WdMenuItem';
|
||||||
export * from './MenuItemWithInfo';
|
export * from './MenuItemWithInfo';
|
||||||
export * from './MarkdownTextViewer.tsx';
|
export * from './MarkdownTextViewer.tsx';
|
||||||
|
export * from './WdButton.tsx';
|
||||||
|
export * from './constants.ts';
|
||||||
|
|||||||
@@ -12,14 +12,16 @@ export enum SETTINGS_KEYS {
|
|||||||
SORT_FIELD = 'sortField',
|
SORT_FIELD = 'sortField',
|
||||||
SORT_ORDER = 'sortOrder',
|
SORT_ORDER = 'sortOrder',
|
||||||
|
|
||||||
SHOW_DESCRIPTION_COLUMN = 'show_description_column',
|
SHOW_ADDED_COLUMN = 'show_added_column',
|
||||||
SHOW_UPDATED_COLUMN = 'show_updated_column',
|
|
||||||
SHOW_CHARACTER_COLUMN = 'show_character_column',
|
SHOW_CHARACTER_COLUMN = 'show_character_column',
|
||||||
|
SHOW_CHARACTER_PORTRAIT = 'show_character_portrait',
|
||||||
|
SHOW_DESCRIPTION_COLUMN = 'show_description_column',
|
||||||
|
SHOW_GROUP_COLUMN = 'show_group_column',
|
||||||
|
SHOW_UPDATED_COLUMN = 'show_updated_column',
|
||||||
LAZY_DELETE_SIGNATURES = 'lazy_delete_signatures',
|
LAZY_DELETE_SIGNATURES = 'lazy_delete_signatures',
|
||||||
KEEP_LAZY_DELETE = 'keep_lazy_delete_enabled',
|
KEEP_LAZY_DELETE = 'keep_lazy_delete_enabled',
|
||||||
DELETION_TIMING = 'deletion_timing',
|
DELETION_TIMING = 'deletion_timing',
|
||||||
COLOR_BY_TYPE = 'color_by_type',
|
COLOR_BY_TYPE = 'color_by_type',
|
||||||
SHOW_CHARACTER_PORTRAIT = 'show_character_portrait',
|
|
||||||
|
|
||||||
// From SignatureKind
|
// From SignatureKind
|
||||||
COSMIC_ANOMALY = SignatureKind.CosmicAnomaly,
|
COSMIC_ANOMALY = SignatureKind.CosmicAnomaly,
|
||||||
@@ -45,6 +47,8 @@ export const DEFAULT_SIGNATURE_SETTINGS: SignatureSettingsType = {
|
|||||||
[SETTINGS_KEYS.SORT_FIELD]: 'inserted_at',
|
[SETTINGS_KEYS.SORT_FIELD]: 'inserted_at',
|
||||||
[SETTINGS_KEYS.SORT_ORDER]: -1,
|
[SETTINGS_KEYS.SORT_ORDER]: -1,
|
||||||
|
|
||||||
|
[SETTINGS_KEYS.SHOW_GROUP_COLUMN]: true,
|
||||||
|
[SETTINGS_KEYS.SHOW_ADDED_COLUMN]: true,
|
||||||
[SETTINGS_KEYS.SHOW_UPDATED_COLUMN]: true,
|
[SETTINGS_KEYS.SHOW_UPDATED_COLUMN]: true,
|
||||||
[SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN]: true,
|
[SETTINGS_KEYS.SHOW_DESCRIPTION_COLUMN]: true,
|
||||||
[SETTINGS_KEYS.SHOW_CHARACTER_COLUMN]: true,
|
[SETTINGS_KEYS.SHOW_CHARACTER_COLUMN]: true,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export * from './useClipboard';
|
export * from './useClipboard';
|
||||||
|
export * from './useConfirmPopup';
|
||||||
|
export * from './useEventBuffer';
|
||||||
export * from './useHotkey';
|
export * from './useHotkey';
|
||||||
export * from './usePageVisibility';
|
export * from './usePageVisibility';
|
||||||
export * from './useSkipContextMenu';
|
export * from './useSkipContextMenu';
|
||||||
export * from './useThrottle';
|
export * from './useThrottle';
|
||||||
export * from './useConfirmPopup';
|
|
||||||
|
|||||||
41
assets/js/hooks/Mapper/hooks/useEventBuffer.ts
Normal file
41
assets/js/hooks/Mapper/hooks/useEventBuffer.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import debounce from 'lodash.debounce';
|
||||||
|
import { useCallback, useRef } from 'react';
|
||||||
|
export type UseEventBufferHandler<T> = (event: T) => void;
|
||||||
|
|
||||||
|
export const useEventBuffer = <T>(handler: UseEventBufferHandler<T>) => {
|
||||||
|
// @ts-ignore
|
||||||
|
const eventsBufferRef = useRef<T[]>([]);
|
||||||
|
|
||||||
|
const eventTick = useCallback(
|
||||||
|
debounce(() => {
|
||||||
|
if (eventsBufferRef.current.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const event = eventsBufferRef.current.shift()!;
|
||||||
|
handler(event);
|
||||||
|
|
||||||
|
// TODO - do not delete THIS code it needs for debug
|
||||||
|
// console.log('JOipP', `Tick Buff`, eventsBufferRef.current.length);
|
||||||
|
|
||||||
|
if (eventsBufferRef.current.length > 0) {
|
||||||
|
eventTick();
|
||||||
|
}
|
||||||
|
}, 10),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
const eventTickRef = useRef(eventTick);
|
||||||
|
eventTickRef.current = eventTick;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const handleEvent = useCallback(event => {
|
||||||
|
if (!eventTickRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
eventsBufferRef.current.push(event);
|
||||||
|
eventTickRef.current();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return { handleEvent };
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useCallback } from 'react';
|
|
||||||
import { CommandInit } from '@/hooks/Mapper/types';
|
|
||||||
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
import { MapRootData, useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
||||||
import { useLoadSystemStatic } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic.ts';
|
import { useLoadSystemStatic } from '@/hooks/Mapper/mapRootProvider/hooks/useLoadSystemStatic.ts';
|
||||||
|
import { CommandInit } from '@/hooks/Mapper/types';
|
||||||
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
export const useMapInit = () => {
|
export const useMapInit = () => {
|
||||||
const { update } = useMapRootState();
|
const { update } = useMapRootState();
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { ForwardedRef, useImperativeHandle } from 'react';
|
|
||||||
import {
|
import {
|
||||||
CommandAddConnections,
|
CommandAddConnections,
|
||||||
CommandAddSystems,
|
CommandAddSystems,
|
||||||
@@ -8,24 +7,25 @@ import {
|
|||||||
CommandCharactersUpdated,
|
CommandCharactersUpdated,
|
||||||
CommandCharacterUpdated,
|
CommandCharacterUpdated,
|
||||||
CommandCommentAdd,
|
CommandCommentAdd,
|
||||||
|
CommandCommentRemoved,
|
||||||
CommandInit,
|
CommandInit,
|
||||||
CommandLinkSignatureToSystem,
|
CommandLinkSignatureToSystem,
|
||||||
CommandMapUpdated,
|
CommandMapUpdated,
|
||||||
|
CommandPingAdded,
|
||||||
|
CommandPingCancelled,
|
||||||
CommandPresentCharacters,
|
CommandPresentCharacters,
|
||||||
CommandRemoveConnections,
|
CommandRemoveConnections,
|
||||||
CommandRemoveSystems,
|
CommandRemoveSystems,
|
||||||
CommandRoutes,
|
CommandRoutes,
|
||||||
|
Commands,
|
||||||
CommandSignaturesUpdated,
|
CommandSignaturesUpdated,
|
||||||
CommandTrackingCharactersData,
|
CommandTrackingCharactersData,
|
||||||
CommandUpdateConnection,
|
CommandUpdateConnection,
|
||||||
CommandUpdateSystems,
|
CommandUpdateSystems,
|
||||||
CommandUserSettingsUpdated,
|
CommandUserSettingsUpdated,
|
||||||
Commands,
|
|
||||||
MapHandlers,
|
MapHandlers,
|
||||||
CommandCommentRemoved,
|
|
||||||
CommandPingAdded,
|
|
||||||
CommandPingCancelled,
|
|
||||||
} from '@/hooks/Mapper/types/mapHandlers.ts';
|
} from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
|
import { ForwardedRef, useImperativeHandle } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useCommandComments,
|
useCommandComments,
|
||||||
@@ -39,9 +39,9 @@ import {
|
|||||||
useUserRoutes,
|
useUserRoutes,
|
||||||
} from './api';
|
} from './api';
|
||||||
|
|
||||||
import { useCommandsActivity } from './api/useCommandsActivity';
|
|
||||||
import { emitMapEvent } from '@/hooks/Mapper/events';
|
import { emitMapEvent } from '@/hooks/Mapper/events';
|
||||||
import { DetailedKill } from '../../types/kills';
|
import { DetailedKill } from '../../types/kills';
|
||||||
|
import { useCommandsActivity } from './api/useCommandsActivity';
|
||||||
|
|
||||||
export const useMapRootHandlers = (ref: ForwardedRef<MapHandlers>) => {
|
export const useMapRootHandlers = (ref: ForwardedRef<MapHandlers>) => {
|
||||||
const mapInit = useMapInit();
|
const mapInit = useMapInit();
|
||||||
@@ -63,127 +63,123 @@ export const useMapRootHandlers = (ref: ForwardedRef<MapHandlers>) => {
|
|||||||
const { pingAdded, pingCancelled } = useCommandPings();
|
const { pingAdded, pingCancelled } = useCommandPings();
|
||||||
const { characterActivityData, trackingCharactersData, userSettingsUpdated } = useCommandsActivity();
|
const { characterActivityData, trackingCharactersData, userSettingsUpdated } = useCommandsActivity();
|
||||||
|
|
||||||
useImperativeHandle(
|
useImperativeHandle(ref, () => {
|
||||||
ref,
|
return {
|
||||||
() => {
|
command(type, data) {
|
||||||
return {
|
switch (type) {
|
||||||
command(type, data) {
|
case Commands.init: // USED
|
||||||
switch (type) {
|
mapInit(data as CommandInit);
|
||||||
case Commands.init: // USED
|
break;
|
||||||
mapInit(data as CommandInit);
|
case Commands.addSystems: // USED
|
||||||
break;
|
addSystems(data as CommandAddSystems);
|
||||||
case Commands.addSystems: // USED
|
break;
|
||||||
addSystems(data as CommandAddSystems);
|
case Commands.updateSystems: // USED
|
||||||
break;
|
updateSystems(data as CommandUpdateSystems);
|
||||||
case Commands.updateSystems: // USED
|
break;
|
||||||
updateSystems(data as CommandUpdateSystems);
|
case Commands.removeSystems: // USED
|
||||||
break;
|
removeSystems(data as CommandRemoveSystems);
|
||||||
case Commands.removeSystems: // USED
|
break;
|
||||||
removeSystems(data as CommandRemoveSystems);
|
case Commands.addConnections: // USED
|
||||||
break;
|
addConnections(data as CommandAddConnections);
|
||||||
case Commands.addConnections: // USED
|
break;
|
||||||
addConnections(data as CommandAddConnections);
|
case Commands.removeConnections: // USED
|
||||||
break;
|
removeConnections(data as CommandRemoveConnections);
|
||||||
case Commands.removeConnections: // USED
|
break;
|
||||||
removeConnections(data as CommandRemoveConnections);
|
case Commands.updateConnection: // USED
|
||||||
break;
|
updateConnection(data as CommandUpdateConnection);
|
||||||
case Commands.updateConnection: // USED
|
break;
|
||||||
updateConnection(data as CommandUpdateConnection);
|
case Commands.charactersUpdated: // USED
|
||||||
break;
|
charactersUpdated(data as CommandCharactersUpdated);
|
||||||
case Commands.charactersUpdated: // USED
|
break;
|
||||||
charactersUpdated(data as CommandCharactersUpdated);
|
case Commands.characterAdded: // USED
|
||||||
break;
|
characterAdded(data as CommandCharacterAdded);
|
||||||
case Commands.characterAdded: // USED
|
break;
|
||||||
characterAdded(data as CommandCharacterAdded);
|
case Commands.characterRemoved: // USED
|
||||||
break;
|
characterRemoved(data as CommandCharacterRemoved);
|
||||||
case Commands.characterRemoved: // USED
|
break;
|
||||||
characterRemoved(data as CommandCharacterRemoved);
|
case Commands.characterUpdated: // USED
|
||||||
break;
|
characterUpdated(data as CommandCharacterUpdated);
|
||||||
case Commands.characterUpdated: // USED
|
break;
|
||||||
characterUpdated(data as CommandCharacterUpdated);
|
case Commands.presentCharacters: // USED
|
||||||
break;
|
presentCharacters(data as CommandPresentCharacters);
|
||||||
case Commands.presentCharacters: // USED
|
break;
|
||||||
presentCharacters(data as CommandPresentCharacters);
|
case Commands.mapUpdated: // USED
|
||||||
break;
|
mapUpdated(data as CommandMapUpdated);
|
||||||
case Commands.mapUpdated: // USED
|
break;
|
||||||
mapUpdated(data as CommandMapUpdated);
|
case Commands.routes:
|
||||||
break;
|
mapRoutes(data as CommandRoutes);
|
||||||
case Commands.routes:
|
break;
|
||||||
mapRoutes(data as CommandRoutes);
|
case Commands.userRoutes:
|
||||||
break;
|
mapUserRoutes(data as CommandRoutes);
|
||||||
case Commands.userRoutes:
|
break;
|
||||||
mapUserRoutes(data as CommandRoutes);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Commands.signaturesUpdated: // USED
|
case Commands.signaturesUpdated: // USED
|
||||||
updateSystemSignatures(data as CommandSignaturesUpdated);
|
updateSystemSignatures(data as CommandSignaturesUpdated);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.linkSignatureToSystem: // USED
|
case Commands.linkSignatureToSystem: // USED
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
updateLinkSignatureToSystem(data as CommandLinkSignatureToSystem);
|
updateLinkSignatureToSystem(data as CommandLinkSignatureToSystem);
|
||||||
}, 200);
|
}, 200);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.centerSystem: // USED
|
case Commands.centerSystem: // USED
|
||||||
// do nothing here
|
// do nothing here
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.selectSystem: // USED
|
case Commands.selectSystem: // USED
|
||||||
// do nothing here
|
// do nothing here
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.killsUpdated:
|
case Commands.killsUpdated:
|
||||||
// do nothing here
|
// do nothing here
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.detailedKillsUpdated:
|
case Commands.detailedKillsUpdated:
|
||||||
updateDetailedKills(data as Record<string, DetailedKill[]>);
|
updateDetailedKills(data as Record<string, DetailedKill[]>);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.characterActivityData:
|
case Commands.characterActivityData:
|
||||||
characterActivityData(data as CommandCharacterActivityData);
|
characterActivityData(data as CommandCharacterActivityData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.trackingCharactersData:
|
case Commands.trackingCharactersData:
|
||||||
trackingCharactersData(data as CommandTrackingCharactersData);
|
trackingCharactersData(data as CommandTrackingCharactersData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.updateActivity:
|
case Commands.updateActivity:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.updateTracking:
|
case Commands.updateTracking:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.userSettingsUpdated:
|
case Commands.userSettingsUpdated:
|
||||||
userSettingsUpdated(data as CommandUserSettingsUpdated);
|
userSettingsUpdated(data as CommandUserSettingsUpdated);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.systemCommentAdded:
|
case Commands.systemCommentAdded:
|
||||||
addComment(data as CommandCommentAdd);
|
addComment(data as CommandCommentAdd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.systemCommentRemoved:
|
case Commands.systemCommentRemoved:
|
||||||
removeComment(data as CommandCommentRemoved);
|
removeComment(data as CommandCommentRemoved);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.pingAdded:
|
case Commands.pingAdded:
|
||||||
pingAdded(data as CommandPingAdded);
|
pingAdded(data as CommandPingAdded);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Commands.pingCancelled:
|
case Commands.pingCancelled:
|
||||||
pingCancelled(data as CommandPingCancelled);
|
pingCancelled(data as CommandPingCancelled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.warn(`JOipP Interface handlers: Unknown command: ${type}`, data);
|
console.warn(`JOipP Interface handlers: Unknown command: ${type}`, data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
emitMapEvent({ name: type, data });
|
emitMapEvent({ name: type, data });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
}, []);
|
||||||
[],
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export enum ConnectionType {
|
export enum ConnectionType {
|
||||||
wormhole,
|
wormhole,
|
||||||
gate,
|
gate,
|
||||||
|
bridge,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MassState {
|
export enum MassState {
|
||||||
@@ -10,8 +11,13 @@ export enum MassState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export enum TimeStatus {
|
export enum TimeStatus {
|
||||||
default,
|
reserved, // TODO: this reserved for not broke prev solution
|
||||||
eol,
|
_1h,
|
||||||
|
_4h,
|
||||||
|
_4h30m,
|
||||||
|
_16h,
|
||||||
|
_24h,
|
||||||
|
_48h,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ShipSizeStatus {
|
export enum ShipSizeStatus {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export enum Commands {
|
|||||||
userRoutes = 'user_routes',
|
userRoutes = 'user_routes',
|
||||||
centerSystem = 'center_system',
|
centerSystem = 'center_system',
|
||||||
selectSystem = 'select_system',
|
selectSystem = 'select_system',
|
||||||
|
selectSystems = 'select_systems',
|
||||||
linkSignatureToSystem = 'link_signature_to_system',
|
linkSignatureToSystem = 'link_signature_to_system',
|
||||||
signaturesUpdated = 'signatures_updated',
|
signaturesUpdated = 'signatures_updated',
|
||||||
systemCommentAdded = 'system_comment_added',
|
systemCommentAdded = 'system_comment_added',
|
||||||
@@ -60,6 +61,7 @@ export type Command =
|
|||||||
| Commands.routes
|
| Commands.routes
|
||||||
| Commands.userRoutes
|
| Commands.userRoutes
|
||||||
| Commands.selectSystem
|
| Commands.selectSystem
|
||||||
|
| Commands.selectSystems
|
||||||
| Commands.centerSystem
|
| Commands.centerSystem
|
||||||
| Commands.linkSignatureToSystem
|
| Commands.linkSignatureToSystem
|
||||||
| Commands.signaturesUpdated
|
| Commands.signaturesUpdated
|
||||||
@@ -118,6 +120,10 @@ export type CommandUserRoutes = RoutesList;
|
|||||||
export type CommandKillsUpdated = Kill[];
|
export type CommandKillsUpdated = Kill[];
|
||||||
export type CommandDetailedKillsUpdated = Record<string, DetailedKill[]>;
|
export type CommandDetailedKillsUpdated = Record<string, DetailedKill[]>;
|
||||||
export type CommandSelectSystem = string | undefined;
|
export type CommandSelectSystem = string | undefined;
|
||||||
|
export type CommandSelectSystems = {
|
||||||
|
systems: string[];
|
||||||
|
delay?: number;
|
||||||
|
};
|
||||||
export type CommandCenterSystem = string | undefined;
|
export type CommandCenterSystem = string | undefined;
|
||||||
export type CommandLinkSignatureToSystem = {
|
export type CommandLinkSignatureToSystem = {
|
||||||
solar_system_source: number;
|
solar_system_source: number;
|
||||||
@@ -187,6 +193,7 @@ export interface CommandData {
|
|||||||
[Commands.killsUpdated]: CommandKillsUpdated;
|
[Commands.killsUpdated]: CommandKillsUpdated;
|
||||||
[Commands.detailedKillsUpdated]: CommandDetailedKillsUpdated;
|
[Commands.detailedKillsUpdated]: CommandDetailedKillsUpdated;
|
||||||
[Commands.selectSystem]: CommandSelectSystem;
|
[Commands.selectSystem]: CommandSelectSystem;
|
||||||
|
[Commands.selectSystems]: CommandSelectSystems;
|
||||||
[Commands.centerSystem]: CommandCenterSystem;
|
[Commands.centerSystem]: CommandCenterSystem;
|
||||||
[Commands.linkSignatureToSystem]: CommandLinkSignatureToSystem;
|
[Commands.linkSignatureToSystem]: CommandLinkSignatureToSystem;
|
||||||
[Commands.signaturesUpdated]: CommandLinkSignaturesUpdated;
|
[Commands.signaturesUpdated]: CommandLinkSignaturesUpdated;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export type SystemSignature = {
|
|||||||
inserted_at?: string;
|
inserted_at?: string;
|
||||||
updated_at?: string;
|
updated_at?: string;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
temporary_name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface ExtendedSystemSignature extends SystemSignature {
|
export interface ExtendedSystemSignature extends SystemSignature {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import { useEventBuffer } from '@/hooks/Mapper/hooks';
|
||||||
|
import usePageVisibility from '@/hooks/Mapper/hooks/usePageVisibility.ts';
|
||||||
|
|
||||||
import { MapHandlers } from '@/hooks/Mapper/types/mapHandlers.ts';
|
import { MapHandlers } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||||
import { RefObject, useCallback, useEffect, useRef } from 'react';
|
import { RefObject, useCallback, useEffect, useRef } from 'react';
|
||||||
import debounce from 'lodash.debounce';
|
|
||||||
import usePageVisibility from '@/hooks/Mapper/hooks/usePageVisibility.ts';
|
|
||||||
|
|
||||||
// const inIndex = 0;
|
// const inIndex = 0;
|
||||||
// const prevEventTime = +new Date();
|
// const prevEventTime = +new Date();
|
||||||
@@ -10,10 +11,28 @@ const LAST_VERSION_KEY = 'wandererLastVersion';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const useMapperHandlers = (handlerRefs: RefObject<MapHandlers>[], hooksRef: RefObject<any>) => {
|
export const useMapperHandlers = (handlerRefs: RefObject<MapHandlers>[], hooksRef: RefObject<any>) => {
|
||||||
const visible = usePageVisibility();
|
const visible = usePageVisibility();
|
||||||
|
|
||||||
const wasHiddenOnce = useRef(false);
|
const wasHiddenOnce = useRef(false);
|
||||||
const visibleRef = useRef(visible);
|
const visibleRef = useRef(visible);
|
||||||
visibleRef.current = visible;
|
visibleRef.current = visible;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
const handleBufferedEvent = useCallback(({ type, body }) => {
|
||||||
|
if (!visibleRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
handlerRefs.forEach(ref => {
|
||||||
|
if (!ref.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ref.current?.command(type, body);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const { handleEvent: handleMapEvent } = useEventBuffer<any>(handleBufferedEvent);
|
||||||
|
|
||||||
// TODO - do not delete THIS code it needs for debug
|
// TODO - do not delete THIS code it needs for debug
|
||||||
// const [record, setRecord] = useLocalStorageState<boolean>('record', {
|
// const [record, setRecord] = useLocalStorageState<boolean>('record', {
|
||||||
// defaultValue: false,
|
// defaultValue: false,
|
||||||
@@ -54,52 +73,6 @@ export const useMapperHandlers = (handlerRefs: RefObject<MapHandlers>[], hooksRe
|
|||||||
[hooksRef.current],
|
[hooksRef.current],
|
||||||
);
|
);
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const eventsBufferRef = useRef<{ type; body }[]>([]);
|
|
||||||
|
|
||||||
const eventTick = useCallback(
|
|
||||||
debounce(() => {
|
|
||||||
if (eventsBufferRef.current.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { type, body } = eventsBufferRef.current.shift()!;
|
|
||||||
handlerRefs.forEach(ref => {
|
|
||||||
if (!ref.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ref.current?.command(type, body);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO - do not delete THIS code it needs for debug
|
|
||||||
// console.log('JOipP', `Tick Buff`, eventsBufferRef.current.length);
|
|
||||||
|
|
||||||
if (eventsBufferRef.current.length > 0) {
|
|
||||||
eventTick();
|
|
||||||
}
|
|
||||||
}, 10),
|
|
||||||
[],
|
|
||||||
);
|
|
||||||
const eventTickRef = useRef(eventTick);
|
|
||||||
eventTickRef.current = eventTick;
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
const handleMapEvent = useCallback(({ type, body }) => {
|
|
||||||
// TODO - do not delete THIS code it needs for debug
|
|
||||||
// const currentTime = +new Date();
|
|
||||||
// const timeDiff = currentTime - prevEventTime;
|
|
||||||
// prevEventTime = currentTime;
|
|
||||||
// console.log('JOipP', `IN [${inIndex++}] [${timeDiff}] ${getFormattedTime()}`, { type, body });
|
|
||||||
|
|
||||||
if (!eventTickRef.current || !visibleRef.current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventsBufferRef.current.push({ type, body });
|
|
||||||
eventTickRef.current();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible && !wasHiddenOnce.current) {
|
if (!visible && !wasHiddenOnce.current) {
|
||||||
wasHiddenOnce.current = true;
|
wasHiddenOnce.current = true;
|
||||||
|
|||||||
132
assets/js/hooks/Mapper/utils/flattenValues.ts
Normal file
132
assets/js/hooks/Mapper/utils/flattenValues.ts
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
const TYPE_ORDER = [
|
||||||
|
'undefined',
|
||||||
|
'null',
|
||||||
|
'boolean',
|
||||||
|
'number',
|
||||||
|
'bigint',
|
||||||
|
'string',
|
||||||
|
'symbol',
|
||||||
|
'function',
|
||||||
|
'date',
|
||||||
|
'regexp',
|
||||||
|
'other',
|
||||||
|
] as const;
|
||||||
|
type TypeTag = (typeof TYPE_ORDER)[number];
|
||||||
|
|
||||||
|
const getTypeTag = (v: unknown): TypeTag => {
|
||||||
|
if (v === undefined) return 'undefined';
|
||||||
|
if (v === null) return 'null';
|
||||||
|
const t = typeof v;
|
||||||
|
if (t === 'boolean' || t === 'number' || t === 'bigint' || t === 'string' || t === 'symbol' || t === 'function')
|
||||||
|
return t as TypeTag;
|
||||||
|
const tag = Object.prototype.toString.call(v);
|
||||||
|
if (tag === '[object Date]') return 'date';
|
||||||
|
if (tag === '[object RegExp]') return 'regexp';
|
||||||
|
return 'other';
|
||||||
|
};
|
||||||
|
|
||||||
|
const cmp = (a: unknown, b: unknown): number => {
|
||||||
|
const ta = getTypeTag(a);
|
||||||
|
const tb = getTypeTag(b);
|
||||||
|
if (ta !== tb) return TYPE_ORDER.indexOf(ta) - TYPE_ORDER.indexOf(tb);
|
||||||
|
|
||||||
|
switch (ta) {
|
||||||
|
case 'undefined':
|
||||||
|
case 'null':
|
||||||
|
return 0;
|
||||||
|
case 'boolean':
|
||||||
|
return (a as boolean) === (b as boolean) ? 0 : a ? 1 : -1;
|
||||||
|
case 'number': {
|
||||||
|
const na = a as number,
|
||||||
|
nb = b as number;
|
||||||
|
const aIsNaN = Number.isNaN(na),
|
||||||
|
bIsNaN = Number.isNaN(nb);
|
||||||
|
if (aIsNaN || bIsNaN) return aIsNaN && bIsNaN ? 0 : aIsNaN ? 1 : -1; // NaN в конец чисел
|
||||||
|
return na === nb ? 0 : na < nb ? -1 : 1;
|
||||||
|
}
|
||||||
|
case 'bigint': {
|
||||||
|
const ba = a as bigint,
|
||||||
|
bb = b as bigint;
|
||||||
|
return ba === bb ? 0 : ba < bb ? -1 : 1;
|
||||||
|
}
|
||||||
|
case 'string':
|
||||||
|
return (a as string).localeCompare(b as string);
|
||||||
|
case 'symbol': {
|
||||||
|
const da = (a as symbol).description ?? '';
|
||||||
|
const db = (b as symbol).description ?? '';
|
||||||
|
return da.localeCompare(db);
|
||||||
|
}
|
||||||
|
case 'function':
|
||||||
|
// @ts-ignore
|
||||||
|
return ((a as Function).name || '').localeCompare((b as Function).name || '');
|
||||||
|
case 'date':
|
||||||
|
return (a as Date).getTime() - (b as Date).getTime();
|
||||||
|
case 'regexp':
|
||||||
|
return a!.toString().localeCompare(b!.toString());
|
||||||
|
default:
|
||||||
|
return String(a).localeCompare(String(b));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const isIterable = (v: unknown): v is Iterable<unknown> =>
|
||||||
|
v != null && typeof (v as any)[Symbol.iterator] === 'function';
|
||||||
|
|
||||||
|
const pushTypedArrayValues = (v: unknown, out: unknown[]) => {
|
||||||
|
if (ArrayBuffer.isView(v) && !(v instanceof DataView)) {
|
||||||
|
// @ts-ignore
|
||||||
|
out.push(...(v as ArrayLike<number> as any));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate this func with ChatGPT 5. Cause it pure func and looks like what i need
|
||||||
|
* May be in net we can find smtng like that
|
||||||
|
* @param input
|
||||||
|
*/
|
||||||
|
export const flattenValues = (input: unknown): unknown[] => {
|
||||||
|
const out: unknown[] = [];
|
||||||
|
const seen = new WeakSet<object>();
|
||||||
|
|
||||||
|
const visit = (v: unknown): void => {
|
||||||
|
const tag = getTypeTag(v);
|
||||||
|
if (tag !== 'other') {
|
||||||
|
out.push(v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v && typeof v === 'object') {
|
||||||
|
if (seen.has(v)) return;
|
||||||
|
seen.add(v);
|
||||||
|
|
||||||
|
if (pushTypedArrayValues(v, out)) return;
|
||||||
|
|
||||||
|
if (v instanceof Map) {
|
||||||
|
for (const val of v.values()) visit(val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v instanceof Set) {
|
||||||
|
for (const val of v.values()) visit(val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(v) || isIterable(v)) {
|
||||||
|
for (const item of v as Iterable<unknown>) visit(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(v)) {
|
||||||
|
// @ts-ignore
|
||||||
|
visit((v as never)[key]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
out.push(v);
|
||||||
|
};
|
||||||
|
|
||||||
|
visit(input);
|
||||||
|
return out.sort(cmp);
|
||||||
|
};
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
"sass-loader": "^14.2.1",
|
"sass-loader": "^14.2.1",
|
||||||
"ts-jest": "^29.1.2",
|
"ts-jest": "^29.1.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.0.5",
|
"vite": "^6.3.5",
|
||||||
"vite-plugin-cdn-import": "^1.0.1"
|
"vite-plugin-cdn-import": "^1.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
5377
assets/yarn.lock
5377
assets/yarn.lock
File diff suppressed because it is too large
Load Diff
82
clean_changelog.py
Normal file
82
clean_changelog.py
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Script to clean up CHANGELOG.md by removing empty version entries.
|
||||||
|
An empty version entry has only a version header followed by empty lines,
|
||||||
|
without any actual content (### Bug Fixes: or ### Features: sections).
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
def clean_changelog():
|
||||||
|
with open('./CHANGELOG.md', 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Split content into sections based on version headers
|
||||||
|
version_pattern = r'^## \[v\d+\.\d+\.\d+\].*?\([^)]+\)$'
|
||||||
|
|
||||||
|
# Find all version headers with their positions
|
||||||
|
matches = list(re.finditer(version_pattern, content, re.MULTILINE))
|
||||||
|
|
||||||
|
# Build new content by keeping only non-empty versions
|
||||||
|
new_content = ""
|
||||||
|
|
||||||
|
# Keep the header (everything before first version)
|
||||||
|
if matches:
|
||||||
|
new_content += content[:matches[0].start()]
|
||||||
|
else:
|
||||||
|
# No versions found, keep original
|
||||||
|
return content
|
||||||
|
|
||||||
|
for i, match in enumerate(matches):
|
||||||
|
version_start = match.start()
|
||||||
|
|
||||||
|
# Find the end of this version section (start of next version or end of file)
|
||||||
|
if i + 1 < len(matches):
|
||||||
|
version_end = matches[i + 1].start()
|
||||||
|
else:
|
||||||
|
version_end = len(content)
|
||||||
|
|
||||||
|
version_section = content[version_start:version_end]
|
||||||
|
|
||||||
|
# Check if this version has actual content
|
||||||
|
# Look for ### Bug Fixes: or ### Features: followed by actual content
|
||||||
|
has_content = False
|
||||||
|
|
||||||
|
# Split the section into lines
|
||||||
|
lines = version_section.split('\n')
|
||||||
|
|
||||||
|
# Look for content sections
|
||||||
|
in_content_section = False
|
||||||
|
for line in lines:
|
||||||
|
line_stripped = line.strip()
|
||||||
|
|
||||||
|
# Check if we're entering a content section
|
||||||
|
if line_stripped.startswith('### Bug Fixes:') or line_stripped.startswith('### Features:'):
|
||||||
|
in_content_section = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
# If we're in a content section and find non-empty content
|
||||||
|
if in_content_section:
|
||||||
|
if line_stripped and not line_stripped.startswith('###') and not line_stripped.startswith('##'):
|
||||||
|
# This is actual content (not just another header)
|
||||||
|
if line_stripped.startswith('*') or len(line_stripped) > 0:
|
||||||
|
has_content = True
|
||||||
|
break
|
||||||
|
elif line_stripped.startswith('##'):
|
||||||
|
# We've reached the next version, stop looking
|
||||||
|
break
|
||||||
|
|
||||||
|
# Only keep versions with actual content
|
||||||
|
if has_content:
|
||||||
|
new_content += version_section
|
||||||
|
|
||||||
|
return new_content
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
cleaned_content = clean_changelog()
|
||||||
|
|
||||||
|
# Write the cleaned content back to the file
|
||||||
|
with open('./CHANGELOG.md', 'w') as f:
|
||||||
|
f.write(cleaned_content)
|
||||||
|
|
||||||
|
print("CHANGELOG.md has been cleaned up successfully!")
|
||||||
@@ -11,11 +11,13 @@ config :wanderer_app, WandererAppWeb.Endpoint,
|
|||||||
config :wanderer_app, WandererApp.Repo,
|
config :wanderer_app, WandererApp.Repo,
|
||||||
ssl: false,
|
ssl: false,
|
||||||
stacktrace: true,
|
stacktrace: true,
|
||||||
show_sensitive_data_on_connection_error: true,
|
show_sensitive_data_on_connection_error: false,
|
||||||
pool_size: 15,
|
pool_size: 15,
|
||||||
migration_timestamps: [type: :utc_datetime_usec],
|
migration_timestamps: [type: :utc_datetime_usec],
|
||||||
migration_lock: nil,
|
migration_lock: nil,
|
||||||
queue_target: 5000
|
queue_target: 5000,
|
||||||
|
queue_interval: 1000,
|
||||||
|
checkout_timeout: 15000
|
||||||
|
|
||||||
# Configures Swoosh API Client
|
# Configures Swoosh API Client
|
||||||
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: WandererApp.Finch
|
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: WandererApp.Finch
|
||||||
|
|||||||
@@ -121,6 +121,11 @@ restrict_maps_creation =
|
|||||||
|> get_var_from_path_or_env("WANDERER_RESTRICT_MAPS_CREATION", "false")
|
|> get_var_from_path_or_env("WANDERER_RESTRICT_MAPS_CREATION", "false")
|
||||||
|> String.to_existing_atom()
|
|> String.to_existing_atom()
|
||||||
|
|
||||||
|
restrict_acls_creation =
|
||||||
|
config_dir
|
||||||
|
|> get_var_from_path_or_env("WANDERER_RESTRICT_ACLS_CREATION", "false")
|
||||||
|
|> String.to_existing_atom()
|
||||||
|
|
||||||
config :wanderer_app,
|
config :wanderer_app,
|
||||||
web_app_url: web_app_url,
|
web_app_url: web_app_url,
|
||||||
git_sha: System.get_env("GIT_SHA", "111"),
|
git_sha: System.get_env("GIT_SHA", "111"),
|
||||||
@@ -129,6 +134,8 @@ config :wanderer_app,
|
|||||||
admin_username: System.get_env("WANDERER_ADMIN_USERNAME", "admin"),
|
admin_username: System.get_env("WANDERER_ADMIN_USERNAME", "admin"),
|
||||||
admin_password: System.get_env("WANDERER_ADMIN_PASSWORD"),
|
admin_password: System.get_env("WANDERER_ADMIN_PASSWORD"),
|
||||||
admins: admins,
|
admins: admins,
|
||||||
|
base_metrics_only:
|
||||||
|
System.get_env("WANDERER_BASE_METRICS_ONLY", "false") |> String.to_existing_atom(),
|
||||||
corp_id: System.get_env("WANDERER_CORP_ID", "-1") |> String.to_integer(),
|
corp_id: System.get_env("WANDERER_CORP_ID", "-1") |> String.to_integer(),
|
||||||
corp_wallet: System.get_env("WANDERER_CORP_WALLET", ""),
|
corp_wallet: System.get_env("WANDERER_CORP_WALLET", ""),
|
||||||
corp_wallet_eve_id: System.get_env("WANDERER_CORP_WALLET_EVE_ID", "-1"),
|
corp_wallet_eve_id: System.get_env("WANDERER_CORP_WALLET_EVE_ID", "-1"),
|
||||||
@@ -148,6 +155,7 @@ config :wanderer_app,
|
|||||||
map_connection_eol_expire_timeout_mins: map_connection_eol_expire_timeout_mins,
|
map_connection_eol_expire_timeout_mins: map_connection_eol_expire_timeout_mins,
|
||||||
wallet_tracking_enabled: wallet_tracking_enabled,
|
wallet_tracking_enabled: wallet_tracking_enabled,
|
||||||
restrict_maps_creation: restrict_maps_creation,
|
restrict_maps_creation: restrict_maps_creation,
|
||||||
|
restrict_acls_creation: restrict_acls_creation,
|
||||||
subscription_settings: %{
|
subscription_settings: %{
|
||||||
plans: [
|
plans: [
|
||||||
%{
|
%{
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ defmodule WandererApp.Api.Character do
|
|||||||
update :update_corporation do
|
update :update_corporation do
|
||||||
require_atomic? false
|
require_atomic? false
|
||||||
|
|
||||||
accept([:corporation_id, :corporation_name, :corporation_ticker, :alliance_id])
|
accept([:corporation_id, :corporation_name, :corporation_ticker])
|
||||||
end
|
end
|
||||||
|
|
||||||
update :update_alliance do
|
update :update_alliance do
|
||||||
|
|||||||
@@ -79,8 +79,7 @@ defmodule WandererApp.Api.MapCharacterSettings do
|
|||||||
accept [
|
accept [
|
||||||
:map_id,
|
:map_id,
|
||||||
:character_id,
|
:character_id,
|
||||||
:tracked,
|
:tracked
|
||||||
:followed
|
|
||||||
]
|
]
|
||||||
|
|
||||||
argument :map_id, :uuid, allow_nil?: false
|
argument :map_id, :uuid, allow_nil?: false
|
||||||
|
|||||||
@@ -147,8 +147,13 @@ defmodule WandererApp.Api.MapConnection do
|
|||||||
allow_nil?(true)
|
allow_nil?(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
# where 0 - normal
|
# 0 - normal (env settings)
|
||||||
# where 1 - end of life
|
# 1 - EOL 1h
|
||||||
|
# 2 - EOL 4h
|
||||||
|
# 3 - EOL 4.5h
|
||||||
|
# 4 - EOL 16h
|
||||||
|
# 5 - EOL 24h
|
||||||
|
# 6 - EOL 48h
|
||||||
attribute :time_status, :integer do
|
attribute :time_status, :integer do
|
||||||
default(0)
|
default(0)
|
||||||
|
|
||||||
@@ -168,6 +173,7 @@ defmodule WandererApp.Api.MapConnection do
|
|||||||
|
|
||||||
# where 0 - Wormhole
|
# where 0 - Wormhole
|
||||||
# where 1 - Gate
|
# where 1 - Gate
|
||||||
|
# where 2 - Bridge
|
||||||
attribute :type, :integer do
|
attribute :type, :integer do
|
||||||
default(0)
|
default(0)
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
code_interface do
|
code_interface do
|
||||||
define(:all_active, action: :all_active)
|
define(:all_active, action: :all_active)
|
||||||
define(:create, action: :create)
|
define(:create, action: :create)
|
||||||
|
define(:destroy, action: :destroy)
|
||||||
define(:update, action: :update)
|
define(:update, action: :update)
|
||||||
define(:update_linked_system, action: :update_linked_system)
|
define(:update_linked_system, action: :update_linked_system)
|
||||||
define(:update_type, action: :update_type)
|
define(:update_type, action: :update_type)
|
||||||
@@ -62,6 +63,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
:eve_id,
|
:eve_id,
|
||||||
:character_eve_id,
|
:character_eve_id,
|
||||||
:name,
|
:name,
|
||||||
|
:temporary_name,
|
||||||
:description,
|
:description,
|
||||||
:kind,
|
:kind,
|
||||||
:group,
|
:group,
|
||||||
@@ -101,6 +103,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
:eve_id,
|
:eve_id,
|
||||||
:character_eve_id,
|
:character_eve_id,
|
||||||
:name,
|
:name,
|
||||||
|
:temporary_name,
|
||||||
:description,
|
:description,
|
||||||
:kind,
|
:kind,
|
||||||
:group,
|
:group,
|
||||||
@@ -120,6 +123,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
:eve_id,
|
:eve_id,
|
||||||
:character_eve_id,
|
:character_eve_id,
|
||||||
:name,
|
:name,
|
||||||
|
:temporary_name,
|
||||||
:description,
|
:description,
|
||||||
:kind,
|
:kind,
|
||||||
:group,
|
:group,
|
||||||
@@ -195,6 +199,10 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
allow_nil? true
|
allow_nil? true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attribute :temporary_name, :string do
|
||||||
|
allow_nil? true
|
||||||
|
end
|
||||||
|
|
||||||
attribute :type, :string do
|
attribute :type, :string do
|
||||||
allow_nil? true
|
allow_nil? true
|
||||||
end
|
end
|
||||||
@@ -241,6 +249,7 @@ defmodule WandererApp.Api.MapSystemSignature do
|
|||||||
:eve_id,
|
:eve_id,
|
||||||
:character_eve_id,
|
:character_eve_id,
|
||||||
:name,
|
:name,
|
||||||
|
:temporary_name,
|
||||||
:description,
|
:description,
|
||||||
:type,
|
:type,
|
||||||
:linked_system_id,
|
:linked_system_id,
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ defmodule WandererApp.Application do
|
|||||||
child_spec: DynamicSupervisor, name: WandererApp.Map.DynamicSupervisors},
|
child_spec: DynamicSupervisor, name: WandererApp.Map.DynamicSupervisors},
|
||||||
{PartitionSupervisor,
|
{PartitionSupervisor,
|
||||||
child_spec: DynamicSupervisor, name: WandererApp.Character.DynamicSupervisors},
|
child_spec: DynamicSupervisor, name: WandererApp.Character.DynamicSupervisors},
|
||||||
|
WandererAppWeb.PresenceGracePeriodManager,
|
||||||
WandererAppWeb.Presence,
|
WandererAppWeb.Presence,
|
||||||
WandererAppWeb.Endpoint
|
WandererAppWeb.Endpoint
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -113,6 +113,63 @@ defmodule WandererApp.CachedInfo do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_solar_system_jumps() do
|
||||||
|
case WandererApp.Cache.lookup(:solar_system_jumps) do
|
||||||
|
{:ok, nil} ->
|
||||||
|
data = WandererApp.EveDataService.get_solar_system_jumps_data()
|
||||||
|
|
||||||
|
cache_items(data, :solar_system_jumps)
|
||||||
|
|
||||||
|
{:ok, data}
|
||||||
|
|
||||||
|
{:ok, data} ->
|
||||||
|
{:ok, data}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_solar_system_jump(from_solar_system_id, to_solar_system_id) do
|
||||||
|
# Create normalized cache key (smaller ID first for bidirectional lookup)
|
||||||
|
{id1, id2} =
|
||||||
|
if from_solar_system_id < to_solar_system_id do
|
||||||
|
{from_solar_system_id, to_solar_system_id}
|
||||||
|
else
|
||||||
|
{to_solar_system_id, from_solar_system_id}
|
||||||
|
end
|
||||||
|
|
||||||
|
cache_key = "jump_#{id1}_#{id2}"
|
||||||
|
|
||||||
|
case WandererApp.Cache.lookup(cache_key) do
|
||||||
|
{:ok, nil} ->
|
||||||
|
# Build jump index if not exists
|
||||||
|
build_jump_index()
|
||||||
|
WandererApp.Cache.lookup(cache_key)
|
||||||
|
|
||||||
|
result ->
|
||||||
|
result
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
defp build_jump_index() do
|
||||||
|
case get_solar_system_jumps() do
|
||||||
|
{:ok, jumps} ->
|
||||||
|
jumps
|
||||||
|
|> Enum.each(fn jump ->
|
||||||
|
{id1, id2} =
|
||||||
|
if jump.from_solar_system_id < jump.to_solar_system_id do
|
||||||
|
{jump.from_solar_system_id, jump.to_solar_system_id}
|
||||||
|
else
|
||||||
|
{jump.to_solar_system_id, jump.from_solar_system_id}
|
||||||
|
end
|
||||||
|
|
||||||
|
cache_key = "jump_#{id1}_#{id2}"
|
||||||
|
WandererApp.Cache.put(cache_key, jump)
|
||||||
|
end)
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
:error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_wormhole_types!() do
|
def get_wormhole_types!() do
|
||||||
case get_wormhole_types() do
|
case get_wormhole_types() do
|
||||||
{:ok, wormhole_types} ->
|
{:ok, wormhole_types} ->
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ defmodule WandererApp.Character do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_merge_map_character_settings(%{id: character_id} = character, map_id, true) do
|
defp maybe_merge_map_character_settings(%{id: character_id} = character, _map_id, true) do
|
||||||
{:ok, tracking_paused} =
|
{:ok, tracking_paused} =
|
||||||
WandererApp.Cache.lookup("character:#{character_id}:tracking_paused", false)
|
WandererApp.Cache.lookup("character:#{character_id}:tracking_paused", false)
|
||||||
|
|
||||||
|
|||||||
@@ -49,11 +49,13 @@ defmodule WandererApp.Character.Activity do
|
|||||||
"""
|
"""
|
||||||
def process_character_activity(map_id, current_user) do
|
def process_character_activity(map_id, current_user) do
|
||||||
with {:ok, map_user_settings} <- get_map_user_settings(map_id, current_user.id),
|
with {:ok, map_user_settings} <- get_map_user_settings(map_id, current_user.id),
|
||||||
raw_activity <- WandererApp.Map.get_character_activity(map_id),
|
{:ok, raw_activity} <- WandererApp.Map.get_character_activity(map_id),
|
||||||
{:ok, user_characters} <-
|
{:ok, user_characters} <-
|
||||||
WandererApp.Api.Character.active_by_user(%{user_id: current_user.id}) do
|
WandererApp.Api.Character.active_by_user(%{user_id: current_user.id}) do
|
||||||
result = process_activity_data(raw_activity, map_user_settings, user_characters)
|
process_activity_data(raw_activity, map_user_settings, user_characters)
|
||||||
result
|
else
|
||||||
|
_ ->
|
||||||
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
defstruct [
|
defstruct [
|
||||||
:character_id,
|
:character_id,
|
||||||
:alliance_id,
|
:alliance_id,
|
||||||
|
:corporation_id,
|
||||||
:opts,
|
:opts,
|
||||||
server_online: true,
|
server_online: true,
|
||||||
start_time: nil,
|
start_time: nil,
|
||||||
@@ -21,6 +22,8 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
|
|
||||||
@type t :: %__MODULE__{
|
@type t :: %__MODULE__{
|
||||||
character_id: integer,
|
character_id: integer,
|
||||||
|
alliance_id: integer,
|
||||||
|
corporation_id: integer,
|
||||||
opts: map,
|
opts: map,
|
||||||
server_online: boolean,
|
server_online: boolean,
|
||||||
start_time: DateTime.t(),
|
start_time: DateTime.t(),
|
||||||
@@ -35,12 +38,13 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
|
|
||||||
@pause_tracking_timeout :timer.minutes(60 * 10)
|
@pause_tracking_timeout :timer.minutes(60 * 10)
|
||||||
@offline_timeout :timer.minutes(5)
|
@offline_timeout :timer.minutes(5)
|
||||||
@online_error_timeout :timer.minutes(2)
|
@online_error_timeout :timer.minutes(10)
|
||||||
@ship_error_timeout :timer.minutes(2)
|
@ship_error_timeout :timer.minutes(10)
|
||||||
@location_error_timeout :timer.minutes(2)
|
@location_error_timeout :timer.minutes(10)
|
||||||
@online_forbidden_ttl :timer.seconds(7)
|
@online_forbidden_ttl :timer.seconds(7)
|
||||||
|
@offline_check_delay_ttl :timer.seconds(15)
|
||||||
@online_limit_ttl :timer.seconds(7)
|
@online_limit_ttl :timer.seconds(7)
|
||||||
@forbidden_ttl :timer.seconds(5)
|
@forbidden_ttl :timer.seconds(10)
|
||||||
@limit_ttl :timer.seconds(5)
|
@limit_ttl :timer.seconds(5)
|
||||||
@location_limit_ttl :timer.seconds(1)
|
@location_limit_ttl :timer.seconds(1)
|
||||||
@pubsub_client Application.compile_env(:wanderer_app, :pubsub_client)
|
@pubsub_client Application.compile_env(:wanderer_app, :pubsub_client)
|
||||||
@@ -49,8 +53,15 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
def new(args), do: __struct__(args)
|
def new(args), do: __struct__(args)
|
||||||
|
|
||||||
def init(args) do
|
def init(args) do
|
||||||
|
character_id = args[:character_id]
|
||||||
|
|
||||||
|
{:ok, %{corporation_id: corporation_id, alliance_id: alliance_id}} =
|
||||||
|
WandererApp.Character.get_character(character_id)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
character_id: args[:character_id],
|
character_id: character_id,
|
||||||
|
corporation_id: corporation_id,
|
||||||
|
alliance_id: alliance_id,
|
||||||
start_time: DateTime.utc_now(),
|
start_time: DateTime.utc_now(),
|
||||||
opts: args
|
opts: args
|
||||||
}
|
}
|
||||||
@@ -61,18 +72,19 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
WandererApp.Cache.lookup!("character:#{character_id}:last_online_time")
|
WandererApp.Cache.lookup!("character:#{character_id}:last_online_time")
|
||||||
|> case do
|
|> case do
|
||||||
nil ->
|
nil ->
|
||||||
WandererApp.Cache.insert(
|
|
||||||
"character:#{character_id}:last_online_time",
|
|
||||||
DateTime.utc_now()
|
|
||||||
)
|
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
last_online_time ->
|
last_online_time ->
|
||||||
duration = DateTime.diff(DateTime.utc_now(), last_online_time, :millisecond)
|
duration = DateTime.diff(DateTime.utc_now(), last_online_time, :millisecond)
|
||||||
|
|
||||||
if duration >= @offline_timeout do
|
if duration >= @offline_timeout do
|
||||||
pause_tracking(character_id)
|
WandererApp.Character.update_character(character_id, %{online: false})
|
||||||
|
|
||||||
|
WandererApp.Character.update_character_state(character_id, %{
|
||||||
|
is_online: false
|
||||||
|
})
|
||||||
|
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:last_online_time")
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
@@ -101,6 +113,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
|
|
||||||
if duration >= timeout do
|
if duration >= timeout do
|
||||||
pause_tracking(character_id)
|
pause_tracking(character_id)
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:#{type}_error_time")
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
else
|
else
|
||||||
@@ -113,15 +126,14 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
if WandererApp.Character.can_pause_tracking?(character_id) &&
|
if WandererApp.Character.can_pause_tracking?(character_id) &&
|
||||||
not WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused") do
|
not WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused") do
|
||||||
# Log character tracking statistics before pausing
|
# Log character tracking statistics before pausing
|
||||||
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
|
Logger.debug(fn ->
|
||||||
|
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
|
||||||
|
|
||||||
Logger.warning(
|
"CHARACTER_TRACKING_PAUSED: Character tracking paused due to sustained errors: #{inspect(character_id: character_id,
|
||||||
"CHARACTER_TRACKING_PAUSED: Character tracking paused due to sustained errors",
|
|
||||||
character_id: character_id,
|
|
||||||
active_maps: length(character_state.active_maps),
|
active_maps: length(character_state.active_maps),
|
||||||
is_online: character_state.is_online,
|
is_online: character_state.is_online,
|
||||||
tracking_duration_minutes: get_tracking_duration_minutes(character_id)
|
tracking_duration_minutes: get_tracking_duration_minutes(character_id))}"
|
||||||
)
|
end)
|
||||||
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
|
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
|
||||||
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
|
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
|
||||||
@@ -176,7 +188,9 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
|> WandererApp.Character.get_character_state!()
|
|> WandererApp.Character.get_character_state!()
|
||||||
|> update_online()
|
|> update_online()
|
||||||
|
|
||||||
def update_online(%{track_online: true, character_id: character_id} = character_state) do
|
def update_online(
|
||||||
|
%{track_online: true, character_id: character_id, is_online: is_online} = character_state
|
||||||
|
) do
|
||||||
case WandererApp.Character.get_character(character_id) do
|
case WandererApp.Character.get_character(character_id) do
|
||||||
{:ok, %{eve_id: eve_id, access_token: access_token, tracking_pool: tracking_pool}}
|
{:ok, %{eve_id: eve_id, access_token: access_token, tracking_pool: tracking_pool}}
|
||||||
when not is_nil(access_token) ->
|
when not is_nil(access_token) ->
|
||||||
@@ -187,13 +201,11 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :skipped}
|
{:error, :skipped}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
# Monitor cache for potential evictions before ESI call
|
|
||||||
|
|
||||||
case WandererApp.Esi.get_character_online(eve_id,
|
case WandererApp.Esi.get_character_online(eve_id,
|
||||||
access_token: access_token,
|
access_token: access_token,
|
||||||
character_id: character_id
|
character_id: character_id
|
||||||
) do
|
) do
|
||||||
{:ok, online} ->
|
{:ok, online} when is_map(online) ->
|
||||||
online = get_online(online)
|
online = get_online(online)
|
||||||
|
|
||||||
if online.online == true do
|
if online.online == true do
|
||||||
@@ -201,70 +213,67 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
"character:#{character_id}:last_online_time",
|
"character:#{character_id}:last_online_time",
|
||||||
DateTime.utc_now()
|
DateTime.utc_now()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
|
||||||
|
else
|
||||||
|
# Delay next online updates for offline characters
|
||||||
|
WandererApp.Cache.put(
|
||||||
|
"character:#{character_id}:online_forbidden",
|
||||||
|
true,
|
||||||
|
ttl: @offline_check_delay_ttl
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
if online.online == true && online.online != is_online do
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:ship_error_time")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:location_error_time")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:info_forbidden")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:ship_forbidden")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:location_forbidden")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:wallet_forbidden")
|
||||||
|
WandererApp.Cache.delete("character:#{character_id}:corporation_info_forbidden")
|
||||||
end
|
end
|
||||||
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:online_forbidden")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
|
WandererApp.Cache.delete("character:#{character_id}:online_error_time")
|
||||||
WandererApp.Cache.delete("character:#{character_id}:ship_error_time")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:location_error_time")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:info_forbidden")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:ship_forbidden")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:location_forbidden")
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:wallet_forbidden")
|
|
||||||
|
|
||||||
try do
|
if online.online != is_online do
|
||||||
WandererApp.Character.update_character(character_id, online)
|
try do
|
||||||
rescue
|
WandererApp.Character.update_character(character_id, online)
|
||||||
error ->
|
rescue
|
||||||
Logger.error("DB_ERROR: Failed to update character in database",
|
error ->
|
||||||
character_id: character_id,
|
Logger.error("DB_ERROR: Failed to update character in database",
|
||||||
error: inspect(error),
|
character_id: character_id,
|
||||||
operation: "update_character_online"
|
error: inspect(error),
|
||||||
)
|
operation: "update_character_online"
|
||||||
|
)
|
||||||
|
|
||||||
# Re-raise to maintain existing error handling
|
# Re-raise to maintain existing error handling
|
||||||
reraise error, __STACKTRACE__
|
reraise error, __STACKTRACE__
|
||||||
end
|
end
|
||||||
|
|
||||||
update = %{
|
try do
|
||||||
character_state
|
WandererApp.Character.update_character_state(character_id, %{
|
||||||
| is_online: online.online,
|
character_state
|
||||||
track_ship: online.online,
|
| is_online: online.online,
|
||||||
track_location: online.online
|
track_ship: online.online,
|
||||||
}
|
track_location: online.online
|
||||||
|
})
|
||||||
|
rescue
|
||||||
|
error ->
|
||||||
|
Logger.error("DB_ERROR: Failed to update character state in database",
|
||||||
|
character_id: character_id,
|
||||||
|
error: inspect(error),
|
||||||
|
operation: "update_character_state"
|
||||||
|
)
|
||||||
|
|
||||||
try do
|
# Re-raise to maintain existing error handling
|
||||||
WandererApp.Character.update_character_state(character_id, update)
|
reraise error, __STACKTRACE__
|
||||||
rescue
|
end
|
||||||
error ->
|
|
||||||
Logger.error("DB_ERROR: Failed to update character state in database",
|
|
||||||
character_id: character_id,
|
|
||||||
error: inspect(error),
|
|
||||||
operation: "update_character_state"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Re-raise to maintain existing error handling
|
|
||||||
reraise error, __STACKTRACE__
|
|
||||||
end
|
end
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_online",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.warning("ESI_ERROR: Character online tracking failed",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
error_type: error,
|
|
||||||
endpoint: "character_online"
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:online_forbidden",
|
"character:#{character_id}:online_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -291,28 +300,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
remaining =
|
remaining =
|
||||||
Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
||||||
|
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute(
|
|
||||||
[:wanderer_app, :esi, :rate_limited],
|
|
||||||
%{
|
|
||||||
reset_duration: reset_timeout,
|
|
||||||
count: 1
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
endpoint: "character_online",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Logger.warning("ESI_RATE_LIMITED: Character online tracking rate limited",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
endpoint: "character_online",
|
|
||||||
reset_seconds: reset_seconds,
|
|
||||||
remaining_requests: remaining
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:online_forbidden",
|
"character:#{character_id}:online_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -322,15 +309,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :skipped}
|
{:error, :skipped}
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
# Emit telemetry for tracking
|
Logger.error("ESI_ERROR: Character online tracking failed: #{inspect(error)}",
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_online",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character online tracking failed",
|
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -388,31 +367,25 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:ok, %{eve_id: eve_id, tracking_pool: tracking_pool}} =
|
{:ok, %{eve_id: eve_id, tracking_pool: tracking_pool}} =
|
||||||
WandererApp.Character.get_character(character_id)
|
WandererApp.Character.get_character(character_id)
|
||||||
|
|
||||||
case WandererApp.Esi.get_character_info(eve_id) do
|
character_eve_id = eve_id |> String.to_integer()
|
||||||
{:ok, _info} ->
|
|
||||||
|
case WandererApp.Esi.post_characters_affiliation([character_eve_id]) do
|
||||||
|
{:ok, [character_aff_info]} when not is_nil(character_aff_info) ->
|
||||||
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
|
{:ok, character_state} = WandererApp.Character.get_character_state(character_id)
|
||||||
|
|
||||||
update = maybe_update_corporation(character_state, eve_id |> String.to_integer())
|
alliance_id = character_aff_info |> Map.get("alliance_id")
|
||||||
WandererApp.Character.update_character_state(character_id, update)
|
corporation_id = character_aff_info |> Map.get("corporation_id")
|
||||||
|
|
||||||
|
updated_state =
|
||||||
|
character_state
|
||||||
|
|> maybe_update_corporation(corporation_id)
|
||||||
|
|> maybe_update_alliance(alliance_id)
|
||||||
|
|
||||||
|
WandererApp.Character.update_character_state(character_id, updated_state)
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_info",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.warning("ESI_ERROR: Character info tracking failed",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
error_type: error,
|
|
||||||
endpoint: "character_info"
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:info_forbidden",
|
"character:#{character_id}:info_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -424,33 +397,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited, headers} ->
|
{:error, :error_limited, headers} ->
|
||||||
reset_timeout = get_reset_timeout(headers)
|
reset_timeout = get_reset_timeout(headers)
|
||||||
|
|
||||||
reset_seconds =
|
|
||||||
Map.get(headers, "x-esi-error-limit-reset", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
remaining = Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute(
|
|
||||||
[:wanderer_app, :esi, :rate_limited],
|
|
||||||
%{
|
|
||||||
reset_duration: reset_timeout,
|
|
||||||
count: 1
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
endpoint: "character_info",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Logger.warning("ESI_RATE_LIMITED: Character info tracking rate limited",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
endpoint: "character_info",
|
|
||||||
reset_seconds: reset_seconds,
|
|
||||||
remaining_requests: remaining
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:info_forbidden",
|
"character:#{character_id}:info_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -460,21 +406,13 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited}
|
{:error, :error_limited}
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_info",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:info_forbidden",
|
"character:#{character_id}:info_forbidden",
|
||||||
true,
|
true,
|
||||||
ttl: @forbidden_ttl
|
ttl: @forbidden_ttl
|
||||||
)
|
)
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character info tracking failed",
|
Logger.error("ESI_ERROR: Character info tracking failed: #{inspect(error)}",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -521,21 +459,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_ship",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.warning("ESI_ERROR: Character ship tracking failed",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
error_type: error,
|
|
||||||
endpoint: "character_ship"
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:ship_forbidden",
|
"character:#{character_id}:ship_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -554,34 +477,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited, headers} ->
|
{:error, :error_limited, headers} ->
|
||||||
reset_timeout = get_reset_timeout(headers)
|
reset_timeout = get_reset_timeout(headers)
|
||||||
|
|
||||||
reset_seconds =
|
|
||||||
Map.get(headers, "x-esi-error-limit-reset", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
remaining =
|
|
||||||
Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute(
|
|
||||||
[:wanderer_app, :esi, :rate_limited],
|
|
||||||
%{
|
|
||||||
reset_duration: reset_timeout,
|
|
||||||
count: 1
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
endpoint: "character_ship",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Logger.warning("ESI_RATE_LIMITED: Character ship tracking rate limited",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
endpoint: "character_ship",
|
|
||||||
reset_seconds: reset_seconds,
|
|
||||||
remaining_requests: remaining
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:ship_forbidden",
|
"character:#{character_id}:ship_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -591,15 +486,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited}
|
{:error, :error_limited}
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
# Emit telemetry for tracking
|
Logger.error("ESI_ERROR: Character ship tracking failed: #{inspect(error)}",
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_ship",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character ship tracking failed",
|
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -622,14 +509,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, error}
|
{:error, error}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_ship",
|
|
||||||
error_type: "wrong_response",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character ship tracking failed - wrong response",
|
Logger.error("ESI_ERROR: Character ship tracking failed - wrong response",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
@@ -692,14 +571,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_location",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.warning("ESI_ERROR: Character location tracking failed",
|
Logger.warning("ESI_ERROR: Character location tracking failed",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
@@ -721,34 +592,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited, headers} ->
|
{:error, :error_limited, headers} ->
|
||||||
reset_timeout = get_reset_timeout(headers, @location_limit_ttl)
|
reset_timeout = get_reset_timeout(headers, @location_limit_ttl)
|
||||||
|
|
||||||
reset_seconds =
|
|
||||||
Map.get(headers, "x-esi-error-limit-reset", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
remaining =
|
|
||||||
Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute(
|
|
||||||
[:wanderer_app, :esi, :rate_limited],
|
|
||||||
%{
|
|
||||||
reset_duration: reset_timeout,
|
|
||||||
count: 1
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
endpoint: "character_location",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Logger.warning("ESI_RATE_LIMITED: Character location tracking rate limited",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
endpoint: "character_location",
|
|
||||||
reset_seconds: reset_seconds,
|
|
||||||
remaining_requests: remaining
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:location_forbidden",
|
"character:#{character_id}:location_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -758,15 +601,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited}
|
{:error, :error_limited}
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
# Emit telemetry for tracking
|
Logger.error("ESI_ERROR: Character location tracking failed: #{inspect(error)}",
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_location",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character location tracking failed",
|
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -785,14 +620,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :skipped}
|
{:error, :skipped}
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_location",
|
|
||||||
error_type: "wrong_response",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character location tracking failed - wrong response",
|
Logger.error("ESI_ERROR: Character location tracking failed - wrong response",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
@@ -854,14 +681,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
{:error, error} when error in [:forbidden, :not_found, :timeout] ->
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_wallet",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.warning("ESI_ERROR: Character wallet tracking failed",
|
Logger.warning("ESI_ERROR: Character wallet tracking failed",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
@@ -880,34 +699,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :error_limited, headers} ->
|
{:error, :error_limited, headers} ->
|
||||||
reset_timeout = get_reset_timeout(headers)
|
reset_timeout = get_reset_timeout(headers)
|
||||||
|
|
||||||
reset_seconds =
|
|
||||||
Map.get(headers, "x-esi-error-limit-reset", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
remaining =
|
|
||||||
Map.get(headers, "x-esi-error-limit-remain", ["unknown"]) |> List.first()
|
|
||||||
|
|
||||||
# Emit telemetry for tracking
|
|
||||||
:telemetry.execute(
|
|
||||||
[:wanderer_app, :esi, :rate_limited],
|
|
||||||
%{
|
|
||||||
reset_duration: reset_timeout,
|
|
||||||
count: 1
|
|
||||||
},
|
|
||||||
%{
|
|
||||||
endpoint: "character_wallet",
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Logger.warning("ESI_RATE_LIMITED: Character wallet tracking rate limited",
|
|
||||||
character_id: character_id,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
endpoint: "character_wallet",
|
|
||||||
reset_seconds: reset_seconds,
|
|
||||||
remaining_requests: remaining
|
|
||||||
)
|
|
||||||
|
|
||||||
WandererApp.Cache.put(
|
WandererApp.Cache.put(
|
||||||
"character:#{character_id}:wallet_forbidden",
|
"character:#{character_id}:wallet_forbidden",
|
||||||
true,
|
true,
|
||||||
@@ -917,15 +708,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :skipped}
|
{:error, :skipped}
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
# Emit telemetry for tracking
|
Logger.error("ESI_ERROR: Character wallet tracking failed: #{inspect(error)}",
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_wallet",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character wallet tracking failed",
|
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -941,15 +724,7 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
{:error, :skipped}
|
{:error, :skipped}
|
||||||
|
|
||||||
error ->
|
error ->
|
||||||
# Emit telemetry for tracking
|
Logger.error("ESI_ERROR: Character wallet tracking failed: #{inspect(error)}",
|
||||||
:telemetry.execute([:wanderer_app, :esi, :error], %{count: 1}, %{
|
|
||||||
endpoint: "character_wallet",
|
|
||||||
error_type: error,
|
|
||||||
tracking_pool: tracking_pool,
|
|
||||||
character_id: character_id
|
|
||||||
})
|
|
||||||
|
|
||||||
Logger.error("ESI_ERROR: Character wallet tracking failed",
|
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
tracking_pool: tracking_pool,
|
tracking_pool: tracking_pool,
|
||||||
error_type: error,
|
error_type: error,
|
||||||
@@ -975,7 +750,38 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp update_alliance(%{character_id: character_id} = state, alliance_id) do
|
defp maybe_update_alliance(
|
||||||
|
%{character_id: character_id, alliance_id: old_alliance_id} = state,
|
||||||
|
alliance_id
|
||||||
|
)
|
||||||
|
when old_alliance_id != alliance_id and is_nil(alliance_id) do
|
||||||
|
{:ok, character} = WandererApp.Character.get_character(character_id)
|
||||||
|
|
||||||
|
character_update = %{
|
||||||
|
alliance_id: nil,
|
||||||
|
alliance_name: nil,
|
||||||
|
alliance_ticker: nil
|
||||||
|
}
|
||||||
|
|
||||||
|
{:ok, _character} =
|
||||||
|
Character.update_alliance(character, character_update)
|
||||||
|
|
||||||
|
WandererApp.Character.update_character(character_id, character_update)
|
||||||
|
|
||||||
|
@pubsub_client.broadcast(
|
||||||
|
WandererApp.PubSub,
|
||||||
|
"character:#{character_id}:alliance",
|
||||||
|
{:character_alliance, {character_id, character_update}}
|
||||||
|
)
|
||||||
|
|
||||||
|
state
|
||||||
|
end
|
||||||
|
|
||||||
|
defp maybe_update_alliance(
|
||||||
|
%{character_id: character_id, alliance_id: old_alliance_id} = state,
|
||||||
|
alliance_id
|
||||||
|
)
|
||||||
|
when old_alliance_id != alliance_id do
|
||||||
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
|
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
|
||||||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|
||||||
|> case do
|
|> case do
|
||||||
@@ -1015,8 +821,15 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp update_corporation(%{character_id: character_id} = state, corporation_id) do
|
defp maybe_update_alliance(state, _alliance_id), do: state
|
||||||
|
|
||||||
|
defp maybe_update_corporation(
|
||||||
|
%{character_id: character_id, corporation_id: old_corporation_id} = state,
|
||||||
|
corporation_id
|
||||||
|
)
|
||||||
|
when old_corporation_id != corporation_id do
|
||||||
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
|
(WandererApp.Cache.has_key?("character:#{character_id}:online_forbidden") ||
|
||||||
|
WandererApp.Cache.has_key?("character:#{character_id}:corporation_info_forbidden") ||
|
||||||
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|
WandererApp.Cache.has_key?("character:#{character_id}:tracking_paused"))
|
||||||
|> case do
|
|> case do
|
||||||
true ->
|
true ->
|
||||||
@@ -1027,16 +840,13 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
|> WandererApp.Esi.get_corporation_info()
|
|> WandererApp.Esi.get_corporation_info()
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, %{"name" => corporation_name, "ticker" => corporation_ticker} = corporation_info} ->
|
{:ok, %{"name" => corporation_name, "ticker" => corporation_ticker} = corporation_info} ->
|
||||||
alliance_id = Map.get(corporation_info, "alliance_id")
|
|
||||||
|
|
||||||
{:ok, character} =
|
{:ok, character} =
|
||||||
WandererApp.Character.get_character(character_id)
|
WandererApp.Character.get_character(character_id)
|
||||||
|
|
||||||
character_update = %{
|
character_update = %{
|
||||||
corporation_id: corporation_id,
|
corporation_id: corporation_id,
|
||||||
corporation_name: corporation_name,
|
corporation_name: corporation_name,
|
||||||
corporation_ticker: corporation_ticker,
|
corporation_ticker: corporation_ticker
|
||||||
alliance_id: alliance_id
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, _character} =
|
{:ok, _character} =
|
||||||
@@ -1057,8 +867,18 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
)
|
)
|
||||||
|
|
||||||
state
|
state
|
||||||
|> Map.merge(%{alliance_id: alliance_id, corporation_id: corporation_id})
|
|> Map.merge(%{corporation_id: corporation_id})
|
||||||
|> maybe_update_alliance()
|
|
||||||
|
{:error, :error_limited, headers} ->
|
||||||
|
reset_timeout = get_reset_timeout(headers)
|
||||||
|
|
||||||
|
WandererApp.Cache.put(
|
||||||
|
"character:#{character_id}:corporation_info_forbidden",
|
||||||
|
true,
|
||||||
|
ttl: reset_timeout
|
||||||
|
)
|
||||||
|
|
||||||
|
state
|
||||||
|
|
||||||
error ->
|
error ->
|
||||||
Logger.warning(
|
Logger.warning(
|
||||||
@@ -1072,6 +892,8 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp maybe_update_corporation(state, _corporation_id), do: state
|
||||||
|
|
||||||
defp maybe_update_ship(
|
defp maybe_update_ship(
|
||||||
%{
|
%{
|
||||||
character_id: character_id
|
character_id: character_id
|
||||||
@@ -1153,58 +975,6 @@ defmodule WandererApp.Character.Tracker do
|
|||||||
structure_id != new_structure_id ||
|
structure_id != new_structure_id ||
|
||||||
station_id != new_station_id
|
station_id != new_station_id
|
||||||
|
|
||||||
defp maybe_update_corporation(
|
|
||||||
state,
|
|
||||||
character_eve_id
|
|
||||||
)
|
|
||||||
when not is_nil(character_eve_id) and is_integer(character_eve_id) do
|
|
||||||
case WandererApp.Esi.post_characters_affiliation([character_eve_id]) do
|
|
||||||
{:ok, [character_aff_info]} when not is_nil(character_aff_info) ->
|
|
||||||
update_corporation(state, character_aff_info |> Map.get("corporation_id"))
|
|
||||||
|
|
||||||
_error ->
|
|
||||||
state
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp maybe_update_corporation(
|
|
||||||
state,
|
|
||||||
_info
|
|
||||||
),
|
|
||||||
do: state
|
|
||||||
|
|
||||||
defp maybe_update_alliance(
|
|
||||||
%{character_id: character_id, alliance_id: alliance_id} =
|
|
||||||
state
|
|
||||||
) do
|
|
||||||
case alliance_id do
|
|
||||||
nil ->
|
|
||||||
{:ok, character} = WandererApp.Character.get_character(character_id)
|
|
||||||
|
|
||||||
character_update = %{
|
|
||||||
alliance_id: nil,
|
|
||||||
alliance_name: nil,
|
|
||||||
alliance_ticker: nil
|
|
||||||
}
|
|
||||||
|
|
||||||
{:ok, _character} =
|
|
||||||
Character.update_alliance(character, character_update)
|
|
||||||
|
|
||||||
WandererApp.Character.update_character(character_id, character_update)
|
|
||||||
|
|
||||||
@pubsub_client.broadcast(
|
|
||||||
WandererApp.PubSub,
|
|
||||||
"character:#{character_id}:alliance",
|
|
||||||
{:character_alliance, {character_id, character_update}}
|
|
||||||
)
|
|
||||||
|
|
||||||
state
|
|
||||||
|
|
||||||
_ ->
|
|
||||||
update_alliance(state, alliance_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
defp maybe_update_wallet(
|
defp maybe_update_wallet(
|
||||||
%{character_id: character_id} =
|
%{character_id: character_id} =
|
||||||
state,
|
state,
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
opts: map
|
opts: map
|
||||||
}
|
}
|
||||||
|
|
||||||
@garbage_collection_interval :timer.minutes(15)
|
@check_start_queue_interval :timer.seconds(1)
|
||||||
@untrack_characters_interval :timer.minutes(1)
|
@garbage_collection_interval :timer.minutes(5)
|
||||||
@inactive_character_timeout :timer.minutes(10)
|
@untrack_characters_interval :timer.minutes(5)
|
||||||
@untrack_character_timeout :timer.minutes(10)
|
@inactive_character_timeout :timer.minutes(5)
|
||||||
|
|
||||||
@logger Application.compile_env(:wanderer_app, :logger)
|
@logger Application.compile_env(:wanderer_app, :logger)
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
def new(args), do: __struct__(args)
|
def new(args), do: __struct__(args)
|
||||||
|
|
||||||
def init(args) do
|
def init(args) do
|
||||||
|
Process.send_after(self(), :check_start_queue, @check_start_queue_interval)
|
||||||
Process.send_after(self(), :garbage_collect, @garbage_collection_interval)
|
Process.send_after(self(), :garbage_collect, @garbage_collection_interval)
|
||||||
Process.send_after(self(), :untrack_characters, @untrack_characters_interval)
|
Process.send_after(self(), :untrack_characters, @untrack_characters_interval)
|
||||||
|
|
||||||
@@ -46,25 +47,21 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def start_tracking(state, character_id, opts) do
|
def start_tracking(state, character_id, opts) do
|
||||||
with {:ok, characters} <- WandererApp.Cache.lookup("tracked_characters", []),
|
if not WandererApp.Cache.has_key?("#{character_id}:track_requested") do
|
||||||
false <- Enum.member?(characters, character_id) do
|
WandererApp.Cache.insert(
|
||||||
Logger.debug(fn -> "Start character tracker: #{inspect(character_id)}" end)
|
"#{character_id}:track_requested",
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
tracked_characters = [character_id | characters] |> Enum.uniq()
|
Logger.debug(fn -> "Add character to track_characters_queue: #{inspect(character_id)}" end)
|
||||||
WandererApp.Cache.insert("tracked_characters", tracked_characters)
|
|
||||||
|
|
||||||
WandererApp.Character.update_character(character_id, %{online: false})
|
WandererApp.Cache.insert_or_update(
|
||||||
|
"track_characters_queue",
|
||||||
WandererApp.Character.update_character_state(character_id, %{
|
[character_id],
|
||||||
is_online: false
|
fn existing ->
|
||||||
})
|
[character_id | existing] |> Enum.uniq()
|
||||||
|
end
|
||||||
WandererApp.Character.TrackerPoolDynamicSupervisor.start_tracking(character_id)
|
)
|
||||||
|
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character, :update_character_state, [
|
|
||||||
character_id,
|
|
||||||
%{opts: opts}
|
|
||||||
])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
state
|
state
|
||||||
@@ -73,29 +70,25 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
def stop_tracking(state, character_id) do
|
def stop_tracking(state, character_id) do
|
||||||
with {:ok, characters} <- WandererApp.Cache.lookup("tracked_characters", []),
|
with {:ok, characters} <- WandererApp.Cache.lookup("tracked_characters", []),
|
||||||
true <- Enum.member?(characters, character_id),
|
true <- Enum.member?(characters, character_id),
|
||||||
{:ok, %{start_time: start_time}} <-
|
false <- WandererApp.Cache.has_key?("#{character_id}:track_requested") do
|
||||||
WandererApp.Character.get_character_state(character_id, false) do
|
|
||||||
Logger.debug(fn -> "Shutting down character tracker: #{inspect(character_id)}" end)
|
Logger.debug(fn -> "Shutting down character tracker: #{inspect(character_id)}" end)
|
||||||
|
|
||||||
WandererApp.Cache.delete("character:#{character_id}:last_active_time")
|
WandererApp.Cache.delete("character:#{character_id}:last_active_time")
|
||||||
WandererApp.Character.delete_character_state(character_id)
|
WandererApp.Character.delete_character_state(character_id)
|
||||||
|
|
||||||
tracked_characters =
|
|
||||||
characters |> Enum.reject(fn c_id -> c_id == character_id end)
|
|
||||||
|
|
||||||
WandererApp.Cache.insert("tracked_characters", tracked_characters)
|
|
||||||
|
|
||||||
WandererApp.Character.TrackerPoolDynamicSupervisor.stop_tracking(character_id)
|
WandererApp.Character.TrackerPoolDynamicSupervisor.stop_tracking(character_id)
|
||||||
|
|
||||||
duration = DateTime.diff(DateTime.utc_now(), start_time, :second)
|
|
||||||
|
|
||||||
:telemetry.execute([:wanderer_app, :character, :tracker, :running], %{
|
|
||||||
duration: duration
|
|
||||||
})
|
|
||||||
|
|
||||||
:telemetry.execute([:wanderer_app, :character, :tracker, :stopped], %{count: 1})
|
:telemetry.execute([:wanderer_app, :character, :tracker, :stopped], %{count: 1})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
WandererApp.Cache.insert_or_update(
|
||||||
|
"tracked_characters",
|
||||||
|
[],
|
||||||
|
fn tracked_characters ->
|
||||||
|
tracked_characters
|
||||||
|
|> Enum.reject(fn c_id -> c_id == character_id end)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
state
|
state
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -122,25 +115,17 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add_to_untrack_queue(map_id, character_id) do
|
def add_to_untrack_queue(map_id, character_id) do
|
||||||
if not WandererApp.Cache.has_key?("#{map_id}:#{character_id}:untrack_requested") do
|
|
||||||
WandererApp.Cache.insert(
|
|
||||||
"#{map_id}:#{character_id}:untrack_requested",
|
|
||||||
DateTime.utc_now()
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
WandererApp.Cache.insert_or_update(
|
WandererApp.Cache.insert_or_update(
|
||||||
"character_untrack_queue",
|
"character_untrack_queue",
|
||||||
[{map_id, character_id}],
|
[{map_id, character_id}],
|
||||||
fn untrack_queue ->
|
fn untrack_queue ->
|
||||||
[{map_id, character_id} | untrack_queue] |> Enum.uniq()
|
[{map_id, character_id} | untrack_queue]
|
||||||
|
|> Enum.uniq_by(fn {map_id, character_id} -> map_id <> character_id end)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_from_untrack_queue(map_id, character_id) do
|
def remove_from_untrack_queue(map_id, character_id) do
|
||||||
WandererApp.Cache.delete("#{map_id}:#{character_id}:untrack_requested")
|
|
||||||
|
|
||||||
WandererApp.Cache.insert_or_update(
|
WandererApp.Cache.insert_or_update(
|
||||||
"character_untrack_queue",
|
"character_untrack_queue",
|
||||||
[],
|
[],
|
||||||
@@ -178,6 +163,21 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_info(
|
||||||
|
:check_start_queue,
|
||||||
|
state
|
||||||
|
) do
|
||||||
|
Process.send_after(self(), :check_start_queue, @check_start_queue_interval)
|
||||||
|
{:ok, track_characters_queue} = WandererApp.Cache.lookup("track_characters_queue", [])
|
||||||
|
|
||||||
|
track_characters_queue
|
||||||
|
|> Enum.each(fn character_id ->
|
||||||
|
track_character(character_id, %{})
|
||||||
|
end)
|
||||||
|
|
||||||
|
state
|
||||||
|
end
|
||||||
|
|
||||||
def handle_info(
|
def handle_info(
|
||||||
:garbage_collect,
|
:garbage_collect,
|
||||||
state
|
state
|
||||||
@@ -229,50 +229,32 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
WandererApp.Cache.lookup!("character_untrack_queue", [])
|
WandererApp.Cache.lookup!("character_untrack_queue", [])
|
||||||
|> Task.async_stream(
|
|> Task.async_stream(
|
||||||
fn {map_id, character_id} ->
|
fn {map_id, character_id} ->
|
||||||
untrack_timeout_reached =
|
remove_from_untrack_queue(map_id, character_id)
|
||||||
if WandererApp.Cache.has_key?("#{map_id}:#{character_id}:untrack_requested") do
|
|
||||||
untrack_requested =
|
|
||||||
WandererApp.Cache.lookup!(
|
|
||||||
"#{map_id}:#{character_id}:untrack_requested",
|
|
||||||
DateTime.utc_now()
|
|
||||||
)
|
|
||||||
|
|
||||||
duration = DateTime.diff(DateTime.utc_now(), untrack_requested, :millisecond)
|
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:solar_system_id")
|
||||||
duration >= @untrack_character_timeout
|
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:station_id")
|
||||||
else
|
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:structure_id")
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
Logger.debug(fn -> "Untrack timeout reached: #{inspect(untrack_timeout_reached)}" end)
|
{:ok, character_state} =
|
||||||
|
WandererApp.Character.Tracker.update_settings(character_id, %{
|
||||||
|
map_id: map_id,
|
||||||
|
track: false
|
||||||
|
})
|
||||||
|
|
||||||
if untrack_timeout_reached do
|
{:ok, character} = WandererApp.Character.get_character(character_id)
|
||||||
remove_from_untrack_queue(map_id, character_id)
|
|
||||||
|
|
||||||
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:solar_system_id")
|
{:ok, _updated} =
|
||||||
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:station_id")
|
WandererApp.MapCharacterSettingsRepo.update(map_id, character_id, %{
|
||||||
WandererApp.Cache.delete("map:#{map_id}:character:#{character_id}:structure_id")
|
ship: character.ship,
|
||||||
|
ship_name: character.ship_name,
|
||||||
|
ship_item_id: character.ship_item_id,
|
||||||
|
solar_system_id: character.solar_system_id,
|
||||||
|
structure_id: character.structure_id,
|
||||||
|
station_id: character.station_id
|
||||||
|
})
|
||||||
|
|
||||||
{:ok, character_state} =
|
WandererApp.Character.update_character_state(character_id, character_state)
|
||||||
WandererApp.Character.Tracker.update_settings(character_id, %{
|
WandererApp.Map.Server.Impl.broadcast!(map_id, :untrack_character, character_id)
|
||||||
map_id: map_id,
|
|
||||||
track: false
|
|
||||||
})
|
|
||||||
|
|
||||||
{:ok, character} = WandererApp.Character.get_character(character_id)
|
|
||||||
|
|
||||||
{:ok, _updated} =
|
|
||||||
WandererApp.MapCharacterSettingsRepo.update(map_id, character_id, %{
|
|
||||||
ship: character.ship,
|
|
||||||
ship_name: character.ship_name,
|
|
||||||
ship_item_id: character.ship_item_id,
|
|
||||||
solar_system_id: character.solar_system_id,
|
|
||||||
structure_id: character.structure_id,
|
|
||||||
station_id: character.station_id
|
|
||||||
})
|
|
||||||
|
|
||||||
WandererApp.Character.update_character_state(character_id, character_state)
|
|
||||||
WandererApp.Map.Server.Impl.broadcast!(map_id, :untrack_character, character_id)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
max_concurrency: System.schedulers_online(),
|
max_concurrency: System.schedulers_online(),
|
||||||
on_timeout: :kill_task,
|
on_timeout: :kill_task,
|
||||||
@@ -294,8 +276,56 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
|||||||
state
|
state
|
||||||
end
|
end
|
||||||
|
|
||||||
def handle_info(_event, state),
|
def track_character(character_id, opts) do
|
||||||
do: state
|
with {:ok, characters} <- WandererApp.Cache.lookup("tracked_characters", []),
|
||||||
|
false <- Enum.member?(characters, character_id) do
|
||||||
|
Logger.debug(fn -> "Start character tracker: #{inspect(character_id)}" end)
|
||||||
|
|
||||||
|
WandererApp.Cache.insert_or_update(
|
||||||
|
"tracked_characters",
|
||||||
|
[character_id],
|
||||||
|
fn existing ->
|
||||||
|
[character_id | existing] |> Enum.uniq()
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
WandererApp.Cache.insert_or_update(
|
||||||
|
"track_characters_queue",
|
||||||
|
[],
|
||||||
|
fn existing ->
|
||||||
|
existing
|
||||||
|
|> Enum.reject(fn c_id -> c_id == character_id end)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
WandererApp.Cache.delete("#{character_id}:track_requested")
|
||||||
|
|
||||||
|
WandererApp.Character.update_character(character_id, %{online: false})
|
||||||
|
|
||||||
|
WandererApp.Character.update_character_state(character_id, %{
|
||||||
|
is_online: false
|
||||||
|
})
|
||||||
|
|
||||||
|
WandererApp.Character.TrackerPoolDynamicSupervisor.start_tracking(character_id)
|
||||||
|
|
||||||
|
WandererApp.TaskWrapper.start_link(WandererApp.Character, :update_character_state, [
|
||||||
|
character_id,
|
||||||
|
%{opts: opts}
|
||||||
|
])
|
||||||
|
else
|
||||||
|
_ ->
|
||||||
|
WandererApp.Cache.insert_or_update(
|
||||||
|
"track_characters_queue",
|
||||||
|
[],
|
||||||
|
fn existing ->
|
||||||
|
existing
|
||||||
|
|> Enum.reject(fn c_id -> c_id == character_id end)
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
WandererApp.Cache.delete("#{character_id}:track_requested")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def character_is_present(map_id, character_id) do
|
def character_is_present(map_id, character_id) do
|
||||||
{:ok, presence_character_ids} =
|
{:ok, presence_character_ids} =
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
|
|
||||||
@update_location_interval :timer.seconds(1)
|
@update_location_interval :timer.seconds(1)
|
||||||
@update_online_interval :timer.seconds(5)
|
@update_online_interval :timer.seconds(5)
|
||||||
@check_offline_characters_interval :timer.minutes(2)
|
@check_offline_characters_interval :timer.minutes(5)
|
||||||
@check_online_errors_interval :timer.minutes(1)
|
@check_online_errors_interval :timer.minutes(1)
|
||||||
@check_ship_errors_interval :timer.minutes(1)
|
@check_ship_errors_interval :timer.minutes(1)
|
||||||
@check_location_errors_interval :timer.minutes(1)
|
@check_location_errors_interval :timer.minutes(1)
|
||||||
@update_ship_interval :timer.seconds(2)
|
@update_ship_interval :timer.seconds(2)
|
||||||
@update_info_interval :timer.minutes(1)
|
@update_info_interval :timer.minutes(2)
|
||||||
@update_wallet_interval :timer.minutes(1)
|
@update_wallet_interval :timer.minutes(1)
|
||||||
|
|
||||||
@logger Application.compile_env(:wanderer_app, :logger)
|
@logger Application.compile_env(:wanderer_app, :logger)
|
||||||
@@ -176,11 +176,15 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
|
|
||||||
try do
|
try do
|
||||||
characters
|
characters
|
||||||
|> Enum.each(fn character_id ->
|
|> Task.async_stream(
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character.Tracker, :update_online, [
|
fn character_id ->
|
||||||
character_id
|
WandererApp.Character.Tracker.update_online(character_id)
|
||||||
])
|
end,
|
||||||
end)
|
max_concurrency: System.schedulers_online(),
|
||||||
|
on_timeout: :kill_task,
|
||||||
|
timeout: :timer.seconds(5)
|
||||||
|
)
|
||||||
|
|> Enum.each(fn _result -> :ok end)
|
||||||
rescue
|
rescue
|
||||||
e ->
|
e ->
|
||||||
Logger.error("""
|
Logger.error("""
|
||||||
@@ -234,17 +238,7 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
characters
|
characters
|
||||||
|> Task.async_stream(
|
|> Task.async_stream(
|
||||||
fn character_id ->
|
fn character_id ->
|
||||||
if WandererApp.Character.can_pause_tracking?(character_id) do
|
WandererApp.Character.Tracker.check_offline(character_id)
|
||||||
WandererApp.TaskWrapper.start_link(
|
|
||||||
WandererApp.Character.Tracker,
|
|
||||||
:check_offline,
|
|
||||||
[
|
|
||||||
character_id
|
|
||||||
]
|
|
||||||
)
|
|
||||||
else
|
|
||||||
:ok
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
timeout: :timer.seconds(15),
|
timeout: :timer.seconds(15),
|
||||||
max_concurrency: System.schedulers_online(),
|
max_concurrency: System.schedulers_online(),
|
||||||
@@ -397,11 +391,15 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
|
|
||||||
try do
|
try do
|
||||||
characters
|
characters
|
||||||
|> Enum.each(fn character_id ->
|
|> Task.async_stream(
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character.Tracker, :update_location, [
|
fn character_id ->
|
||||||
character_id
|
WandererApp.Character.Tracker.update_location(character_id)
|
||||||
])
|
end,
|
||||||
end)
|
max_concurrency: System.schedulers_online(),
|
||||||
|
on_timeout: :kill_task,
|
||||||
|
timeout: :timer.seconds(5)
|
||||||
|
)
|
||||||
|
|> Enum.each(fn _result -> :ok end)
|
||||||
rescue
|
rescue
|
||||||
e ->
|
e ->
|
||||||
Logger.error("""
|
Logger.error("""
|
||||||
@@ -434,11 +432,15 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
|
|
||||||
try do
|
try do
|
||||||
characters
|
characters
|
||||||
|> Enum.each(fn character_id ->
|
|> Task.async_stream(
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character.Tracker, :update_ship, [
|
fn character_id ->
|
||||||
character_id
|
WandererApp.Character.Tracker.update_ship(character_id)
|
||||||
])
|
end,
|
||||||
end)
|
max_concurrency: System.schedulers_online(),
|
||||||
|
on_timeout: :kill_task,
|
||||||
|
timeout: :timer.seconds(5)
|
||||||
|
)
|
||||||
|
|> Enum.each(fn _result -> :ok end)
|
||||||
rescue
|
rescue
|
||||||
e ->
|
e ->
|
||||||
Logger.error("""
|
Logger.error("""
|
||||||
@@ -473,9 +475,7 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
characters
|
characters
|
||||||
|> Task.async_stream(
|
|> Task.async_stream(
|
||||||
fn character_id ->
|
fn character_id ->
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character.Tracker, :update_info, [
|
WandererApp.Character.Tracker.update_info(character_id)
|
||||||
character_id
|
|
||||||
])
|
|
||||||
end,
|
end,
|
||||||
timeout: :timer.seconds(15),
|
timeout: :timer.seconds(15),
|
||||||
max_concurrency: System.schedulers_online(),
|
max_concurrency: System.schedulers_online(),
|
||||||
@@ -519,9 +519,7 @@ defmodule WandererApp.Character.TrackerPool do
|
|||||||
characters
|
characters
|
||||||
|> Task.async_stream(
|
|> Task.async_stream(
|
||||||
fn character_id ->
|
fn character_id ->
|
||||||
WandererApp.TaskWrapper.start_link(WandererApp.Character.Tracker, :update_wallet, [
|
WandererApp.Character.Tracker.update_wallet(character_id)
|
||||||
character_id
|
|
||||||
])
|
|
||||||
end,
|
end,
|
||||||
timeout: :timer.seconds(15),
|
timeout: :timer.seconds(15),
|
||||||
max_concurrency: System.schedulers_online(),
|
max_concurrency: System.schedulers_online(),
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ defmodule WandererApp.Character.TrackingUtils do
|
|||||||
)
|
)
|
||||||
when not is_nil(caller_pid) do
|
when not is_nil(caller_pid) do
|
||||||
with {:ok, character} <-
|
with {:ok, character} <-
|
||||||
WandererApp.Character.get_by_eve_id(character_eve_id),
|
WandererApp.Character.get_by_eve_id("#{character_eve_id}"),
|
||||||
{:ok, %{tracked: is_tracked}} <-
|
{:ok, %{tracked: is_tracked}} <-
|
||||||
do_update_character_tracking(character, map_id, track, caller_pid) do
|
do_update_character_tracking(character, map_id, track, caller_pid) do
|
||||||
# Determine which event to send based on tracking mode and previous state
|
# Determine which event to send based on tracking mode and previous state
|
||||||
@@ -55,15 +55,19 @@ defmodule WandererApp.Character.TrackingUtils do
|
|||||||
Builds tracking data for all characters with access to a map.
|
Builds tracking data for all characters with access to a map.
|
||||||
"""
|
"""
|
||||||
def build_tracking_data(map_id, current_user_id) do
|
def build_tracking_data(map_id, current_user_id) do
|
||||||
with {:ok, map} <- WandererApp.MapRepo.get(map_id, [:acls]),
|
with {:ok, map} <-
|
||||||
{:ok, character_settings} <-
|
WandererApp.MapRepo.get(map_id,
|
||||||
WandererApp.Character.Activity.get_map_character_settings(map_id),
|
acls: [
|
||||||
|
:owner_id,
|
||||||
|
members: [:role, :eve_character_id, :eve_corporation_id, :eve_alliance_id]
|
||||||
|
]
|
||||||
|
),
|
||||||
{:ok, user_settings} <- WandererApp.MapUserSettingsRepo.get(map_id, current_user_id),
|
{:ok, user_settings} <- WandererApp.MapUserSettingsRepo.get(map_id, current_user_id),
|
||||||
{:ok, %{characters: characters_with_access}} <-
|
{:ok, %{characters: characters_with_access}} <-
|
||||||
WandererApp.Maps.load_characters(map, character_settings, current_user_id) do
|
WandererApp.Maps.load_characters(map, current_user_id) do
|
||||||
# Map characters to tracking data
|
# Map characters to tracking data
|
||||||
{:ok, characters_data} =
|
{:ok, characters_data} =
|
||||||
build_character_tracking_data(characters_with_access, character_settings)
|
build_character_tracking_data(characters_with_access)
|
||||||
|
|
||||||
{:ok, main_character} =
|
{:ok, main_character} =
|
||||||
get_main_character(user_settings, characters_with_access, characters_with_access)
|
get_main_character(user_settings, characters_with_access, characters_with_access)
|
||||||
@@ -98,21 +102,19 @@ defmodule WandererApp.Character.TrackingUtils do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Helper to build tracking data for each character
|
# Helper to build tracking data for each character
|
||||||
defp build_character_tracking_data(characters, character_settings) do
|
defp build_character_tracking_data(characters) do
|
||||||
{:ok,
|
{:ok,
|
||||||
Enum.map(characters, fn char ->
|
Enum.map(characters, fn char ->
|
||||||
setting = Enum.find(character_settings, &(&1.character_id == char.id))
|
|
||||||
|
|
||||||
%{
|
%{
|
||||||
character: char |> WandererAppWeb.MapEventHandler.map_ui_character_stat(),
|
character: char |> WandererAppWeb.MapEventHandler.map_ui_character_stat(),
|
||||||
tracked: (setting && setting.tracked) || false
|
tracked: char.tracked
|
||||||
}
|
}
|
||||||
end)}
|
end)}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Private implementation of update character tracking
|
# Private implementation of update character tracking
|
||||||
defp do_update_character_tracking(character, map_id, track, caller_pid) do
|
defp do_update_character_tracking(character, map_id, track, caller_pid) do
|
||||||
WandererApp.MapCharacterSettingsRepo.get_by_map(map_id, character.id)
|
WandererApp.MapCharacterSettingsRepo.get(map_id, character.id)
|
||||||
|> case do
|
|> case do
|
||||||
# Untracking flow
|
# Untracking flow
|
||||||
{:ok, %{tracked: true} = existing_settings} ->
|
{:ok, %{tracked: true} = existing_settings} ->
|
||||||
|
|||||||
@@ -11,49 +11,56 @@ defmodule WandererApp.Env do
|
|||||||
def vsn(), do: Application.spec(@app)[:vsn]
|
def vsn(), do: Application.spec(@app)[:vsn]
|
||||||
|
|
||||||
def git_sha(), do: get_key(:git_sha, "<GIT_SHA>")
|
def git_sha(), do: get_key(:git_sha, "<GIT_SHA>")
|
||||||
def base_url, do: get_key(:web_app_url, "<BASE_URL>")
|
def base_url(), do: get_key(:web_app_url, "<BASE_URL>")
|
||||||
def custom_route_base_url, do: get_key(:custom_route_base_url, "<CUSTOM_ROUTE_BASE_URL>")
|
def base_metrics_only(), do: get_key(:base_metrics_only, false)
|
||||||
def invites, do: get_key(:invites, false)
|
def custom_route_base_url(), do: get_key(:custom_route_base_url, "<CUSTOM_ROUTE_BASE_URL>")
|
||||||
|
def invites(), do: get_key(:invites, false)
|
||||||
|
|
||||||
def map_subscriptions_enabled?, do: get_key(:map_subscriptions_enabled, false)
|
def map_subscriptions_enabled?(), do: get_key(:map_subscriptions_enabled, false)
|
||||||
def websocket_events_enabled?, do: get_key(:websocket_events_enabled, false)
|
def websocket_events_enabled?(), do: get_key(:websocket_events_enabled, false)
|
||||||
def public_api_disabled?, do: get_key(:public_api_disabled, false)
|
def public_api_disabled?(), do: get_key(:public_api_disabled, false)
|
||||||
|
|
||||||
@decorate cacheable(
|
@decorate cacheable(
|
||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "active_tracking_pool"
|
key: "active_tracking_pool"
|
||||||
)
|
)
|
||||||
def active_tracking_pool, do: get_key(:active_tracking_pool, "default")
|
def active_tracking_pool(), do: get_key(:active_tracking_pool, "default")
|
||||||
|
|
||||||
@decorate cacheable(
|
@decorate cacheable(
|
||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "tracking_pool_max_size"
|
key: "tracking_pool_max_size"
|
||||||
)
|
)
|
||||||
def tracking_pool_max_size, do: get_key(:tracking_pool_max_size, 300)
|
def tracking_pool_max_size(), do: get_key(:tracking_pool_max_size, 300)
|
||||||
def character_tracking_pause_disabled?, do: get_key(:character_tracking_pause_disabled, true)
|
def character_tracking_pause_disabled?(), do: get_key(:character_tracking_pause_disabled, true)
|
||||||
def character_api_disabled?, do: get_key(:character_api_disabled, false)
|
def character_api_disabled?(), do: get_key(:character_api_disabled, false)
|
||||||
def wanderer_kills_service_enabled?, do: get_key(:wanderer_kills_service_enabled, false)
|
def wanderer_kills_service_enabled?(), do: get_key(:wanderer_kills_service_enabled, false)
|
||||||
def wallet_tracking_enabled?, do: get_key(:wallet_tracking_enabled, false)
|
def wallet_tracking_enabled?(), do: get_key(:wallet_tracking_enabled, false)
|
||||||
def admins, do: get_key(:admins, [])
|
def admins(), do: get_key(:admins, [])
|
||||||
def admin_username, do: get_key(:admin_username)
|
def admin_username(), do: get_key(:admin_username)
|
||||||
def admin_password, do: get_key(:admin_password)
|
def admin_password(), do: get_key(:admin_password)
|
||||||
def corp_wallet, do: get_key(:corp_wallet, "")
|
def corp_wallet(), do: get_key(:corp_wallet, "")
|
||||||
def corp_wallet_eve_id, do: get_key(:corp_wallet_eve_id, "-1")
|
def corp_wallet_eve_id(), do: get_key(:corp_wallet_eve_id, "-1")
|
||||||
def corp_eve_id, do: get_key(:corp_id, -1)
|
def corp_eve_id(), do: get_key(:corp_id, -1)
|
||||||
def subscription_settings, do: get_key(:subscription_settings)
|
def subscription_settings(), do: get_key(:subscription_settings)
|
||||||
|
|
||||||
@decorate cacheable(
|
@decorate cacheable(
|
||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "restrict_maps_creation"
|
key: "restrict_maps_creation"
|
||||||
)
|
)
|
||||||
def restrict_maps_creation?, do: get_key(:restrict_maps_creation, false)
|
def restrict_maps_creation?(), do: get_key(:restrict_maps_creation, false)
|
||||||
|
|
||||||
def sse_enabled? do
|
@decorate cacheable(
|
||||||
|
cache: WandererApp.Cache,
|
||||||
|
key: "restrict_acls_creation"
|
||||||
|
)
|
||||||
|
def restrict_acls_creation?(), do: get_key(:restrict_acls_creation, false)
|
||||||
|
|
||||||
|
def sse_enabled?() do
|
||||||
Application.get_env(@app, :sse, [])
|
Application.get_env(@app, :sse, [])
|
||||||
|> Keyword.get(:enabled, false)
|
|> Keyword.get(:enabled, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def webhooks_enabled? do
|
def webhooks_enabled?() do
|
||||||
Application.get_env(@app, :external_events, [])
|
Application.get_env(@app, :external_events, [])
|
||||||
|> Keyword.get(:webhooks_enabled, false)
|
|> Keyword.get(:webhooks_enabled, false)
|
||||||
end
|
end
|
||||||
@@ -62,19 +69,19 @@ defmodule WandererApp.Env do
|
|||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "map-connection-auto-expire-hours"
|
key: "map-connection-auto-expire-hours"
|
||||||
)
|
)
|
||||||
def map_connection_auto_expire_hours, do: get_key(:map_connection_auto_expire_hours)
|
def map_connection_auto_expire_hours(), do: get_key(:map_connection_auto_expire_hours)
|
||||||
|
|
||||||
@decorate cacheable(
|
@decorate cacheable(
|
||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "map-connection-auto-eol-hours"
|
key: "map-connection-auto-eol-hours"
|
||||||
)
|
)
|
||||||
def map_connection_auto_eol_hours, do: get_key(:map_connection_auto_eol_hours)
|
def map_connection_auto_eol_hours(), do: get_key(:map_connection_auto_eol_hours)
|
||||||
|
|
||||||
@decorate cacheable(
|
@decorate cacheable(
|
||||||
cache: WandererApp.Cache,
|
cache: WandererApp.Cache,
|
||||||
key: "map-connection-eol-expire-timeout-mins"
|
key: "map-connection-eol-expire-timeout-mins"
|
||||||
)
|
)
|
||||||
def map_connection_eol_expire_timeout_mins,
|
def map_connection_eol_expire_timeout_mins(),
|
||||||
do: get_key(:map_connection_eol_expire_timeout_mins)
|
do: get_key(:map_connection_eol_expire_timeout_mins)
|
||||||
|
|
||||||
def get_key(key, default \\ nil), do: Application.get_env(@app, key, default)
|
def get_key(key, default \\ nil), do: Application.get_env(@app, key, default)
|
||||||
@@ -83,7 +90,7 @@ defmodule WandererApp.Env do
|
|||||||
A single map containing environment variables
|
A single map containing environment variables
|
||||||
made available to react
|
made available to react
|
||||||
"""
|
"""
|
||||||
def to_client_env do
|
def to_client_env() do
|
||||||
%{detailedKillsDisabled: not wanderer_kills_service_enabled?()}
|
%{detailedKillsDisabled: not wanderer_kills_service_enabled?()}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -287,8 +287,8 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
opts: [ttl: @ttl]
|
opts: [ttl: @ttl]
|
||||||
)
|
)
|
||||||
def get_alliance_info(eve_id, opts \\ []) do
|
def get_alliance_info(eve_id, opts \\ []) do
|
||||||
case _get_alliance_info(eve_id, "", opts) do
|
case get_alliance_info(eve_id, "", opts) do
|
||||||
{:ok, result} -> {:ok, result |> Map.put("eve_id", eve_id)}
|
{:ok, result} when is_map(result) -> {:ok, result |> Map.put("eve_id", eve_id)}
|
||||||
{:error, error} -> {:error, error}
|
{:error, error} -> {:error, error}
|
||||||
error -> error
|
error -> error
|
||||||
end
|
end
|
||||||
@@ -309,8 +309,8 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
opts: [ttl: @ttl]
|
opts: [ttl: @ttl]
|
||||||
)
|
)
|
||||||
def get_corporation_info(eve_id, opts \\ []) do
|
def get_corporation_info(eve_id, opts \\ []) do
|
||||||
case _get_corporation_info(eve_id, "", opts) do
|
case get_corporation_info(eve_id, "", opts) do
|
||||||
{:ok, result} -> {:ok, result |> Map.put("eve_id", eve_id)}
|
{:ok, result} when is_map(result) -> {:ok, result |> Map.put("eve_id", eve_id)}
|
||||||
{:error, error} -> {:error, error}
|
{:error, error} -> {:error, error}
|
||||||
error -> error
|
error -> error
|
||||||
end
|
end
|
||||||
@@ -327,7 +327,7 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
opts,
|
opts,
|
||||||
@cache_opts
|
@cache_opts
|
||||||
) do
|
) do
|
||||||
{:ok, result} -> {:ok, result |> Map.put("eve_id", eve_id)}
|
{:ok, result} when is_map(result) -> {:ok, result |> Map.put("eve_id", eve_id)}
|
||||||
{:error, error} -> {:error, error}
|
{:error, error} -> {:error, error}
|
||||||
error -> error
|
error -> error
|
||||||
end
|
end
|
||||||
@@ -434,7 +434,7 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
|
|
||||||
defp get_auth_opts(opts), do: [auth: {:bearer, opts[:access_token]}]
|
defp get_auth_opts(opts), do: [auth: {:bearer, opts[:access_token]}]
|
||||||
|
|
||||||
defp _get_alliance_info(alliance_eve_id, info_path, opts),
|
defp get_alliance_info(alliance_eve_id, info_path, opts),
|
||||||
do:
|
do:
|
||||||
get(
|
get(
|
||||||
"/alliances/#{alliance_eve_id}/#{info_path}",
|
"/alliances/#{alliance_eve_id}/#{info_path}",
|
||||||
@@ -442,7 +442,7 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
@cache_opts
|
@cache_opts
|
||||||
)
|
)
|
||||||
|
|
||||||
defp _get_corporation_info(corporation_eve_id, info_path, opts),
|
defp get_corporation_info(corporation_eve_id, info_path, opts),
|
||||||
do:
|
do:
|
||||||
get(
|
get(
|
||||||
"/corporations/#{corporation_eve_id}/#{info_path}",
|
"/corporations/#{corporation_eve_id}/#{info_path}",
|
||||||
@@ -830,7 +830,8 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
expires_at,
|
expires_at,
|
||||||
scopes
|
scopes
|
||||||
) do
|
) do
|
||||||
time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at, :second)
|
expires_at_datetime = DateTime.from_unix!(expires_at)
|
||||||
|
time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at_datetime, :second)
|
||||||
|
|
||||||
Logger.warning("TOKEN_REFRESH_FAILED: Invalid grant error during token refresh",
|
Logger.warning("TOKEN_REFRESH_FAILED: Invalid grant error during token refresh",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
@@ -857,7 +858,8 @@ defmodule WandererApp.Esi.ApiClient do
|
|||||||
expires_at,
|
expires_at,
|
||||||
scopes
|
scopes
|
||||||
) do
|
) do
|
||||||
time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at, :second)
|
expires_at_datetime = DateTime.from_unix!(expires_at)
|
||||||
|
time_since_expiry = DateTime.diff(DateTime.utc_now(), expires_at_datetime, :second)
|
||||||
|
|
||||||
Logger.warning("TOKEN_REFRESH_FAILED: Connection refused during token refresh",
|
Logger.warning("TOKEN_REFRESH_FAILED: Connection refused during token refresh",
|
||||||
character_id: character_id,
|
character_id: character_id,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ defmodule WandererApp.ExternalEvents.Event do
|
|||||||
def new(map_id, event_type, payload) when is_binary(map_id) and is_map(payload) do
|
def new(map_id, event_type, payload) when is_binary(map_id) and is_map(payload) do
|
||||||
if valid_event_type?(event_type) do
|
if valid_event_type?(event_type) do
|
||||||
%__MODULE__{
|
%__MODULE__{
|
||||||
id: Ulid.generate(System.system_time(:millisecond)),
|
id: Ecto.ULID.generate(System.system_time(:millisecond)),
|
||||||
map_id: map_id,
|
map_id: map_id,
|
||||||
type: event_type,
|
type: event_type,
|
||||||
payload: payload,
|
payload: payload,
|
||||||
@@ -97,7 +97,7 @@ defmodule WandererApp.ExternalEvents.Event do
|
|||||||
:locked,
|
:locked,
|
||||||
# ADD
|
# ADD
|
||||||
:temporary_name,
|
:temporary_name,
|
||||||
# ADD
|
# ADD
|
||||||
:labels,
|
:labels,
|
||||||
# ADD
|
# ADD
|
||||||
:description,
|
:description,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user