Compare commits
51 Commits
v1.0.21
...
19-add-map
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d622e486f4 | ||
|
|
81926633b0 | ||
|
|
e66c125dbf | ||
|
|
e4fe8fdc53 | ||
|
|
9862bcfa05 | ||
|
|
0ac5451bef | ||
|
|
669479b815 | ||
|
|
2721130566 | ||
|
|
6e33ad943f | ||
|
|
f4b7357802 | ||
|
|
7a404a7e6a | ||
|
|
5158700a79 | ||
|
|
41d10c1b47 | ||
|
|
3aaac91f07 | ||
|
|
ea7ff080b8 | ||
|
|
b5270958eb | ||
|
|
b0a38eab8c | ||
|
|
0a478e82ba | ||
|
|
02d97a009c | ||
|
|
33940cdb9b | ||
|
|
7a63f9ee6b | ||
|
|
89b41fff59 | ||
|
|
7a15f71528 | ||
|
|
cdce2f8761 | ||
|
|
a2470bbe47 | ||
|
|
dbdf1ddce0 | ||
|
|
f767e42e6f | ||
|
|
3051eb6369 | ||
|
|
a41faddca3 | ||
|
|
469038730e | ||
|
|
b1fe5d2453 | ||
|
|
f43e717da0 | ||
|
|
95c8d4eef8 | ||
|
|
747ca0ee82 | ||
|
|
35a0184ec3 | ||
|
|
96e1e5328c | ||
|
|
7f98d6a0d8 | ||
|
|
0194e25696 | ||
|
|
189442e50f | ||
|
|
d9bed070ec | ||
|
|
a6193da8b5 | ||
|
|
50d35b207d | ||
|
|
19eb45bfa1 | ||
|
|
01e0b24d9d | ||
|
|
3c8024b16c | ||
|
|
4c0ad0dd66 | ||
|
|
501840086b | ||
|
|
240b180857 | ||
|
|
2bc5d0aaea | ||
|
|
df66aa79b8 | ||
|
|
6ea6a59ce3 |
2
.gitignore
vendored
@@ -12,6 +12,8 @@
|
||||
|
||||
# Ignore assets that are produced by build tools.
|
||||
/priv/static/assets/
|
||||
/priv/static/icons/
|
||||
/priv/static/images/
|
||||
/priv/static/*.js
|
||||
/priv/static/*.css
|
||||
|
||||
|
||||
199
CHANGELOG.md
@@ -2,7 +2,108 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.0.21](https://github.com/wanderer-industries/wanderer/compare/v1.0.20...v1.0.21) (2024-09-24)
|
||||
## [v1.3.0](https://github.com/wanderer-industries/wanderer/compare/v1.2.10...v1.3.0) (2024-10-07)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Map: Fix default sort
|
||||
|
||||
* Map: Remove resizible and fix styles of column sorting
|
||||
|
||||
* Map: Revision of sorting from also adding ability to sort all columns
|
||||
|
||||
## [v1.2.10](https://github.com/wanderer-industries/wanderer/compare/v1.2.9...v1.2.10) (2024-10-07)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.2.9](https://github.com/wanderer-industries/wanderer/compare/v1.2.8...v1.2.9) (2024-10-07)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.2.8](https://github.com/wanderer-industries/wanderer/compare/v1.2.7...v1.2.8) (2024-10-06)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.2.7](https://github.com/wanderer-industries/wanderer/compare/v1.2.6...v1.2.7) (2024-10-05)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.2.6](https://github.com/wanderer-industries/wanderer/compare/v1.2.5...v1.2.6) (2024-10-05)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Stability & performance improvements
|
||||
|
||||
## [v1.2.5](https://github.com/wanderer-industries/wanderer/compare/v1.2.4...v1.2.5) (2024-10-04)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Add system "true security" correction
|
||||
|
||||
## [v1.2.4](https://github.com/wanderer-industries/wanderer/compare/v1.2.3...v1.2.4) (2024-10-03)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Map: Remove duplicate connections
|
||||
|
||||
## [v1.2.3](https://github.com/wanderer-industries/wanderer/compare/v1.2.2...v1.2.3) (2024-10-02)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Map: Fix map loading after select a different map.
|
||||
|
||||
## [v1.2.2](https://github.com/wanderer-industries/wanderer/compare/v1.2.1...v1.2.2) (2024-10-02)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.2.1](https://github.com/wanderer-industries/wanderer/compare/v1.2.0...v1.2.1) (2024-10-02)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* ACL: Fix allowing to save map/access list with empty owner set
|
||||
|
||||
## [v1.2.0](https://github.com/wanderer-industries/wanderer/compare/v1.1.0...v1.2.0) (2024-09-29)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Map: Add ability to open jump planner from routes
|
||||
|
||||
## [v1.1.0](https://github.com/wanderer-industries/wanderer/compare/v1.0.23...v1.1.0) (2024-09-29)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Map: Add highlighting for imperial space systems depends on faction
|
||||
|
||||
## [v1.0.23](https://github.com/wanderer-industries/wanderer/compare/v1.0.22...v1.0.23) (2024-09-25)
|
||||
|
||||
|
||||
|
||||
@@ -11,44 +112,39 @@
|
||||
|
||||
* Map: Main map doesn't load back after refreshing/switching pages
|
||||
|
||||
## [v1.0.22](https://github.com/wanderer-industries/wanderer/compare/v1.0.21...v1.0.22) (2024-09-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Map: Main map doesn't load back after refreshing/switching pages
|
||||
|
||||
## [v1.0.21](https://github.com/wanderer-industries/wanderer/compare/v1.0.20...v1.0.21) (2024-09-24)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Map: Main map doesn't load back after refreshing/switching pages
|
||||
|
||||
## [v1.0.20](https://github.com/wanderer-industries/wanderer/compare/v1.0.19...v1.0.20) (2024-09-23)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* core: Small fixes & improvements
|
||||
|
||||
## [v1.0.19](https://github.com/wanderer-industries/wanderer/compare/v1.0.18...v1.0.19) (2024-09-23)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* ACL: Fix adding empty members list
|
||||
|
||||
## [v1.0.18](https://github.com/wanderer-industries/wanderer/compare/v1.0.17...v1.0.18) (2024-09-22)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* ACL: Cant delete ACL list after map deletion #5
|
||||
|
||||
## [v1.0.17](https://github.com/wanderer-industries/wanderer/compare/v1.0.16...v1.0.17) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.16](https://github.com/wanderer-industries/wanderer/compare/v1.0.15...v1.0.16) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* Map: commented console log
|
||||
|
||||
@@ -58,103 +154,58 @@
|
||||
|
||||
## [v1.0.15](https://github.com/wanderer-industries/wanderer/compare/v1.0.14...v1.0.15) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* map: Show a proper user notification if map was deleted/archived
|
||||
|
||||
## [v1.0.14](https://github.com/wanderer-industries/wanderer/compare/v1.0.13...v1.0.14) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.13](https://github.com/wanderer-industries/wanderer/compare/v1.0.12...v1.0.13) (2024-09-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* tracking: Ensure user has at least one character tracked to work with map
|
||||
|
||||
## [v1.0.12](https://github.com/wanderer-industries/wanderer/compare/v1.0.11...v1.0.12) (2024-09-20)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* audit: Hide character for non-character map activities
|
||||
|
||||
## [v1.0.11](https://github.com/wanderer-industries/wanderer/compare/v1.0.10...v1.0.11) (2024-09-20)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.10](https://github.com/wanderer-industries/wanderer/compare/v1.0.9...v1.0.10) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* signatures: Fix update signatures error if no character tracked on map
|
||||
|
||||
## [v1.0.9](https://github.com/wanderer-industries/wanderer/compare/v1.0.8...v1.0.9) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* core: Fix system add error if it's already added on map
|
||||
|
||||
## [v1.0.8](https://github.com/wanderer-industries/wanderer/compare/v1.0.7...v1.0.8) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* docker: Fix DB connection in docker-compose internal network
|
||||
|
||||
## [v1.0.7](https://github.com/wanderer-industries/wanderer/compare/v1.0.6...v1.0.7) (2024-09-19)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.6](https://github.com/wanderer-industries/wanderer/compare/v1.0.5...v1.0.6) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.5](https://github.com/wanderer-industries/wanderer/compare/v1.0.4...v1.0.5) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.4](https://github.com/wanderer-industries/wanderer/compare/v1.0.3...v1.0.4) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
### Bug Fixes
|
||||
|
||||
* core: skip search results for failed character info request
|
||||
|
||||
## [v1.0.3](https://github.com/wanderer-industries/wanderer/compare/v1.0.2...v1.0.3) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.2](https://github.com/wanderer-industries/wanderer/compare/v1.0.1...v1.0.2) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.0.1](https://github.com/wanderer-industries/wanderer/compare/v1.0.0...v1.0.1) (2024-09-18)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -67,3 +67,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
.p-sortable-column {
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 3px 4px;
|
||||
}
|
||||
|
||||
.p-selectable-row td {
|
||||
padding: 4px 4px;
|
||||
}
|
||||
|
||||
.p-sortable-column > .p-column-header-content > span:last-child {
|
||||
transform: scale(0.7);
|
||||
|
||||
& > svg {
|
||||
margin-left: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,17 +8,21 @@ import { getSystemById } from '@/hooks/Mapper/helpers';
|
||||
import { useWaypointMenu } from '@/hooks/Mapper/components/contexts/hooks';
|
||||
import { WaypointSetContextHandler } from '@/hooks/Mapper/components/contexts/types.ts';
|
||||
import { FastSystemActions } from '@/hooks/Mapper/components/contexts/components';
|
||||
import { useJumpPlannerMenu } from '@/hooks/Mapper/components/contexts/hooks/useJumpPlannerMenu';
|
||||
import { Route } from '@/hooks/Mapper/types/routes.ts';
|
||||
|
||||
export interface ContextMenuSystemInfoProps {
|
||||
systemStatics: Map<number, SolarSystemStaticInfoRaw>;
|
||||
hubs: string[];
|
||||
contextMenuRef: RefObject<ContextMenu>;
|
||||
systemId: string | undefined;
|
||||
systemIdFrom?: string | undefined;
|
||||
systems: SolarSystemRawType[];
|
||||
onOpenSettings(): void;
|
||||
onHubToggle(): void;
|
||||
onAddSystem(): void;
|
||||
onWaypointSet: WaypointSetContextHandler;
|
||||
routes: Route[];
|
||||
}
|
||||
|
||||
export const ContextMenuSystemInfo: React.FC<ContextMenuSystemInfoProps> = ({
|
||||
@@ -30,9 +34,12 @@ export const ContextMenuSystemInfo: React.FC<ContextMenuSystemInfoProps> = ({
|
||||
onAddSystem,
|
||||
onWaypointSet,
|
||||
systemId,
|
||||
systemIdFrom,
|
||||
hubs,
|
||||
routes,
|
||||
}) => {
|
||||
const getWaypointMenu = useWaypointMenu(onWaypointSet);
|
||||
const getJumpPlannerMenu = useJumpPlannerMenu(systems, systemIdFrom);
|
||||
|
||||
const items: MenuItem[] = useMemo(() => {
|
||||
const system = systemId ? systemStatics.get(parseInt(systemId)) : undefined;
|
||||
@@ -55,7 +62,9 @@ export const ContextMenuSystemInfo: React.FC<ContextMenuSystemInfoProps> = ({
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
{ separator: true },
|
||||
...getJumpPlannerMenu(system, routes),
|
||||
...getWaypointMenu(systemId, system.system_class),
|
||||
{
|
||||
label: !hubs.includes(systemId) ? 'Add in Routes' : 'Remove from Routes',
|
||||
@@ -72,7 +81,17 @@ export const ContextMenuSystemInfo: React.FC<ContextMenuSystemInfoProps> = ({
|
||||
]
|
||||
: []),
|
||||
];
|
||||
}, [systemId, systemStatics, systems, getWaypointMenu, hubs, onHubToggle, onAddSystem, onOpenSettings]);
|
||||
}, [
|
||||
systemId,
|
||||
systemStatics,
|
||||
systems,
|
||||
getJumpPlannerMenu,
|
||||
getWaypointMenu,
|
||||
hubs,
|
||||
onHubToggle,
|
||||
onAddSystem,
|
||||
onOpenSettings,
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Commands, MapHandlers, OutCommand, OutCommandHandler } from '@/hooks/Ma
|
||||
import { WaypointSetContextHandler } from '@/hooks/Mapper/components/contexts/types.ts';
|
||||
import { ctxManager } from '@/hooks/Mapper/utils/contextManager.ts';
|
||||
import * as React from 'react';
|
||||
import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
|
||||
|
||||
interface UseContextMenuSystemHandlersProps {
|
||||
hubs: string[];
|
||||
@@ -15,16 +16,21 @@ export const useContextMenuSystemInfoHandlers = ({ hubs, outCommand, mapRef }: U
|
||||
const contextMenuRef = useRef<ContextMenu | null>(null);
|
||||
|
||||
const [system, setSystem] = useState<string>();
|
||||
const routeRef = useRef<(SolarSystemStaticInfoRaw | undefined)[]>([]);
|
||||
|
||||
const ref = useRef({ hubs, system, outCommand, mapRef });
|
||||
ref.current = { hubs, system, outCommand, mapRef };
|
||||
|
||||
const open = useCallback((ev: React.SyntheticEvent, systemId: string) => {
|
||||
setSystem(systemId);
|
||||
ev.preventDefault();
|
||||
ctxManager.next('ctxSysInfo', contextMenuRef.current);
|
||||
contextMenuRef.current?.show(ev);
|
||||
}, []);
|
||||
const open = useCallback(
|
||||
(ev: React.SyntheticEvent, systemId: string, route: (SolarSystemStaticInfoRaw | undefined)[]) => {
|
||||
setSystem(systemId);
|
||||
routeRef.current = route;
|
||||
ev.preventDefault();
|
||||
ctxManager.next('ctxSysInfo', contextMenuRef.current);
|
||||
contextMenuRef.current?.show(ev);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const onHubToggle = useCallback(() => {
|
||||
const { hubs, system, outCommand } = ref.current;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './useJumpPlannerMenu.tsx';
|
||||
@@ -0,0 +1,129 @@
|
||||
import { MenuItem } from 'primereact/menuitem';
|
||||
import { PrimeIcons } from 'primereact/api';
|
||||
import { useCallback } from 'react';
|
||||
import { isPossibleSpace } from '@/hooks/Mapper/components/map/helpers/isKnownSpace.ts';
|
||||
import { Route } from '@/hooks/Mapper/types/routes.ts';
|
||||
import { SolarSystemRawType, SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
|
||||
import { getSystemById } from '@/hooks/Mapper/helpers';
|
||||
import { SOLAR_SYSTEM_CLASS_IDS } from '@/hooks/Mapper/components/map/constants.ts';
|
||||
|
||||
const imperialSpace = [SOLAR_SYSTEM_CLASS_IDS.hs, SOLAR_SYSTEM_CLASS_IDS.ls, SOLAR_SYSTEM_CLASS_IDS.ns];
|
||||
const criminalSpace = [SOLAR_SYSTEM_CLASS_IDS.ls, SOLAR_SYSTEM_CLASS_IDS.ns];
|
||||
|
||||
enum JUMP_SHIP_TYPE {
|
||||
BLACK_OPS = 'Marshal',
|
||||
JUMP_FREIGHTER = 'Anshar',
|
||||
RORQUAL = 'Rorqual',
|
||||
CAPITAL = 'Thanatos',
|
||||
SUPER_CAPITAL = 'Avatar',
|
||||
}
|
||||
|
||||
export const openJumpPlan = (jumpShipType: JUMP_SHIP_TYPE, from: string, to: string) => {
|
||||
return window.open(`https://evemaps.dotlan.net/jump/${jumpShipType},544/${from}:${to}`, '_blank');
|
||||
};
|
||||
|
||||
const BRACKET_ICONS = {
|
||||
npcsuperCarrier_32: '/icons/brackets/npcsuperCarrier_32.png',
|
||||
carrier_32: '/icons/brackets/carrier_32.png',
|
||||
battleship_32: '/icons/brackets/battleship_32.png',
|
||||
freighter_32: '/icons/brackets/freighter_32.png',
|
||||
};
|
||||
|
||||
const renderIcon = (icon: string) => {
|
||||
return (
|
||||
<div className="flex justify-center items-center mr-1.5 pt-px">
|
||||
<img src={icon} style={{ width: 20, height: 20 }} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const useJumpPlannerMenu = (
|
||||
systems: SolarSystemRawType[],
|
||||
systemIdFrom?: string | undefined,
|
||||
): ((systemId: SolarSystemStaticInfoRaw, routes: Route[]) => MenuItem[]) => {
|
||||
return useCallback(
|
||||
(destination: SolarSystemStaticInfoRaw) => {
|
||||
if (!destination || !systemIdFrom) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const origin = getSystemById(systems, systemIdFrom)?.system_static_info;
|
||||
|
||||
if (!origin) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const isShowBOorJumpFreighter =
|
||||
isPossibleSpace(imperialSpace, origin.system_class) && isPossibleSpace(criminalSpace, destination.system_class);
|
||||
|
||||
const isShowCapital =
|
||||
isPossibleSpace(criminalSpace, origin.system_class) && isPossibleSpace(criminalSpace, destination.system_class);
|
||||
|
||||
if (!isShowBOorJumpFreighter && !isShowCapital) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
label: 'In Jump Planner',
|
||||
icon: PrimeIcons.SEND,
|
||||
items: [
|
||||
...(isShowBOorJumpFreighter
|
||||
? [
|
||||
{
|
||||
label: 'Black Ops',
|
||||
icon: renderIcon(BRACKET_ICONS.battleship_32),
|
||||
command: () => {
|
||||
openJumpPlan(JUMP_SHIP_TYPE.BLACK_OPS, origin.solar_system_name, destination.solar_system_name);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Jump Freighter',
|
||||
icon: renderIcon(BRACKET_ICONS.freighter_32),
|
||||
command: () => {
|
||||
openJumpPlan(
|
||||
JUMP_SHIP_TYPE.JUMP_FREIGHTER,
|
||||
origin.solar_system_name,
|
||||
destination.solar_system_name,
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Rorqual',
|
||||
icon: renderIcon(BRACKET_ICONS.freighter_32),
|
||||
command: () => {
|
||||
openJumpPlan(JUMP_SHIP_TYPE.RORQUAL, origin.solar_system_name, destination.solar_system_name);
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
|
||||
...(isShowCapital
|
||||
? [
|
||||
{
|
||||
label: 'Capital',
|
||||
icon: renderIcon(BRACKET_ICONS.carrier_32),
|
||||
command: () => {
|
||||
openJumpPlan(JUMP_SHIP_TYPE.CAPITAL, origin.solar_system_name, destination.solar_system_name);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Super Capital',
|
||||
icon: renderIcon(BRACKET_ICONS.npcsuperCarrier_32),
|
||||
command: () => {
|
||||
openJumpPlan(
|
||||
JUMP_SHIP_TYPE.SUPER_CAPITAL,
|
||||
origin.solar_system_name,
|
||||
destination.solar_system_name,
|
||||
);
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
[systems, systemIdFrom],
|
||||
);
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { ForwardedRef, forwardRef, MouseEvent, useCallback } from 'react';
|
||||
import { ForwardedRef, forwardRef, MouseEvent, useCallback, useEffect } from 'react';
|
||||
import ReactFlow, {
|
||||
Background,
|
||||
ConnectionMode,
|
||||
@@ -94,6 +94,7 @@ interface MapCompProps {
|
||||
minimapClasses?: string;
|
||||
isShowMinimap?: boolean;
|
||||
onSystemContextMenu: (event: MouseEvent<Element>, systemId: string) => void;
|
||||
showKSpaceBG?: boolean;
|
||||
}
|
||||
|
||||
const MapComp = ({
|
||||
@@ -105,6 +106,7 @@ const MapComp = ({
|
||||
onConnectionInfoClick,
|
||||
onSelectionContextMenu,
|
||||
isShowMinimap,
|
||||
showKSpaceBG,
|
||||
}: MapCompProps) => {
|
||||
const [nodes, , onNodesChange] = useNodesState<SolarSystemRawType>(initialNodes);
|
||||
const [edges, , onEdgesChange] = useEdgesState<Edge<SolarSystemConnection>[]>(initialEdges);
|
||||
@@ -169,6 +171,13 @@ const MapComp = ({
|
||||
localStorage.setItem(SESSION_KEY.viewPort, JSON.stringify(viewport));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
update(x => ({
|
||||
...x,
|
||||
showKSpaceBG: showKSpaceBG,
|
||||
}));
|
||||
}, [showKSpaceBG, update]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classes.MapRoot}>
|
||||
|
||||
@@ -7,6 +7,7 @@ export type MapData = MapUnionTypes & {
|
||||
isConnecting: boolean;
|
||||
hoverNodeId: string | null;
|
||||
visibleNodes: Set<string>;
|
||||
showKSpaceBG: boolean;
|
||||
};
|
||||
|
||||
interface MapProviderProps {
|
||||
@@ -27,6 +28,7 @@ const INITIAL_DATA: MapData = {
|
||||
connections: [],
|
||||
hoverNodeId: null,
|
||||
visibleNodes: new Set(),
|
||||
showKSpaceBG: false,
|
||||
};
|
||||
|
||||
export interface MapContextProps {
|
||||
@@ -38,6 +40,7 @@ export interface MapContextProps {
|
||||
const MapContext = createContext<MapContextProps>({
|
||||
update: () => {},
|
||||
data: { ...INITIAL_DATA },
|
||||
// @ts-ignore
|
||||
outCommand: async () => void 0,
|
||||
});
|
||||
|
||||
|
||||
@@ -23,6 +23,62 @@ $tooltip-bg: #202020; // Темный фон для подсказок
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
|
||||
|
||||
&.Mataria, &.Amarria, &.Gallente, &.Caldaria {
|
||||
&::Before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-size: cover;
|
||||
background-position: 50% 50%;
|
||||
z-index: -1;
|
||||
background-repeat: no-repeat;
|
||||
border-radius: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
&.Mataria {
|
||||
&::before {
|
||||
background-image: url("/images/mataria.png");
|
||||
opacity: 0.6;
|
||||
background-position-x: -28px;
|
||||
background-position-y: -3px;
|
||||
}
|
||||
}
|
||||
|
||||
&.Caldaria {
|
||||
&::before {
|
||||
background-image: url("/images/caldaria.png");
|
||||
opacity: 0.6;
|
||||
background-position-x: -16px;
|
||||
background-position-y: -17px;
|
||||
}
|
||||
}
|
||||
|
||||
&.Amarria {
|
||||
&::before {
|
||||
opacity: 0.45;
|
||||
background-image: url("/images/amarr.png");
|
||||
background-position-x: 0px;
|
||||
background-position-y: -1px;
|
||||
width: calc(100% + 10px)
|
||||
}
|
||||
}
|
||||
|
||||
&.Gallente {
|
||||
&::before {
|
||||
opacity: 0.6;
|
||||
background-image: url("/images/gallente.png");
|
||||
background-position-x: -1px;
|
||||
background-position-y: -10px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
&.selected {
|
||||
border-color: $pastel-pink;
|
||||
|
||||
@@ -19,6 +19,14 @@ import { PrimeIcons } from 'primereact/api';
|
||||
import { LabelsManager } from '@/hooks/Mapper/utils/labelsManager.ts';
|
||||
import { OutCommand } from '@/hooks/Mapper/types';
|
||||
import { useDoubleClick } from '@/hooks/Mapper/hooks/useDoubleClick.ts';
|
||||
import { REGIONS_MAP, Spaces } from '@/hooks/Mapper/constants';
|
||||
|
||||
const SpaceToClass: Record<string, string> = {
|
||||
[Spaces.Caldari]: classes.Caldaria,
|
||||
[Spaces.Matar]: classes.Mataria,
|
||||
[Spaces.Amarr]: classes.Amarria,
|
||||
[Spaces.Gallente]: classes.Gallente,
|
||||
};
|
||||
|
||||
const sortedLabels = (labels: string[]) => {
|
||||
if (labels === null) {
|
||||
@@ -50,6 +58,7 @@ export const SolarSystemNode = memo(({ data, selected }: WrapNodeProps<MapSolarS
|
||||
statics,
|
||||
effect_name,
|
||||
region_name,
|
||||
region_id,
|
||||
is_shattered,
|
||||
solar_system_name,
|
||||
} = data.system_static_info;
|
||||
@@ -69,6 +78,7 @@ export const SolarSystemNode = memo(({ data, selected }: WrapNodeProps<MapSolarS
|
||||
isConnecting,
|
||||
hoverNodeId,
|
||||
visibleNodes,
|
||||
showKSpaceBG,
|
||||
},
|
||||
outCommand,
|
||||
} = useMapState();
|
||||
@@ -114,6 +124,9 @@ export const SolarSystemNode = memo(({ data, selected }: WrapNodeProps<MapSolarS
|
||||
|
||||
const showHandlers = isConnecting || hoverNodeId === id;
|
||||
|
||||
const space = showKSpaceBG ? REGIONS_MAP[region_id] : '';
|
||||
const regionClass = showKSpaceBG ? SpaceToClass[space] : null;
|
||||
|
||||
return (
|
||||
<>
|
||||
{visible && (
|
||||
@@ -147,7 +160,11 @@ export const SolarSystemNode = memo(({ data, selected }: WrapNodeProps<MapSolarS
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={clsx(classes.RootCustomNode, classes[STATUS_CLASSES[status]], { [classes.selected]: selected })}>
|
||||
<div
|
||||
className={clsx(classes.RootCustomNode, regionClass, classes[STATUS_CLASSES[status]], {
|
||||
[classes.selected]: selected,
|
||||
})}
|
||||
>
|
||||
{visible && (
|
||||
<>
|
||||
<div className={classes.HeadRow}>
|
||||
@@ -183,7 +200,13 @@ export const SolarSystemNode = memo(({ data, selected }: WrapNodeProps<MapSolarS
|
||||
)}
|
||||
|
||||
{!isWormhole && !customName && (
|
||||
<div className="text-stone-400 whitespace-nowrap overflow-hidden text-ellipsis mr-0.5">
|
||||
<div
|
||||
className={clsx('text-stone-400 whitespace-nowrap overflow-hidden text-ellipsis mr-0.5', {
|
||||
['text-teal-100 font-bold']: space === Spaces.Caldari,
|
||||
['text-yellow-100 font-bold']: space === Spaces.Amarr || space === Spaces.Matar,
|
||||
['text-lime-200/80 font-bold']: space === Spaces.Gallente,
|
||||
})}
|
||||
>
|
||||
{region_name}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -11,3 +11,7 @@ export const isKnownSpace = (wormholeClassID: number) => {
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const isPossibleSpace = (spaces: number[], wormholeClassID: number) => {
|
||||
return spaces.includes(wormholeClassID);
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ export const RoutesWidgetContent = () => {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [hubs, systems, systemStatics, lastUpdateKey]);
|
||||
|
||||
const preparedRoutes = useMemo(() => {
|
||||
const preparedRoutes: Route[] = useMemo(() => {
|
||||
return (
|
||||
routes?.routes
|
||||
.sort(sortByDist)
|
||||
@@ -71,15 +71,17 @@ export const RoutesWidgetContent = () => {
|
||||
);
|
||||
}, [routes?.routes, routes?.systems_static_data, systemId]);
|
||||
|
||||
const refData = useRef({ open, loadSystems });
|
||||
refData.current = { open, loadSystems };
|
||||
const refData = useRef({ open, loadSystems, preparedRoutes });
|
||||
refData.current = { open, loadSystems, preparedRoutes };
|
||||
|
||||
useEffect(() => {
|
||||
(async () => await refData.current.loadSystems(hubs))();
|
||||
}, [hubs]);
|
||||
|
||||
const handleClick = useCallback((e: MouseEvent, systemId: string) => {
|
||||
refData.current.open(e, systemId);
|
||||
const route = refData.current.preparedRoutes.find(x => x.destination.toString() === systemId);
|
||||
|
||||
refData.current.open(e, systemId, route?.mapped_systems ?? []);
|
||||
}, []);
|
||||
|
||||
const handleContextMenu = useCallback(
|
||||
@@ -146,7 +148,14 @@ export const RoutesWidgetContent = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<ContextMenuSystemInfo hubs={hubs} systems={systems} systemStatics={systemStatics} {...systemCtxProps} />
|
||||
<ContextMenuSystemInfo
|
||||
hubs={hubs}
|
||||
routes={preparedRoutes}
|
||||
systems={systems}
|
||||
systemStatics={systemStatics}
|
||||
systemIdFrom={systemId}
|
||||
{...systemCtxProps}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,3 +4,7 @@
|
||||
font-size: 12px !important;
|
||||
line-height: 8px;
|
||||
}
|
||||
|
||||
.Table {
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { parseSignatures } from '@/hooks/Mapper/helpers';
|
||||
import { OutCommand } from '@/hooks/Mapper/types/mapHandlers.ts';
|
||||
import { WdTooltip, WdTooltipHandlers } from '@/hooks/Mapper/components/ui-kit';
|
||||
|
||||
import { DataTable, DataTableRowMouseEvent } from 'primereact/datatable';
|
||||
import { DataTable, DataTableRowMouseEvent, SortOrder } from 'primereact/datatable';
|
||||
import { Column } from 'primereact/column';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import useRefState from 'react-usestateref';
|
||||
@@ -25,6 +25,18 @@ import {
|
||||
renderName,
|
||||
renderTimeLeft,
|
||||
} from '@/hooks/Mapper/components/mapInterface/widgets/SystemSignatures/renders';
|
||||
// import { PrimeIcons } from 'primereact/api';
|
||||
import useLocalStorageState from 'use-local-storage-state';
|
||||
|
||||
type SystemSignaturesSortSettings = {
|
||||
sortField: string;
|
||||
sortOrder: SortOrder;
|
||||
};
|
||||
|
||||
const SORT_DEFAULT_VALUES: SystemSignaturesSortSettings = {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: -1,
|
||||
};
|
||||
|
||||
interface SystemSignaturesContentProps {
|
||||
systemId: string;
|
||||
@@ -39,6 +51,10 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
|
||||
const [hoveredSig, setHoveredSig] = useState<SystemSignature | null>(null);
|
||||
|
||||
const [sortSettings, setSortSettings] = useLocalStorageState<SystemSignaturesSortSettings>('window:signatures:sort', {
|
||||
defaultValue: SORT_DEFAULT_VALUES,
|
||||
});
|
||||
|
||||
const tableRef = useRef<HTMLDivElement>(null);
|
||||
const compact = useMaxWidth(tableRef, 260);
|
||||
const medium = useMaxWidth(tableRef, 380);
|
||||
@@ -50,7 +66,7 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
const handleResize = useCallback(() => {
|
||||
if (tableRef.current) {
|
||||
const tableWidth = tableRef.current.offsetWidth;
|
||||
const otherColumnsWidth = 265;
|
||||
const otherColumnsWidth = 276;
|
||||
const availableWidth = tableWidth - otherColumnsWidth;
|
||||
setNameColumnWidth(`${availableWidth}px`);
|
||||
}
|
||||
@@ -159,6 +175,14 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
setHoveredSig(null);
|
||||
}, []);
|
||||
|
||||
// const renderToolbar = (/*row: SystemSignature*/) => {
|
||||
// return (
|
||||
// <div className="flex justify-end items-center gap-2">
|
||||
// <span className={clsx(PrimeIcons.PENCIL, 'text-[10px]')}></span>
|
||||
// </div>
|
||||
// );
|
||||
// };
|
||||
|
||||
return (
|
||||
<div ref={tableRef} className="h-full">
|
||||
{filteredSignatures.length === 0 ? (
|
||||
@@ -168,19 +192,23 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
) : (
|
||||
<>
|
||||
<DataTable
|
||||
className={classes.Table}
|
||||
value={filteredSignatures}
|
||||
size="small"
|
||||
selectionMode="multiple"
|
||||
selection={selectedSignatures}
|
||||
metaKeySelection
|
||||
onSelectionChange={e => setSelectedSignatures(e.value)}
|
||||
dataKey="eve_id"
|
||||
tableClassName="w-full select-none"
|
||||
resizableColumns
|
||||
resizableColumns={false}
|
||||
rowHover
|
||||
selectAll
|
||||
showHeaders={false}
|
||||
onRowMouseEnter={handleEnterRow}
|
||||
onRowMouseLeave={handleLeaveRow}
|
||||
sortField={sortSettings.sortField}
|
||||
sortOrder={sortSettings.sortOrder}
|
||||
onSort={event => setSortSettings(() => ({ sortField: event.sortField, sortOrder: event.sortOrder }))}
|
||||
onRowMouseEnter={compact || medium ? handleEnterRow : undefined}
|
||||
onRowMouseLeave={compact || medium ? handleLeaveRow : undefined}
|
||||
rowClassName={row => {
|
||||
if (selectedSignatures.some(x => x.eve_id === row.eve_id)) {
|
||||
return clsx(classes.TableRowCompact, 'bg-amber-500/50 hover:bg-amber-500/70 transition duration-200');
|
||||
@@ -198,7 +226,7 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
bodyClassName="p-0 px-1"
|
||||
field="group"
|
||||
body={renderIcon}
|
||||
style={{ maxWidth: 26, minWidth: 26, width: 26 }}
|
||||
style={{ maxWidth: 26, minWidth: 26, width: 26, height: 25 }}
|
||||
></Column>
|
||||
|
||||
<Column
|
||||
@@ -206,12 +234,14 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
header="Id"
|
||||
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
|
||||
style={{ maxWidth: 72, minWidth: 72, width: 72 }}
|
||||
sortable
|
||||
></Column>
|
||||
<Column
|
||||
field="group"
|
||||
header="Group"
|
||||
bodyClassName="text-ellipsis overflow-hidden whitespace-nowrap"
|
||||
hidden={compact}
|
||||
sortable
|
||||
></Column>
|
||||
<Column
|
||||
field="name"
|
||||
@@ -220,6 +250,7 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
body={renderName}
|
||||
style={{ maxWidth: nameColumnWidth }}
|
||||
hidden={compact || medium}
|
||||
sortable
|
||||
></Column>
|
||||
<Column
|
||||
field="updated_at"
|
||||
@@ -227,7 +258,16 @@ export const SystemSignaturesContent = ({ systemId, settings }: SystemSignatures
|
||||
dataType="date"
|
||||
bodyClassName="w-[80px] text-ellipsis overflow-hidden whitespace-nowrap"
|
||||
body={renderTimeLeft}
|
||||
sortable
|
||||
></Column>
|
||||
|
||||
{/*<Column*/}
|
||||
{/* bodyClassName="p-0 pl-1 pr-2"*/}
|
||||
{/* field="group"*/}
|
||||
{/* body={renderToolbar}*/}
|
||||
{/* headerClassName={headerClasses}*/}
|
||||
{/* style={{ maxWidth: 26, minWidth: 26, width: 26 }}*/}
|
||||
{/*></Column>*/}
|
||||
</DataTable>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { TimeLeft } from '@/hooks/Mapper/components/ui-kit';
|
||||
|
||||
export const renderTimeLeft = (row: SystemSignature) => {
|
||||
return (
|
||||
<div className="flex justify-end w-full items-center">
|
||||
<div className="flex w-full items-center">
|
||||
<TimeLeft cDate={row.updated_at ? new Date(row.updated_at) : undefined} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -13,6 +13,8 @@ interface RightBarProps {
|
||||
export const RightBar = ({ onShowOnTheMap }: RightBarProps) => {
|
||||
const { outCommand, interfaceSettings, setInterfaceSettings } = useMapRootState();
|
||||
|
||||
const isShowMinimap = interfaceSettings.isShowMinimap === undefined ? true : interfaceSettings.isShowMinimap;
|
||||
|
||||
const handleAddCharacter = useCallback(() => {
|
||||
outCommand({
|
||||
type: OutCommand.addCharacter,
|
||||
@@ -27,6 +29,13 @@ export const RightBar = ({ onShowOnTheMap }: RightBarProps) => {
|
||||
}));
|
||||
}, [setInterfaceSettings]);
|
||||
|
||||
const toggleKSpace = useCallback(() => {
|
||||
setInterfaceSettings(x => ({
|
||||
...x,
|
||||
isShowKSpace: !x.isShowKSpace,
|
||||
}));
|
||||
}, [setInterfaceSettings]);
|
||||
|
||||
const toggleMenu = useCallback(() => {
|
||||
setInterfaceSettings(x => ({
|
||||
...x,
|
||||
@@ -67,19 +76,31 @@ export const RightBar = ({ onShowOnTheMap }: RightBarProps) => {
|
||||
|
||||
<div className="flex flex-col items-center mb-2 gap-1">
|
||||
<WdTooltipWrapper
|
||||
content={interfaceSettings.isShowMinimap ? 'Hide minimap' : 'Show minimap'}
|
||||
content={
|
||||
interfaceSettings.isShowKSpace ? 'Hide highlighting Imperial Space' : 'Show highlighting Imperial Space'
|
||||
}
|
||||
position={TooltipPosition.left}
|
||||
>
|
||||
<button
|
||||
className="btn bg-transparent text-gray-400 hover:text-white border-transparent hover:bg-transparent py-2 h-auto min-h-auto"
|
||||
type="button"
|
||||
onClick={toggleKSpace}
|
||||
>
|
||||
{interfaceSettings.isShowKSpace ? (
|
||||
<i className="pi pi-star-fill text-lg"></i>
|
||||
) : (
|
||||
<i className="pi pi-star text-lg"></i>
|
||||
)}
|
||||
</button>
|
||||
</WdTooltipWrapper>
|
||||
|
||||
<WdTooltipWrapper content={isShowMinimap ? 'Hide minimap' : 'Show minimap'} position={TooltipPosition.left}>
|
||||
<button
|
||||
className="btn bg-transparent text-gray-400 hover:text-white border-transparent hover:bg-transparent py-2 h-auto min-h-auto"
|
||||
type="button"
|
||||
onClick={toggleMinimap}
|
||||
>
|
||||
{interfaceSettings.isShowMinimap ? (
|
||||
<i className="pi pi-eye text-lg"></i>
|
||||
) : (
|
||||
<i className="pi pi-eye-slash text-lg"></i>
|
||||
)}
|
||||
{isShowMinimap ? <i className="pi pi-eye text-lg"></i> : <i className="pi pi-eye-slash text-lg"></i>}
|
||||
</button>
|
||||
</WdTooltipWrapper>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export const MapWrapper = ({ refn }: MapWrapperProps) => {
|
||||
update,
|
||||
outCommand,
|
||||
data: { selectedConnections, selectedSystems, hubs, systems },
|
||||
interfaceSettings: { isShowMenu, isShowMinimap = STORED_INTERFACE_DEFAULT_VALUES.isShowMinimap },
|
||||
interfaceSettings: { isShowMenu, isShowMinimap = STORED_INTERFACE_DEFAULT_VALUES.isShowMinimap, isShowKSpace },
|
||||
} = useMapRootState();
|
||||
|
||||
const { open, ...systemContextProps } = useContextMenuSystemHandlers({ systems, hubs, outCommand });
|
||||
@@ -99,6 +99,7 @@ export const MapWrapper = ({ refn }: MapWrapperProps) => {
|
||||
onSelectionContextMenu={handleSystemMultipleContext}
|
||||
minimapClasses={!isShowMenu ? classes.MiniMap : undefined}
|
||||
isShowMinimap={isShowMinimap}
|
||||
showKSpaceBG={isShowKSpace}
|
||||
/>
|
||||
|
||||
{openSettings != null && (
|
||||
|
||||
@@ -5,3 +5,62 @@ export enum SESSION_KEY {
|
||||
}
|
||||
|
||||
export const GRADIENT_MENU_ACTIVE_CLASSES = 'bg-gradient-to-br from-transparent/10 to-fuchsia-300/10';
|
||||
|
||||
export enum Regions {
|
||||
Derelik = 10000001,
|
||||
TheForge = 10000002,
|
||||
Lonetrek = 10000016,
|
||||
SinqLaison = 10000032,
|
||||
Aridia = 10000054,
|
||||
BlackRise = 10000069,
|
||||
TheBleakLands = 10000038,
|
||||
TheCitadel = 10000033,
|
||||
Devoid = 10000036,
|
||||
Domain = 10000043,
|
||||
Essence = 10000064,
|
||||
Everyshore = 10000037,
|
||||
Genesis = 10000067,
|
||||
Heimatar = 10000030,
|
||||
Kador = 10000052,
|
||||
Khanid = 10000049,
|
||||
KorAzor = 10000065,
|
||||
Metropolis = 10000042,
|
||||
MoldenHeath = 10000028,
|
||||
Placid = 10000048,
|
||||
Solitude = 10000044,
|
||||
TashMurkon = 10000020,
|
||||
VergeVendor = 10000068,
|
||||
}
|
||||
|
||||
export enum Spaces {
|
||||
'Caldari' = 'Caldari',
|
||||
'Gallente' = 'Gallente',
|
||||
'Matar' = 'Matar',
|
||||
'Amarr' = 'Amarr',
|
||||
}
|
||||
|
||||
export const REGIONS_MAP: Record<number, Spaces> = {
|
||||
[Regions.Derelik]: Spaces.Amarr,
|
||||
[Regions.TheForge]: Spaces.Caldari,
|
||||
[Regions.Lonetrek]: Spaces.Caldari,
|
||||
[Regions.SinqLaison]: Spaces.Gallente,
|
||||
[Regions.Aridia]: Spaces.Amarr,
|
||||
[Regions.BlackRise]: Spaces.Caldari,
|
||||
[Regions.TheBleakLands]: Spaces.Amarr,
|
||||
[Regions.TheCitadel]: Spaces.Caldari,
|
||||
[Regions.Devoid]: Spaces.Amarr,
|
||||
[Regions.Domain]: Spaces.Amarr,
|
||||
[Regions.Essence]: Spaces.Gallente,
|
||||
[Regions.Everyshore]: Spaces.Gallente,
|
||||
[Regions.Genesis]: Spaces.Amarr,
|
||||
[Regions.Heimatar]: Spaces.Matar,
|
||||
[Regions.Kador]: Spaces.Amarr,
|
||||
[Regions.Khanid]: Spaces.Amarr,
|
||||
[Regions.KorAzor]: Spaces.Amarr,
|
||||
[Regions.Metropolis]: Spaces.Matar,
|
||||
[Regions.MoldenHeath]: Spaces.Matar,
|
||||
[Regions.Placid]: Spaces.Gallente,
|
||||
[Regions.Solitude]: Spaces.Gallente,
|
||||
[Regions.TashMurkon]: Spaces.Amarr,
|
||||
[Regions.VergeVendor]: Spaces.Gallente,
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ export default {
|
||||
onError: handleError,
|
||||
});
|
||||
|
||||
this.pushEvent('loaded');
|
||||
this.pushEvent('ui_loaded');
|
||||
},
|
||||
|
||||
handleEventWrapper(event: string, handler: (payload: any) => void) {
|
||||
|
||||
@@ -30,11 +30,13 @@ const INITIAL_DATA: MapRootData = {
|
||||
type InterfaceStoredSettings = {
|
||||
isShowMenu: boolean;
|
||||
isShowMinimap: boolean;
|
||||
isShowKSpace: boolean;
|
||||
};
|
||||
|
||||
export const STORED_INTERFACE_DEFAULT_VALUES: InterfaceStoredSettings = {
|
||||
isShowMenu: false,
|
||||
isShowMinimap: true,
|
||||
isShowKSpace: false,
|
||||
};
|
||||
|
||||
export interface MapRootContextProps {
|
||||
@@ -50,6 +52,7 @@ const MapRootContext = createContext<MapRootContextProps>({
|
||||
update: () => {},
|
||||
data: { ...INITIAL_DATA },
|
||||
mapRef: { current: null },
|
||||
// @ts-ignore
|
||||
outCommand: async () => void 0,
|
||||
interfaceSettings: STORED_INTERFACE_DEFAULT_VALUES,
|
||||
setInterfaceSettings: () => null,
|
||||
|
||||
BIN
assets/static/icons/brackets/battleship_32.png
Normal file
|
After Width: | Height: | Size: 403 B |
BIN
assets/static/icons/brackets/carrier_32.png
Normal file
|
After Width: | Height: | Size: 340 B |
BIN
assets/static/icons/brackets/freighter_32.png
Normal file
|
After Width: | Height: | Size: 509 B |
BIN
assets/static/icons/brackets/npcsuperCarrier_32.png
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
assets/static/images/amarr.png
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
assets/static/images/caldaria.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
assets/static/images/gallente.png
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
assets/static/images/mataria.png
Normal file
|
After Width: | Height: | Size: 224 KiB |
@@ -60,15 +60,7 @@ config :dart_sass, :version, "1.54.5"
|
||||
|
||||
config :tailwind, :version, "3.2.7"
|
||||
|
||||
config :wanderer_app, WandererApp.PromEx,
|
||||
manual_metrics_start_delay: :no_delay,
|
||||
metrics_server: [
|
||||
port: 4021,
|
||||
path: "/metrics",
|
||||
protocol: :http,
|
||||
pool_size: 5,
|
||||
cowboy_opts: [ip: {0, 0, 0, 0}]
|
||||
]
|
||||
config :wanderer_app, WandererApp.PromEx, manual_metrics_start_delay: :no_delay
|
||||
|
||||
config :wanderer_app,
|
||||
grafana_datasource_id: "wanderer"
|
||||
|
||||
@@ -192,9 +192,20 @@ if config_env() == :prod do
|
||||
|> get_var_from_path_or_env("DATABASE_SSL_ENABLED", "false")
|
||||
|> String.to_existing_atom()
|
||||
|
||||
db_ssl_verify_none =
|
||||
config_dir
|
||||
|> get_var_from_path_or_env("DATABASE_SSL_VERIFY_NONE", "false")
|
||||
|> String.to_existing_atom()
|
||||
|
||||
client_opts =
|
||||
if db_ssl_verify_none do
|
||||
[verify: :verify_none]
|
||||
end
|
||||
|
||||
config :wanderer_app, WandererApp.Repo,
|
||||
url: database_url,
|
||||
ssl: db_ssl_enabled,
|
||||
ssl_opts: client_opts,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
|
||||
socket_options: maybe_ipv6
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ defmodule WandererApp.Api.AccessList do
|
||||
primary?(true)
|
||||
|
||||
argument :owner_id, :uuid, allow_nil?: false
|
||||
argument :owner_id_text_input, :string, allow_nil?: true
|
||||
|
||||
change manage_relationship(:owner_id, :owner, on_lookup: :relate, on_no_match: nil)
|
||||
end
|
||||
@@ -51,8 +50,6 @@ defmodule WandererApp.Api.AccessList do
|
||||
update :update do
|
||||
accept [:name, :description, :owner_id]
|
||||
primary?(true)
|
||||
|
||||
argument :owner_id_text_input, :string, allow_nil?: true
|
||||
end
|
||||
|
||||
update :assign_owner do
|
||||
|
||||
@@ -18,6 +18,7 @@ defmodule WandererApp.Api.Map do
|
||||
define(:update, action: :update)
|
||||
define(:update_acls, action: :update_acls)
|
||||
define(:update_hubs, action: :update_hubs)
|
||||
define(:update_options, action: :update_options)
|
||||
define(:assign_owner, action: :assign_owner)
|
||||
define(:mark_as_deleted, action: :mark_as_deleted)
|
||||
|
||||
@@ -63,7 +64,6 @@ defmodule WandererApp.Api.Map do
|
||||
primary?(true)
|
||||
|
||||
argument :owner_id, :uuid, allow_nil?: false
|
||||
argument :owner_id_text_input, :string, allow_nil?: true
|
||||
argument :create_default_acl, :boolean, allow_nil?: true
|
||||
argument :acls, {:array, :uuid}, allow_nil?: true
|
||||
argument :acls_text_input, :string, allow_nil?: true
|
||||
@@ -113,6 +113,10 @@ defmodule WandererApp.Api.Map do
|
||||
accept [:hubs]
|
||||
end
|
||||
|
||||
update :update_options do
|
||||
accept [:options]
|
||||
end
|
||||
|
||||
update :mark_as_deleted do
|
||||
accept([])
|
||||
|
||||
@@ -168,6 +172,10 @@ defmodule WandererApp.Api.Map do
|
||||
allow_nil?(true)
|
||||
end
|
||||
|
||||
attribute :options, :string do
|
||||
allow_nil? true
|
||||
end
|
||||
|
||||
create_timestamp(:inserted_at)
|
||||
update_timestamp(:updated_at)
|
||||
end
|
||||
|
||||
@@ -18,10 +18,7 @@ defmodule WandererApp.Api.MapConnection do
|
||||
action: :read
|
||||
)
|
||||
|
||||
define(:by_locations,
|
||||
get_by: [:map_id, :solar_system_source, :solar_system_target],
|
||||
action: :read
|
||||
)
|
||||
define(:by_locations, action: :read_by_locations)
|
||||
|
||||
define(:read_by_map, action: :read_by_map)
|
||||
define(:get_link_pairs_advanced, action: :get_link_pairs_advanced)
|
||||
@@ -47,6 +44,13 @@ defmodule WandererApp.Api.MapConnection do
|
||||
filter(expr(map_id == ^arg(:map_id)))
|
||||
end
|
||||
|
||||
read :read_by_locations do
|
||||
argument(:map_id, :string, allow_nil?: false)
|
||||
argument(:solar_system_source, :integer, allow_nil?: false)
|
||||
argument(:solar_system_target, :integer, allow_nil?: false)
|
||||
filter(expr(map_id == ^arg(:map_id) and solar_system_source == ^arg(:solar_system_source) and solar_system_target == ^arg(:solar_system_target)))
|
||||
end
|
||||
|
||||
read :get_link_pairs_advanced do
|
||||
argument(:map_id, :string, allow_nil?: false)
|
||||
argument(:include_mass_crit, :boolean, allow_nil?: false)
|
||||
|
||||
@@ -68,13 +68,16 @@ defmodule WandererApp.Character.TrackerManager.Impl do
|
||||
state
|
||||
|
||||
false ->
|
||||
WandererApp.Character.update_character_state(character_id, %{opts: opts})
|
||||
:telemetry.execute([:wanderer_app, :character, :tracker, :started], %{count: 1})
|
||||
|
||||
Logger.debug(fn -> "Start character tracker: #{inspect(character_id)}" end)
|
||||
|
||||
tracked_characters = [character_id | state.characters] |> Enum.uniq()
|
||||
Task.start_link(fn ->
|
||||
WandererApp.Character.update_character_state(character_id, %{opts: opts})
|
||||
:telemetry.execute([:wanderer_app, :character, :tracker, :started], %{count: 1})
|
||||
|
||||
:ok
|
||||
end)
|
||||
|
||||
tracked_characters = [character_id | state.characters] |> Enum.uniq()
|
||||
WandererApp.Cache.insert("tracked_characters", tracked_characters)
|
||||
|
||||
%{state | characters: tracked_characters}
|
||||
|
||||
@@ -229,7 +229,7 @@ defmodule WandererApp.EveDataService do
|
||||
constellation_id = row["constellationID"] |> Integer.parse() |> elem(0)
|
||||
|
||||
{:ok, wormhole_class_id} =
|
||||
_get_wormhole_class_id(
|
||||
get_wormhole_class_id(
|
||||
map_location_wormhole_classes,
|
||||
region_id,
|
||||
constellation_id,
|
||||
@@ -237,16 +237,16 @@ defmodule WandererApp.EveDataService do
|
||||
)
|
||||
|
||||
{:ok, constellation_name} =
|
||||
_get_constellation_name(map_constellations, constellation_id)
|
||||
get_constellation_name(map_constellations, constellation_id)
|
||||
|
||||
{:ok, region_name} = _get_region_name(map_regions, region_id)
|
||||
{:ok, region_name} = get_region_name(map_regions, region_id)
|
||||
|
||||
{:ok, wormhole_class} = _get_wormhole_class(wormhole_classes, wormhole_class_id)
|
||||
{:ok, wormhole_class} = get_wormhole_class(wormhole_classes, wormhole_class_id)
|
||||
|
||||
{:ok, security} = _get_security(row["security"])
|
||||
{:ok, security} = get_security(row["security"])
|
||||
|
||||
{:ok, class_title} =
|
||||
_get_class_title(
|
||||
get_class_title(
|
||||
wormhole_classes_info,
|
||||
wormhole_class_id,
|
||||
security,
|
||||
@@ -270,7 +270,7 @@ defmodule WandererApp.EveDataService do
|
||||
solar_system_id: solar_system_id,
|
||||
solar_system_name: row["solarSystemName"],
|
||||
solar_system_name_lc: row["solarSystemName"] |> String.downcase(),
|
||||
sun_type_id: _get_sun_type_id(row["sunTypeID"]),
|
||||
sun_type_id: get_sun_type_id(row["sunTypeID"]),
|
||||
constellation_name: constellation_name,
|
||||
region_name: region_name,
|
||||
security: security,
|
||||
@@ -279,8 +279,8 @@ defmodule WandererApp.EveDataService do
|
||||
type_description: wormhole_class.title,
|
||||
is_shattered: is_shattered
|
||||
}
|
||||
|> _get_wormhole_data(wormhole_systems, solar_system_id, wormhole_class)
|
||||
|> _get_triglavian_data(triglavian_systems, solar_system_id)
|
||||
|> get_wormhole_data(wormhole_systems, solar_system_id, wormhole_class)
|
||||
|> get_triglavian_data(triglavian_systems, solar_system_id)
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -332,14 +332,14 @@ defmodule WandererApp.EveDataService do
|
||||
)
|
||||
end
|
||||
|
||||
defp _get_sun_type_id(sun_type_id) do
|
||||
defp get_sun_type_id(sun_type_id) do
|
||||
case sun_type_id do
|
||||
"None" -> 0
|
||||
_ -> sun_type_id |> Integer.parse() |> elem(0)
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_wormhole_data(default_data, wormhole_systems, solar_system_id, wormhole_class) do
|
||||
defp get_wormhole_data(default_data, wormhole_systems, solar_system_id, wormhole_class) do
|
||||
case Enum.find(wormhole_systems, fn system -> system.solar_system_id == solar_system_id end) do
|
||||
nil ->
|
||||
default_data
|
||||
@@ -355,7 +355,7 @@ defmodule WandererApp.EveDataService do
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_triglavian_data(default_data, triglavian_systems, solar_system_id) do
|
||||
defp get_triglavian_data(default_data, triglavian_systems, solar_system_id) do
|
||||
case Enum.find(triglavian_systems, fn system -> system.solar_system_id == solar_system_id end) do
|
||||
nil ->
|
||||
default_data
|
||||
@@ -370,14 +370,18 @@ defmodule WandererApp.EveDataService do
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_security(security) do
|
||||
defp get_security(security) do
|
||||
case security do
|
||||
nil -> {:ok, ""}
|
||||
_ -> {:ok, Decimal.parse(security) |> elem(0) |> Decimal.round(1) |> Decimal.to_string()}
|
||||
_ -> {:ok, String.to_float(security) |> get_true_security() |> Float.to_string(decimals: 1)}
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_class_title(wormhole_classes_info, wormhole_class_id, security, wormhole_class) do
|
||||
defp get_true_security(security) when is_float(security) and security > 0.0 and security < 0.05, do: security |> Float.ceil(1)
|
||||
|
||||
defp get_true_security(security) when is_float(security), do: security |> Float.floor(1)
|
||||
|
||||
defp get_class_title(wormhole_classes_info, wormhole_class_id, security, wormhole_class) do
|
||||
case wormhole_class_id in [
|
||||
wormhole_classes_info.names["hs"],
|
||||
wormhole_classes_info.names["ls"],
|
||||
@@ -391,7 +395,7 @@ defmodule WandererApp.EveDataService do
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_constellation_name(constellations, constellation_id) do
|
||||
defp get_constellation_name(constellations, constellation_id) do
|
||||
case Enum.find(constellations, fn constellation ->
|
||||
constellation.constellation_id == constellation_id
|
||||
end) do
|
||||
@@ -400,24 +404,24 @@ defmodule WandererApp.EveDataService do
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_region_name(regions, region_id) do
|
||||
defp get_region_name(regions, region_id) do
|
||||
case Enum.find(regions, fn region -> region.region_id == region_id end) do
|
||||
nil -> {:ok, ""}
|
||||
region -> {:ok, region.region_name}
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_wormhole_class(wormhole_classes, wormhole_class_id) do
|
||||
defp get_wormhole_class(wormhole_classes, wormhole_class_id) do
|
||||
{:ok,
|
||||
Enum.find(wormhole_classes, fn wormhole_class ->
|
||||
wormhole_class.wormhole_class_id == wormhole_class_id
|
||||
end)}
|
||||
end
|
||||
|
||||
defp _get_wormhole_class_id(_systems, _region_id, _constellation_id, 30_100_000),
|
||||
defp get_wormhole_class_id(_systems, _region_id, _constellation_id, 30_100_000),
|
||||
do: {:ok, 10_100}
|
||||
|
||||
defp _get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do
|
||||
defp get_wormhole_class_id(systems, region_id, constellation_id, solar_system_id) do
|
||||
with region <-
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == region_id
|
||||
@@ -430,23 +434,23 @@ defmodule WandererApp.EveDataService do
|
||||
Enum.find(systems, fn system ->
|
||||
system.location_id |> Integer.parse() |> elem(0) == solar_system_id
|
||||
end),
|
||||
wormhole_class_id <- _get_wormhole_class_id(region, constellation, solar_system) do
|
||||
wormhole_class_id <- get_wormhole_class_id(region, constellation, solar_system) do
|
||||
{:ok, wormhole_class_id}
|
||||
else
|
||||
_ -> {:ok, -1}
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_wormhole_class_id(_region, _constellation, solar_system)
|
||||
defp get_wormhole_class_id(_region, _constellation, solar_system)
|
||||
when not is_nil(solar_system),
|
||||
do: solar_system.wormhole_class_id |> Integer.parse() |> elem(0)
|
||||
|
||||
defp _get_wormhole_class_id(_region, constellation, _solar_system)
|
||||
defp get_wormhole_class_id(_region, constellation, _solar_system)
|
||||
when not is_nil(constellation),
|
||||
do: constellation.wormhole_class_id |> Integer.parse() |> elem(0)
|
||||
|
||||
defp _get_wormhole_class_id(region, _constellation, _solar_system) when not is_nil(region),
|
||||
defp get_wormhole_class_id(region, _constellation, _solar_system) when not is_nil(region),
|
||||
do: region.wormhole_class_id |> Integer.parse() |> elem(0)
|
||||
|
||||
defp _get_wormhole_class_id(_region, _constellation, _solar_system), do: -1
|
||||
defp get_wormhole_class_id(_region, _constellation, _solar_system), do: -1
|
||||
end
|
||||
|
||||
@@ -52,6 +52,15 @@ defmodule WandererApp.Map do
|
||||
end
|
||||
end
|
||||
|
||||
def get_map_options!(map) do
|
||||
map
|
||||
|> Map.get(:options)
|
||||
|> case do
|
||||
nil -> %{"layout" => "left_to_right"}
|
||||
options -> Jason.decode!(options)
|
||||
end
|
||||
end
|
||||
|
||||
def update_map(map_id, map_update) do
|
||||
Cachex.get_and_update(:map_cache, map_id, fn map ->
|
||||
case map do
|
||||
|
||||
@@ -10,8 +10,8 @@ defmodule WandererApp.Map.Manager do
|
||||
alias WandererApp.Map.Server
|
||||
alias WandererApp.Map.ServerSupervisor
|
||||
|
||||
@maps_start_per_second 100
|
||||
@maps_start_interval 1500
|
||||
@maps_start_per_second 5
|
||||
@maps_start_interval 1000
|
||||
@maps_queue :maps_queue
|
||||
@garbage_collection_interval :timer.hours(1)
|
||||
@check_maps_queue_interval :timer.seconds(1)
|
||||
|
||||
@@ -19,46 +19,47 @@ defmodule WandererApp.Map.PositionCalculator do
|
||||
|
||||
def get_system_bounding_rect(_system), do: [{0, 0}, {0, 0}]
|
||||
|
||||
def get_new_system_position(nil, rtree_name) do
|
||||
{:ok, {x, y}} = rtree_name |> _check_system_available_positions(@start_x, @start_y, 1)
|
||||
def get_new_system_position(nil, rtree_name, opts) do
|
||||
{:ok, {x, y}} = rtree_name |> check_system_available_positions(@start_x, @start_y, 1, opts)
|
||||
%{x: x, y: y}
|
||||
end
|
||||
|
||||
def get_new_system_position(
|
||||
%{position_x: start_x, position_y: start_y} = _old_system,
|
||||
rtree_name
|
||||
rtree_name,
|
||||
opts
|
||||
) do
|
||||
{:ok, {x, y}} = rtree_name |> _check_system_available_positions(start_x, start_y, 1)
|
||||
{:ok, {x, y}} = rtree_name |> check_system_available_positions(start_x, start_y, 1, opts)
|
||||
|
||||
%{x: x, y: y}
|
||||
end
|
||||
|
||||
defp _check_system_available_positions(_rtree_name, _start_x, _start_y, 100) do
|
||||
{:ok, {@start_x, @start_y}}
|
||||
end
|
||||
defp check_system_available_positions(_rtree_name, _start_x, _start_y, 100, _opts),
|
||||
do: {:ok, {@start_x, @start_y}}
|
||||
|
||||
defp _check_system_available_positions(rtree_name, start_x, start_y, level) do
|
||||
possible_positions = _get_available_positions(level, start_x, start_y)
|
||||
defp check_system_available_positions(rtree_name, start_x, start_y, level, opts) do
|
||||
possible_positions = get_available_positions(level, start_x, start_y, opts)
|
||||
|
||||
case _get_available_position(possible_positions, rtree_name) do
|
||||
case get_available_position(possible_positions, rtree_name) do
|
||||
{:ok, nil} ->
|
||||
rtree_name |> _check_system_available_positions(start_x, start_y, level + 1)
|
||||
rtree_name |> check_system_available_positions(start_x, start_y, level + 1, opts)
|
||||
|
||||
{:ok, position} ->
|
||||
{:ok, position}
|
||||
end
|
||||
end
|
||||
|
||||
defp _get_available_position([], _rtree_name), do: {:ok, nil}
|
||||
defp get_available_position([], _rtree_name), do: {:ok, nil}
|
||||
|
||||
defp _get_available_position([position | rest], rtree_name) do
|
||||
if _is_available_position(position, rtree_name) do
|
||||
defp get_available_position([position | rest], rtree_name) do
|
||||
if is_available_position(position, rtree_name) do
|
||||
{:ok, position}
|
||||
else
|
||||
_get_available_position(rest, rtree_name)
|
||||
get_available_position(rest, rtree_name)
|
||||
end
|
||||
end
|
||||
|
||||
defp _is_available_position({x, y} = _position, rtree_name) do
|
||||
defp is_available_position({x, y} = _position, rtree_name) do
|
||||
case DDRT.query(get_system_bounding_rect(%{position_x: x, position_y: y}), rtree_name) do
|
||||
{:ok, []} ->
|
||||
true
|
||||
@@ -71,9 +72,10 @@ defmodule WandererApp.Map.PositionCalculator do
|
||||
end
|
||||
end
|
||||
|
||||
def _get_available_positions(level, x, y), do: _adjusted_coordinates(1 + level * 2, x, y)
|
||||
def get_available_positions(level, x, y, opts),
|
||||
do: adjusted_coordinates(1 + level * 2, x, y, opts)
|
||||
|
||||
defp _edge_coordinates(n) when n > 1 do
|
||||
defp edge_coordinates(n, opts) when n > 1 do
|
||||
min = -div(n, 2)
|
||||
max = div(n, 2)
|
||||
# Top edge
|
||||
@@ -90,16 +92,20 @@ defmodule WandererApp.Map.PositionCalculator do
|
||||
|> Enum.uniq()
|
||||
end
|
||||
|
||||
defp _sorted_edge_coordinates(n) when n > 1 do
|
||||
coordinates = _edge_coordinates(n)
|
||||
middle_right_index = div(n, 2)
|
||||
defp sorted_edge_coordinates(n, opts) when n > 1 do
|
||||
coordinates = edge_coordinates(n, opts)
|
||||
start_index = get_start_index(n, opts[:layout])
|
||||
|
||||
Enum.slice(coordinates, middle_right_index, length(coordinates) - middle_right_index) ++
|
||||
Enum.slice(coordinates, 0, middle_right_index)
|
||||
Enum.slice(coordinates, start_index, length(coordinates) - start_index) ++
|
||||
Enum.slice(coordinates, 0, start_index)
|
||||
end
|
||||
|
||||
defp _adjusted_coordinates(n, start_x, start_y) when n > 1 do
|
||||
sorted_coords = _sorted_edge_coordinates(n)
|
||||
defp get_start_index(n, "left_to_right"), do: div(n, 2)
|
||||
|
||||
defp get_start_index(n, "top_to_bottom"), do: div(n, 2) + n - 1
|
||||
|
||||
defp adjusted_coordinates(n, start_x, start_y, opts) when n > 1 do
|
||||
sorted_coords = sorted_edge_coordinates(n, opts)
|
||||
|
||||
Enum.map(sorted_coords, fn {x, y} ->
|
||||
{
|
||||
|
||||
@@ -75,11 +75,11 @@ defmodule WandererApp.Map.Server do
|
||||
|> map_pid!
|
||||
|> GenServer.call({&Impl.get_characters/1, []}, :timer.minutes(1))
|
||||
|
||||
def add_character(map_id, character) when is_binary(map_id),
|
||||
def add_character(map_id, character, track_character \\ false) when is_binary(map_id),
|
||||
do:
|
||||
map_id
|
||||
|> map_pid!
|
||||
|> GenServer.cast({&Impl.add_character/2, [character]})
|
||||
|> GenServer.cast({&Impl.add_character/3, [character, track_character]})
|
||||
|
||||
def remove_character(map_id, character_id) when is_binary(map_id),
|
||||
do:
|
||||
|
||||
@@ -11,7 +11,8 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
defstruct [
|
||||
:map_id,
|
||||
:rtree_name,
|
||||
map: nil
|
||||
map: nil,
|
||||
map_opts: []
|
||||
]
|
||||
|
||||
# @ccp1 -1
|
||||
@@ -176,38 +177,46 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
def get_characters(%{map_id: map_id} = _state),
|
||||
do: {:ok, map_id |> WandererApp.Map.list_characters()}
|
||||
|
||||
def add_character(%{map_id: map_id} = state, %{id: character_id} = character) do
|
||||
with :ok <- map_id |> WandererApp.Map.add_character(character),
|
||||
{:ok, _} <-
|
||||
WandererApp.MapCharacterSettingsRepo.create(%{
|
||||
character_id: character_id,
|
||||
map_id: map_id,
|
||||
tracked: false
|
||||
}),
|
||||
{:ok, character} <- WandererApp.Character.get_character(character_id) do
|
||||
broadcast!(map_id, :character_added, character)
|
||||
def add_character(%{map_id: map_id} = state, %{id: character_id} = character, track_character) do
|
||||
Task.start_link(fn ->
|
||||
with :ok <- map_id |> WandererApp.Map.add_character(character),
|
||||
{:ok, _} <-
|
||||
WandererApp.MapCharacterSettingsRepo.create(%{
|
||||
character_id: character_id,
|
||||
map_id: map_id,
|
||||
tracked: track_character
|
||||
}),
|
||||
{:ok, character} <- WandererApp.Character.get_character(character_id) do
|
||||
broadcast!(map_id, :character_added, character)
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :character, :added], %{count: 1})
|
||||
:telemetry.execute([:wanderer_app, :map, :character, :added], %{count: 1})
|
||||
|
||||
state
|
||||
else
|
||||
{:error, _error} ->
|
||||
state
|
||||
end
|
||||
:ok
|
||||
else
|
||||
{:error, _error} ->
|
||||
:ok
|
||||
end
|
||||
end)
|
||||
|
||||
state
|
||||
end
|
||||
|
||||
def remove_character(%{map_id: map_id} = state, character_id) do
|
||||
with :ok <- WandererApp.Map.remove_character(map_id, character_id),
|
||||
{:ok, character} <- WandererApp.Character.get_character(character_id) do
|
||||
broadcast!(map_id, :character_removed, character)
|
||||
Task.start_link(fn ->
|
||||
with :ok <- WandererApp.Map.remove_character(map_id, character_id),
|
||||
{:ok, character} <- WandererApp.Character.get_character(character_id) do
|
||||
broadcast!(map_id, :character_removed, character)
|
||||
|
||||
:telemetry.execute([:wanderer_app, :map, :character, :removed], %{count: 1})
|
||||
:telemetry.execute([:wanderer_app, :map, :character, :removed], %{count: 1})
|
||||
|
||||
state
|
||||
else
|
||||
{:error, _error} ->
|
||||
state
|
||||
end
|
||||
:ok
|
||||
else
|
||||
{:error, _error} ->
|
||||
:ok
|
||||
end
|
||||
end)
|
||||
|
||||
state
|
||||
end
|
||||
|
||||
def untrack_characters(%{map_id: map_id} = state, characters_ids) do
|
||||
@@ -357,17 +366,7 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
connections_to_remove
|
||||
|> Enum.each(fn connection ->
|
||||
@logger.debug(fn -> "Removing connection from map: #{inspect(connection)}" end)
|
||||
|
||||
connection
|
||||
|> WandererApp.MapConnectionRepo.destroy!()
|
||||
|> case do
|
||||
:ok ->
|
||||
:ok
|
||||
|
||||
{:error, error} ->
|
||||
@logger.error("Failed to remove connection from map: #{inspect(error, pretty: true)}")
|
||||
:ok
|
||||
end
|
||||
WandererApp.MapConnectionRepo.destroy(map_id, connection)
|
||||
end)
|
||||
|
||||
@ddrt.delete(removed_ids, rtree_name)
|
||||
@@ -797,6 +796,9 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
}
|
||||
end
|
||||
|
||||
def handle_event({:options_updated, options}, %{map: map, map_id: map_id} = state),
|
||||
do: %{state | map_opts: [layout: options.layout]}
|
||||
|
||||
def handle_event({ref, _result}, %{map_id: _map_id} = state) do
|
||||
Process.demonitor(ref, [:flush])
|
||||
|
||||
@@ -836,12 +838,12 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
character_id,
|
||||
location,
|
||||
old_location,
|
||||
%{map: map, map_id: map_id, rtree_name: rtree_name} = _state
|
||||
%{map: map, map_id: map_id, rtree_name: rtree_name, map_opts: map_opts} = _state
|
||||
) do
|
||||
case is_nil(old_location.solar_system_id) and
|
||||
_can_add_location(map.scope, location.solar_system_id) do
|
||||
true ->
|
||||
:ok = maybe_add_system(map_id, location, nil, rtree_name)
|
||||
:ok = maybe_add_system(map_id, location, nil, rtree_name, map_opts)
|
||||
|
||||
_ ->
|
||||
case _is_connection_valid(
|
||||
@@ -851,8 +853,8 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
) do
|
||||
true ->
|
||||
{:ok, character} = WandererApp.Character.get_character(character_id)
|
||||
:ok = maybe_add_system(map_id, location, old_location, rtree_name)
|
||||
:ok = maybe_add_system(map_id, old_location, location, rtree_name)
|
||||
:ok = maybe_add_system(map_id, location, old_location, rtree_name, map_opts)
|
||||
:ok = maybe_add_system(map_id, old_location, location, rtree_name, map_opts)
|
||||
:ok = maybe_add_connection(map_id, location, old_location, character)
|
||||
|
||||
_ ->
|
||||
@@ -1099,7 +1101,7 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
end)}
|
||||
|
||||
defp _add_system(
|
||||
%{map_id: map_id, rtree_name: rtree_name} = state,
|
||||
%{map_id: map_id, map_opts: map_opts, rtree_name: rtree_name} = state,
|
||||
%{
|
||||
solar_system_id: solar_system_id,
|
||||
coordinates: coordinates
|
||||
@@ -1115,7 +1117,7 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
|
||||
_ ->
|
||||
%{x: x, y: y} =
|
||||
WandererApp.Map.PositionCalculator.get_new_system_position(nil, rtree_name)
|
||||
WandererApp.Map.PositionCalculator.get_new_system_position(nil, rtree_name, map_opts)
|
||||
|
||||
%{"x" => x, "y" => y}
|
||||
end
|
||||
@@ -1257,20 +1259,22 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
|
||||
defp _init_map(
|
||||
state,
|
||||
%{characters: characters} = map,
|
||||
%{characters: characters} = initial_map,
|
||||
subscription_settings,
|
||||
systems,
|
||||
connections
|
||||
) do
|
||||
map =
|
||||
map
|
||||
initial_map
|
||||
|> WandererApp.Map.new()
|
||||
|> WandererApp.Map.update_subscription_settings!(subscription_settings)
|
||||
|> WandererApp.Map.add_systems!(systems)
|
||||
|> WandererApp.Map.add_connections!(connections)
|
||||
|> WandererApp.Map.add_characters!(characters)
|
||||
|
||||
%{state | map: map}
|
||||
map_options = WandererApp.Map.get_map_options!(initial_map)
|
||||
|
||||
%{state | map: map, map_opts: [layout: map_options |> Map.get("layout")]}
|
||||
end
|
||||
|
||||
defp _init_map_systems(state, [] = _systems), do: state
|
||||
@@ -1567,8 +1571,7 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
old_location.solar_system_id
|
||||
) do
|
||||
{:ok, connection} ->
|
||||
connection
|
||||
|> WandererApp.MapConnectionRepo.destroy!()
|
||||
:ok = WandererApp.MapConnectionRepo.destroy(map_id, connection)
|
||||
|
||||
broadcast!(map_id, :remove_connections, [connection])
|
||||
map_id |> WandererApp.Map.remove_connection(connection)
|
||||
@@ -1617,11 +1620,11 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
|
||||
defp maybe_add_connection(_map_id, _location, _old_location, _character), do: :ok
|
||||
|
||||
defp maybe_add_system(map_id, location, old_location, rtree_name)
|
||||
defp maybe_add_system(map_id, location, old_location, rtree_name, opts)
|
||||
when not is_nil(location) do
|
||||
case WandererApp.Map.check_location(map_id, location) do
|
||||
{:ok, location} ->
|
||||
{:ok, position} = calc_new_system_position(map_id, old_location, rtree_name)
|
||||
{:ok, position} = calc_new_system_position(map_id, old_location, rtree_name, opts)
|
||||
|
||||
case WandererApp.MapSystemRepo.get_by_map_and_solar_system_id(
|
||||
map_id,
|
||||
@@ -1691,14 +1694,14 @@ defmodule WandererApp.Map.Server.Impl do
|
||||
end
|
||||
end
|
||||
|
||||
defp maybe_add_system(_map_id, _location, _old_location, _rtree_name), do: :ok
|
||||
defp maybe_add_system(_map_id, _location, _old_location, _rtree_name, _opts), do: :ok
|
||||
|
||||
defp calc_new_system_position(map_id, old_location, rtree_name) do
|
||||
defp calc_new_system_position(map_id, old_location, rtree_name, opts),
|
||||
do:
|
||||
{:ok,
|
||||
map_id
|
||||
|> WandererApp.Map.find_system_by_location(old_location)
|
||||
|> WandererApp.Map.PositionCalculator.get_new_system_position(rtree_name)}
|
||||
end
|
||||
|> WandererApp.Map.PositionCalculator.get_new_system_position(rtree_name, opts)}
|
||||
|
||||
defp _broadcast_acl_updates(
|
||||
{:ok,
|
||||
|
||||
@@ -60,8 +60,6 @@ defmodule WandererApp.Maps do
|
||||
end
|
||||
end
|
||||
|
||||
def load_characters(_map, [], _user_id), do: {:ok, %{characters: []}}
|
||||
|
||||
def load_characters(map, character_settings, user_id) do
|
||||
{:ok, user_characters} =
|
||||
WandererApp.Api.Character.active_by_user(%{user_id: user_id})
|
||||
|
||||
@@ -1,12 +1,60 @@
|
||||
defmodule WandererApp.MapConnectionRepo do
|
||||
use WandererApp, :repository
|
||||
|
||||
require Logger
|
||||
|
||||
@logger Application.compile_env(:wanderer_app, :logger)
|
||||
|
||||
def get_by_map(map_id),
|
||||
do: WandererApp.Api.MapConnection.read_by_map(%{map_id: map_id})
|
||||
|
||||
def get_by_locations(map_id, solar_system_source, solar_system_target) do
|
||||
WandererApp.Api.MapConnection.by_locations(%{map_id: map_id, solar_system_source: solar_system_source, solar_system_target: solar_system_target})
|
||||
|> case do
|
||||
{:ok, connections} ->
|
||||
{:ok, connections}
|
||||
|
||||
{:error, %Ash.Error.Query.NotFound{}} ->
|
||||
{:ok, []}
|
||||
|
||||
{:error, error} ->
|
||||
@logger.error("Failed to get connections: #{inspect(error, pretty: true)}")
|
||||
{:error, error}
|
||||
end
|
||||
end
|
||||
|
||||
def create!(connection), do: connection |> WandererApp.Api.MapConnection.create!()
|
||||
|
||||
def destroy!(connection), do: connection |> WandererApp.Api.MapConnection.destroy!()
|
||||
def destroy(map_id, connection) do
|
||||
{:ok, from_connections} = get_by_locations(map_id, connection.solar_system_source, connection.solar_system_target)
|
||||
{:ok, to_connections} = get_by_locations(map_id, connection.solar_system_target, connection.solar_system_source)
|
||||
|
||||
[from_connections ++ to_connections]
|
||||
|> List.flatten()
|
||||
|> bulk_destroy!()
|
||||
|> case do
|
||||
:ok ->
|
||||
:ok
|
||||
|
||||
error ->
|
||||
@logger.error("Failed to remove connections from map: #{inspect(error, pretty: true)}")
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
def destroy!(connection), do:
|
||||
connection |> WandererApp.Api.MapConnection.destroy!()
|
||||
|
||||
def bulk_destroy!(connections) do
|
||||
connections
|
||||
|> WandererApp.Api.MapConnection.destroy!()
|
||||
|> case do
|
||||
%Ash.BulkResult{status: :success} ->
|
||||
:ok
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
def update_time_status(connection, update),
|
||||
do:
|
||||
|
||||
@@ -602,11 +602,11 @@ defmodule WandererAppWeb.CoreComponents do
|
||||
<tr
|
||||
:for={row <- @rows}
|
||||
id={@row_id && @row_id.(row)}
|
||||
phx-click={@row_click && @row_click.(row)}
|
||||
class={"hover #{if @row_selected && @row_selected.(row), do: "!bg-slate-600", else: ""} #{if @row_click, do: "cursor-pointer", else: ""}"}
|
||||
>
|
||||
<td
|
||||
:for={{col, _index} <- Enum.with_index(@col)}
|
||||
phx-click={@row_click && @row_click.(row)}
|
||||
>
|
||||
<%= render_slot(col, @row_item.(row)) %>
|
||||
</td>
|
||||
|
||||
@@ -99,40 +99,34 @@ defmodule WandererAppWeb.AccessListsLive do
|
||||
end
|
||||
|
||||
defp apply_action(socket, :add_members, %{"id" => acl_id} = _params) do
|
||||
{:ok, %{owner: %{id: _character_id}} = access_list} =
|
||||
socket.assigns.access_lists |> Enum.find(&(&1.id == acl_id)) |> Ash.load(:owner)
|
||||
with {:ok, %{owner: %{id: _character_id}} = access_list} <- socket.assigns.access_lists |> Enum.find(&(&1.id == acl_id)) |> Ash.load(:owner),
|
||||
user_character_ids <- socket.assigns.current_user.characters |> Enum.map(& &1.id) do
|
||||
user_character_ids
|
||||
|> Enum.each(fn user_character_id ->
|
||||
:ok = WandererApp.Character.TrackerManager.start_tracking(user_character_id)
|
||||
end)
|
||||
|
||||
user_character_ids = socket.assigns.current_user.characters |> Enum.map(& &1.id)
|
||||
|
||||
user_character_ids
|
||||
|> Enum.each(fn user_character_id ->
|
||||
:ok = WandererApp.Character.TrackerManager.start_tracking(user_character_id)
|
||||
end)
|
||||
|
||||
socket
|
||||
|> assign(:active_page, :access_lists)
|
||||
|> assign(:page_title, "Access Lists - Add Members")
|
||||
|> assign(:selected_acl_id, acl_id)
|
||||
|> assign(:user_character_ids, user_character_ids)
|
||||
|> assign(
|
||||
member_search_options: socket.assigns.characters |> Enum.map(&map_user_character_info/1)
|
||||
)
|
||||
|> assign(:access_list, access_list)
|
||||
|> assign(
|
||||
:members,
|
||||
WandererApp.Api.AccessListMember.read_by_access_list!(%{access_list_id: acl_id})
|
||||
)
|
||||
|> assign(
|
||||
:member_form,
|
||||
%{} |> to_form()
|
||||
)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("set-default", %{"id" => id}, socket) do
|
||||
send_update(LiveSelect.Component, options: socket.assigns.characters, id: id)
|
||||
|
||||
{:noreply, socket}
|
||||
socket
|
||||
|> assign(:active_page, :access_lists)
|
||||
|> assign(:page_title, "Access Lists - Add Members")
|
||||
|> assign(:selected_acl_id, acl_id)
|
||||
|> assign(:user_character_ids, user_character_ids)
|
||||
|> assign(
|
||||
member_search_options: socket.assigns.characters |> Enum.map(&map_user_character_info/1)
|
||||
)
|
||||
|> assign(:access_list, access_list)
|
||||
|> assign(
|
||||
:members,
|
||||
WandererApp.Api.AccessListMember.read_by_access_list!(%{access_list_id: acl_id})
|
||||
)
|
||||
|> assign(
|
||||
:member_form,
|
||||
%{} |> to_form()
|
||||
)
|
||||
else
|
||||
_ ->
|
||||
socket
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
||||
@@ -127,23 +127,13 @@
|
||||
<.form :let={f} for={@form} phx-change="validate" phx-submit={@live_action}>
|
||||
<.input type="text" field={f[:name]} placeholder="Name" />
|
||||
<.input type="textarea" field={f[:description]} placeholder="Public description" />
|
||||
<.live_select
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:owner_id]}
|
||||
dropdown_extra_class="max-h-64"
|
||||
available_option_class="w-full"
|
||||
value_mapper={&map_character/1}
|
||||
update_min_len={0}
|
||||
phx-focus="set-default"
|
||||
options={@characters}
|
||||
placeholder="Owner"
|
||||
>
|
||||
<:option :let={option}>
|
||||
<div class="flex items-center">
|
||||
<.avatar url={member_icon_url(option.eve_id)} label={option.label} />
|
||||
<%= option.label %>
|
||||
</div>
|
||||
</:option>
|
||||
</.live_select>
|
||||
class="p-dropdown p-component p-inputwrapper mt-8"
|
||||
placeholder="Select a map owner"
|
||||
options={Enum.map(@characters, fn character -> {character.label, character.id} end)}
|
||||
/>
|
||||
<div class="modal-action">
|
||||
<.button class="mt-2" type="submit" phx-disable-with="Saving...">
|
||||
<%= (@live_action == :create && "Create") || "Save" %>
|
||||
|
||||
@@ -42,8 +42,10 @@ defmodule WandererAppWeb.CharactersTrackingLive do
|
||||
|
||||
{:ok, character_settings} =
|
||||
case WandererApp.Api.MapCharacterSettings.read_by_map(%{map_id: selected_map.id}) do
|
||||
{:ok, settings} -> {:ok, settings}
|
||||
_ -> {:ok, []}
|
||||
{:ok, settings} ->
|
||||
{:ok, settings}
|
||||
_ ->
|
||||
{:ok, []}
|
||||
end
|
||||
|
||||
user_id = socket.assigns.user_id
|
||||
|
||||
@@ -8,7 +8,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
socket =
|
||||
with %{"slug" => map_slug} <- params do
|
||||
socket
|
||||
|> _init_state(map_slug, false)
|
||||
|> _init_state(map_slug)
|
||||
else
|
||||
_ ->
|
||||
# redirect back to main
|
||||
@@ -29,7 +29,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
{:ok, socket |> assign(server_online: false)}
|
||||
end
|
||||
|
||||
defp _init_state(socket, map_slug, is_reconnect?) do
|
||||
defp _init_state(socket, map_slug) do
|
||||
current_user = socket.assigns.current_user
|
||||
|
||||
ErrorTracker.set_context(%{user_id: current_user.id})
|
||||
@@ -45,7 +45,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
deleted: false
|
||||
} = map} ->
|
||||
|
||||
Task.async(fn -> _load_initial_data(map, is_reconnect?, current_user) end)
|
||||
Process.send_after(self(), {:init_map, map}, 10)
|
||||
|
||||
socket
|
||||
|> assign(
|
||||
@@ -68,7 +68,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
{:ok,
|
||||
%{
|
||||
deleted: true
|
||||
} = map} ->
|
||||
} = _map} ->
|
||||
socket
|
||||
|> put_flash(
|
||||
:error,
|
||||
@@ -114,7 +114,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
}
|
||||
} = socket
|
||||
) do
|
||||
Task.async(fn -> _on_map_started(map_id, current_user, user_permissions) end)
|
||||
_on_map_started(map_id, current_user, user_permissions)
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
@@ -331,7 +331,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
|
||||
_ ->
|
||||
:ok = _track_characters(map_characters, map_id, true)
|
||||
:ok = _add_characters(map_characters, map_id)
|
||||
:ok = _add_characters(map_characters, map_id, track_character)
|
||||
end
|
||||
|
||||
socket
|
||||
@@ -345,15 +345,65 @@ defmodule WandererAppWeb.MapLive do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_info({:init_map, map}, %{assigns: %{current_user: current_user}} = socket) do
|
||||
with %{
|
||||
id: map_id,
|
||||
deleted: false,
|
||||
only_tracked_characters: only_tracked_characters,
|
||||
user_permissions: user_permissions,
|
||||
name: map_name,
|
||||
owner_id: owner_id
|
||||
} <- map do
|
||||
user_permissions =
|
||||
WandererApp.Permissions.get_map_permissions(
|
||||
user_permissions,
|
||||
owner_id,
|
||||
current_user.characters |> Enum.map(& &1.id)
|
||||
)
|
||||
|
||||
{:ok, character_settings} =
|
||||
case WandererApp.Api.MapCharacterSettings.read_by_map(%{map_id: map_id}) do
|
||||
{:ok, settings} -> {:ok, settings}
|
||||
_ -> {:ok, []}
|
||||
end
|
||||
|
||||
{:ok, %{characters: availaible_map_characters}} =
|
||||
WandererApp.Maps.load_characters(map, character_settings, current_user.id)
|
||||
|
||||
can_view? = user_permissions.view_system
|
||||
can_track? = user_permissions.track_character
|
||||
|
||||
tracked_character_ids =
|
||||
availaible_map_characters |> Enum.filter(& &1.tracked) |> Enum.map(& &1.id)
|
||||
|
||||
all_character_tracked? = (not (availaible_map_characters |> Enum.empty?())) and availaible_map_characters |> Enum.all?(& &1.tracked)
|
||||
|
||||
cond do
|
||||
(only_tracked_characters and can_track? and all_character_tracked?) or
|
||||
(not only_tracked_characters and can_view?) ->
|
||||
Process.send_after(self(), {:map_init, %{
|
||||
map_id: map_id,
|
||||
page_title: map_name,
|
||||
user_permissions: user_permissions,
|
||||
tracked_character_ids: tracked_character_ids
|
||||
}}, 10)
|
||||
|
||||
only_tracked_characters and can_track? and not all_character_tracked? ->
|
||||
Process.send_after(self(), :not_all_characters_tracked, 10)
|
||||
|
||||
true ->
|
||||
Process.send_after(self(), :no_permissions, 10)
|
||||
end
|
||||
else
|
||||
_ ->
|
||||
Process.send_after(self(), :no_access, 10)
|
||||
end
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_info({:map_init, %{map_id: map_id} = initial_data}, socket) do
|
||||
Phoenix.PubSub.subscribe(WandererApp.PubSub, map_id)
|
||||
WandererApp.Map.Manager.start_map(map_id)
|
||||
|
||||
{:ok, map_started} = WandererApp.Cache.lookup("map_#{map_id}:started", false)
|
||||
|
||||
if map_started do
|
||||
Process.send_after(self(), %{event: :map_started}, 100)
|
||||
end
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
@@ -373,7 +423,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
case event do
|
||||
{:track_characters, map_characters, track_character} ->
|
||||
:ok = _track_characters(map_characters, map_id, track_character)
|
||||
:ok = _add_characters(map_characters, map_id)
|
||||
:ok = _add_characters(map_characters, map_id, track_character)
|
||||
socket
|
||||
|
||||
:invalid_token_message ->
|
||||
@@ -402,6 +452,24 @@ defmodule WandererAppWeb.MapLive do
|
||||
end
|
||||
end)
|
||||
|
||||
Process.send_after(self(), {:map_loaded,
|
||||
%{
|
||||
map_id: map_id,
|
||||
user_characters: user_character_eve_ids,
|
||||
initial_data: initial_data
|
||||
}}, 10)
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
def handle_info({:map_loaded,
|
||||
%{
|
||||
map_id: map_id,
|
||||
user_characters: user_character_eve_ids,
|
||||
initial_data: initial_data
|
||||
} = _loaded_data}, socket) do
|
||||
map_characters = map_id |> WandererApp.Map.list_characters()
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|> assign(
|
||||
@@ -409,7 +477,9 @@ defmodule WandererAppWeb.MapLive do
|
||||
user_characters: user_character_eve_ids,
|
||||
has_tracked_characters?: _has_tracked_characters?(user_character_eve_ids)
|
||||
)
|
||||
|> _push_map_event("init", initial_data)
|
||||
|> _push_map_event("init", initial_data |> Map.merge(%{
|
||||
characters: map_characters |> Enum.map(&map_ui_character/1)
|
||||
}))
|
||||
|> push_event("js-exec", %{
|
||||
to: "#map-loader",
|
||||
attr: "data-loaded"
|
||||
@@ -441,7 +511,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_info(
|
||||
{ref, result},
|
||||
socket
|
||||
) do
|
||||
) when is_reference(ref) do
|
||||
Process.demonitor(ref, [:flush])
|
||||
|
||||
case result do
|
||||
@@ -453,11 +523,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
maps: maps
|
||||
)}
|
||||
|
||||
{:map_init_data, %{map_id: map_id} = initial_data} ->
|
||||
Process.send_after(self(), {:map_init, initial_data}, 100)
|
||||
{:noreply, socket}
|
||||
|
||||
{:map_started, started_data} ->
|
||||
{:map_started_data, started_data} ->
|
||||
Process.send_after(self(), {:map_start, started_data}, 100)
|
||||
{:noreply, socket}
|
||||
|
||||
@@ -488,13 +554,19 @@ defmodule WandererAppWeb.MapLive do
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@impl true
|
||||
def handle_info(_event, socket), do: {:noreply, socket}
|
||||
|
||||
@impl true
|
||||
def handle_event("loaded", _body, socket) do
|
||||
def handle_event("ui_loaded", _body, %{assigns: %{map_id: map_id}} = socket) do
|
||||
{:ok, map_started} = WandererApp.Cache.lookup("map_#{map_id}:started", false)
|
||||
|
||||
if map_started do
|
||||
Process.send_after(self(), %{event: :map_started}, 10)
|
||||
else
|
||||
WandererApp.Map.Manager.start_map(map_id)
|
||||
end
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
@@ -504,7 +576,8 @@ defmodule WandererAppWeb.MapLive do
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("change_map", %{"map_slug" => map_slug} = _event, socket) do
|
||||
def handle_event("change_map", %{"map_slug" => map_slug} = _event, %{assigns: %{map_id: map_id}} = socket) do
|
||||
Phoenix.PubSub.unsubscribe(WandererApp.PubSub, map_id)
|
||||
{:noreply, push_navigate(socket, to: ~p"/#{map_slug}")}
|
||||
end
|
||||
|
||||
@@ -1267,7 +1340,6 @@ defmodule WandererAppWeb.MapLive do
|
||||
def handle_event("toggle_track", %{"character-id" => character_id}, socket) do
|
||||
map = socket.assigns.map
|
||||
character_settings = socket.assigns.character_settings
|
||||
current_user = socket.assigns.current_user
|
||||
|
||||
socket =
|
||||
case character_settings |> Enum.find(&(&1.character_id == character_id)) do
|
||||
@@ -1282,7 +1354,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
character = map_character_settings |> Ash.load!(:character) |> Map.get(:character)
|
||||
|
||||
:ok = _track_characters([character], map.id, true)
|
||||
:ok = _add_characters([character], map.id)
|
||||
:ok = _add_characters([character], map.id, true)
|
||||
|
||||
socket
|
||||
|
||||
@@ -1317,7 +1389,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
character = map_character_settings |> Ash.load!(:character) |> Map.get(:character)
|
||||
|
||||
:ok = _track_characters([character], map.id, true)
|
||||
:ok = _add_characters([character], map.id)
|
||||
:ok = _add_characters([character], map.id, true)
|
||||
|
||||
socket
|
||||
end
|
||||
@@ -1325,7 +1397,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
|
||||
%{result: characters} = socket.assigns.characters
|
||||
|
||||
{:ok, map_characters} = _get_map_characters(map.id, socket.assigns.current_user)
|
||||
{:ok, map_characters} = _get_tracked_map_characters(map.id, socket.assigns.current_user)
|
||||
|
||||
user_character_eve_ids = map_characters |> Enum.map(& &1.eve_id)
|
||||
|
||||
@@ -1409,74 +1481,17 @@ defmodule WandererAppWeb.MapLive do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
defp _load_initial_data(map, is_reconnect?, current_user) do
|
||||
with %{
|
||||
id: map_id,
|
||||
deleted: false,
|
||||
only_tracked_characters: only_tracked_characters,
|
||||
user_permissions: user_permissions,
|
||||
name: map_name,
|
||||
owner_id: owner_id
|
||||
} <- map do
|
||||
user_permissions =
|
||||
WandererApp.Permissions.get_map_permissions(
|
||||
user_permissions,
|
||||
owner_id,
|
||||
current_user.characters |> Enum.map(& &1.id)
|
||||
)
|
||||
|
||||
{:ok, character_settings} =
|
||||
case WandererApp.Api.MapCharacterSettings.read_by_map(%{map_id: map_id}) do
|
||||
{:ok, settings} -> {:ok, settings}
|
||||
_ -> {:ok, []}
|
||||
end
|
||||
|
||||
{:ok, %{characters: availaible_map_characters}} =
|
||||
WandererApp.Maps.load_characters(map, character_settings, current_user.id)
|
||||
|
||||
can_view? = user_permissions.view_system
|
||||
can_track? = user_permissions.track_character
|
||||
|
||||
tracked_character_ids =
|
||||
availaible_map_characters |> Enum.filter(& &1.tracked) |> Enum.map(& &1.id)
|
||||
|
||||
all_character_tracked? = (not (availaible_map_characters |> Enum.empty?())) and availaible_map_characters |> Enum.all?(& &1.tracked)
|
||||
|
||||
cond do
|
||||
(only_tracked_characters and can_track? and all_character_tracked?) or
|
||||
(not only_tracked_characters and can_view?) ->
|
||||
{:map_init_data,
|
||||
%{
|
||||
map_id: map_id,
|
||||
page_title: map_name,
|
||||
user_permissions: user_permissions,
|
||||
tracked_character_ids: tracked_character_ids,
|
||||
is_reconnect?: is_reconnect?
|
||||
}}
|
||||
|
||||
only_tracked_characters and can_track? and not all_character_tracked? ->
|
||||
{:map_error, :not_all_characters_tracked}
|
||||
|
||||
true ->
|
||||
{:map_error, :no_permissions}
|
||||
end
|
||||
else
|
||||
_ ->
|
||||
{:map_error, :no_access}
|
||||
end
|
||||
end
|
||||
|
||||
defp _on_map_started(map_id, current_user, user_permissions) do
|
||||
case user_permissions do
|
||||
%{view_system: true, track_character: track_character} ->
|
||||
{:ok, _} = current_user |> WandererApp.Api.User.update_last_map(%{last_map_id: map_id})
|
||||
|
||||
{:ok, map_characters} = _get_map_characters(map_id, current_user)
|
||||
{:ok, tracked_map_characters} = _get_tracked_map_characters(map_id, current_user)
|
||||
|
||||
user_character_eve_ids = map_characters |> Enum.map(& &1.eve_id)
|
||||
user_character_eve_ids = tracked_map_characters |> Enum.map(& &1.eve_id)
|
||||
|
||||
events =
|
||||
case map_characters |> Enum.any?(&(&1.access_token == nil)) do
|
||||
case tracked_map_characters |> Enum.any?(&(&1.access_token == nil)) do
|
||||
true ->
|
||||
[:invalid_token_message]
|
||||
|
||||
@@ -1485,7 +1500,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
end
|
||||
|
||||
events =
|
||||
case map_characters |> Enum.empty?() do
|
||||
case tracked_map_characters |> Enum.empty?() do
|
||||
true ->
|
||||
events ++ [:empty_tracked_characters]
|
||||
|
||||
@@ -1501,21 +1516,18 @@ defmodule WandererAppWeb.MapLive do
|
||||
events =
|
||||
case present_character_ids |> Enum.count() < characters_limit do
|
||||
true ->
|
||||
events ++ [{:track_characters, map_characters, track_character}]
|
||||
events ++ [{:track_characters, tracked_map_characters, track_character}]
|
||||
|
||||
_ ->
|
||||
events ++ [:map_character_limit]
|
||||
end
|
||||
|
||||
characters = map_id |> WandererApp.Map.list_characters() |> Enum.map(&map_ui_character/1)
|
||||
|
||||
{:ok, kills} = WandererApp.Cache.lookup("map_#{map_id}:zkb_kills", Map.new())
|
||||
|
||||
initial_data =
|
||||
map_id
|
||||
|> _get_map_data()
|
||||
|> Map.merge(%{
|
||||
characters: characters,
|
||||
kills:
|
||||
kills
|
||||
|> Enum.filter(fn {_, kills} -> kills > 0 end)
|
||||
@@ -1552,16 +1564,16 @@ defmodule WandererAppWeb.MapLive do
|
||||
)
|
||||
|> Map.put(:reset, true)
|
||||
|
||||
{:map_started,
|
||||
%{
|
||||
map_id: map_id,
|
||||
user_characters: user_character_eve_ids,
|
||||
initial_data: initial_data,
|
||||
events: events
|
||||
}}
|
||||
Process.send_after(self(), {:map_start, %{
|
||||
map_id: map_id,
|
||||
user_characters: user_character_eve_ids,
|
||||
initial_data: initial_data,
|
||||
events: events
|
||||
}}, 10)
|
||||
|
||||
_ ->
|
||||
{:map_error, :no_access}
|
||||
Process.send_after(self(), :no_access, 10)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1607,7 +1619,7 @@ defmodule WandererAppWeb.MapLive do
|
||||
}
|
||||
end
|
||||
|
||||
defp _get_map_characters(map_id, current_user) do
|
||||
defp _get_tracked_map_characters(map_id, current_user) do
|
||||
case WandererApp.Api.MapCharacterSettings.tracked_by_map(%{
|
||||
map_id: map_id,
|
||||
character_ids: current_user.characters |> Enum.map(& &1.id)
|
||||
@@ -1940,17 +1952,13 @@ defmodule WandererAppWeb.MapLive do
|
||||
|
||||
defp _get_routes_settings(_), do: %{}
|
||||
|
||||
defp _add_characters([], _map_id), do: :ok
|
||||
defp _add_characters([], _map_id, _track_character), do: :ok
|
||||
|
||||
defp _add_characters([character | characters], map_id) do
|
||||
Task.async(fn ->
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_character(character)
|
||||
defp _add_characters([character | characters], map_id, track_character) do
|
||||
map_id
|
||||
|> WandererApp.Map.Server.add_character(character, track_character)
|
||||
|
||||
:skip
|
||||
end)
|
||||
|
||||
_add_characters(characters, map_id)
|
||||
_add_characters(characters, map_id, track_character)
|
||||
end
|
||||
|
||||
defp _remove_characters([], _map_id), do: :ok
|
||||
@@ -2071,13 +2079,14 @@ defmodule WandererAppWeb.MapLive do
|
||||
:ok = WandererApp.Character.TrackerManager.start_tracking(character_id)
|
||||
end
|
||||
|
||||
defp _push_map_event(socket, type, event_body),
|
||||
do:
|
||||
defp _push_map_event(socket, type, event_body)
|
||||
do
|
||||
socket
|
||||
|> push_event("map_event", %{
|
||||
type: type,
|
||||
body: event_body |> WandererApp.Utils.JSONUtil.compress()
|
||||
})
|
||||
end
|
||||
|
||||
defp map_id(%{assigns: %{map_id: map_id}} = _socket), do: map_id
|
||||
end
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
id="map-loader"
|
||||
data-loading={show_loader("map-loader")}
|
||||
data-loaded={hide_loader("map-loader")}
|
||||
class="!z-100 absolute w-screen h-screen bg-transparent hidden"
|
||||
class="!z-100 w-screen h-screen hidden relative"
|
||||
>
|
||||
<div class="flex w-full h-full items-center justify-center">
|
||||
<div class="hs-overlay-backdrop transition duration absolute inset-0 blur" />
|
||||
<div class="flex !z-[150] w-full h-full items-center justify-center">
|
||||
<div class="Loader" data-text="Wanderer">
|
||||
<span class="Loader__Circle"></span>
|
||||
<span class="Loader__Circle"></span>
|
||||
@@ -12,6 +13,8 @@
|
||||
<span class="Loader__Circle"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="w-full h-full" id="mapper" phx-hook="Mapper" phx-update="ignore"></div>
|
||||
|
||||
@@ -5,6 +5,8 @@ defmodule WandererAppWeb.MapsLive do
|
||||
|
||||
alias BetterNumber, as: Number
|
||||
|
||||
@pubsub_client Application.compile_env(:wanderer_app, :pubsub_client)
|
||||
|
||||
@impl true
|
||||
def mount(_params, %{"user_id" => user_id} = _session, socket) when not is_nil(user_id) do
|
||||
{:ok, active_characters} = WandererApp.Api.Character.active_by_user(%{user_id: user_id})
|
||||
@@ -112,6 +114,13 @@ defmodule WandererAppWeb.MapsLive do
|
||||
"auto_renew?" => true
|
||||
}
|
||||
|
||||
options_form =
|
||||
map.options
|
||||
|> case do
|
||||
nil -> %{"layout" => "left_to_right"}
|
||||
options -> Jason.decode!(options)
|
||||
end
|
||||
|
||||
{:ok, estimated_price, discount} =
|
||||
WandererApp.Map.SubscriptionManager.estimate_price(subscription_form, false)
|
||||
|
||||
@@ -130,6 +139,7 @@ defmodule WandererAppWeb.MapsLive do
|
||||
active_settings_tab: "general",
|
||||
is_adding_subscription?: false,
|
||||
selected_subscription: nil,
|
||||
options_form: options_form |> to_form(),
|
||||
map_subscriptions: map_subscriptions,
|
||||
subscription_form: subscription_form |> to_form(),
|
||||
estimated_price: estimated_price,
|
||||
@@ -142,6 +152,10 @@ defmodule WandererAppWeb.MapsLive do
|
||||
{"3 Months", "3"},
|
||||
{"6 Months", "6"},
|
||||
{"1 Year", "12"}
|
||||
],
|
||||
layout_options: [
|
||||
{"Left To Right", "left_to_right"},
|
||||
{"Top To Bottom", "top_to_bottom"}
|
||||
]
|
||||
)
|
||||
|> allow_upload(:settings,
|
||||
@@ -167,24 +181,6 @@ defmodule WandererAppWeb.MapsLive do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"live_select_change",
|
||||
%{"id" => "form_owner_id_live_select_component" = id, "text" => text} = _change_event,
|
||||
socket
|
||||
) do
|
||||
options =
|
||||
if text == "" do
|
||||
socket.assigns.characters
|
||||
else
|
||||
socket.assigns.characters
|
||||
end
|
||||
|
||||
send_update(LiveSelect.Component, options: options, id: id)
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(
|
||||
"live_select_change",
|
||||
@@ -671,6 +667,28 @@ defmodule WandererAppWeb.MapsLive do
|
||||
|> push_patch(to: ~p"/maps")}
|
||||
end
|
||||
|
||||
def handle_event(
|
||||
"update_options",
|
||||
%{
|
||||
"layout" => layout
|
||||
} = options_form,
|
||||
%{assigns: %{map_id: map_id, map: map, current_user: current_user}} = socket
|
||||
) do
|
||||
options = %{layout: layout}
|
||||
|
||||
updated_map =
|
||||
map
|
||||
|> WandererApp.Api.Map.update_options!(%{options: Jason.encode!(options)})
|
||||
|
||||
@pubsub_client.broadcast(
|
||||
WandererApp.PubSub,
|
||||
"maps:#{map_id}",
|
||||
{:options_updated, options}
|
||||
)
|
||||
|
||||
{:noreply, socket |> assign(map: updated_map, options_form: options_form)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("noop", _, socket) do
|
||||
{:noreply, socket}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
>
|
||||
<figure class="absolute z-10 h-200 avatar w-full h-full">
|
||||
<img :if={map.scope === :all} class="absolute h-200" src="/images/all_back.webp" />
|
||||
|
||||
<img
|
||||
:if={map.scope === :wormholes}
|
||||
class="absolute h-200"
|
||||
@@ -137,23 +136,17 @@
|
||||
<.input type="text" field={f[:name]} placeholder="Name" />
|
||||
<.input type="text" field={f[:slug]} prefix={@uri} placeholder="map-slug" />
|
||||
<.input type="textarea" field={f[:description]} placeholder="Public description" />
|
||||
<.live_select
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:owner_id]}
|
||||
value_mapper={&map_character/1}
|
||||
options={@characters}
|
||||
class="p-dropdown p-component p-inputwrapper mt-8"
|
||||
placeholder="Select a map owner"
|
||||
>
|
||||
<:option :let={option}>
|
||||
<div class="flex items-center">
|
||||
<.avatar url={member_icon_url(option.eve_id)} label={option.label} />
|
||||
<%= option.label %>
|
||||
</div>
|
||||
</:option>
|
||||
</.live_select>
|
||||
options={Enum.map(@characters, fn character -> {character.label, character.id} end)}
|
||||
/>
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:scope]}
|
||||
class="p-dropdown p-component p-inputwrapper"
|
||||
class="p-dropdown p-component p-inputwrapper mt-8"
|
||||
placeholder="Select a map scope"
|
||||
options={Enum.map(@scopes, fn scope -> {scope, scope} end)}
|
||||
/>
|
||||
@@ -196,7 +189,6 @@
|
||||
>
|
||||
<div role="tablist" class="tabs tabs-bordered">
|
||||
<a
|
||||
:if={@map_subscriptions_enabled?}
|
||||
role="tab"
|
||||
phx-click="change_settings_tab"
|
||||
phx-value-tab="general"
|
||||
@@ -207,6 +199,17 @@
|
||||
>
|
||||
<.icon name="hero-wrench-screwdriver-solid" class="w-4 h-4" /> General
|
||||
</a>
|
||||
<a
|
||||
role="tab"
|
||||
phx-click="change_settings_tab"
|
||||
phx-value-tab="import"
|
||||
class={[
|
||||
"tab",
|
||||
classes("tab-active": @active_settings_tab == "import")
|
||||
]}
|
||||
>
|
||||
<.icon name="hero-wrench-screwdriver-solid" class="w-4 h-4" /> Import/Export
|
||||
</a>
|
||||
<a
|
||||
:if={@map_subscriptions_enabled?}
|
||||
role="tab"
|
||||
@@ -233,6 +236,27 @@
|
||||
</a>
|
||||
</div>
|
||||
<.header :if={@active_settings_tab == "general"} class="bordered border-1 border-zinc-800">
|
||||
<:actions>
|
||||
<.form
|
||||
:let={f}
|
||||
:if={assigns |> Map.get(:options_form, false)}
|
||||
for={@options_form}
|
||||
phx-change="update_options"
|
||||
>
|
||||
<div class="stat-title">Map systems layout</div>
|
||||
<div class="stat-value text-white">
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:layout]}
|
||||
class="p-dropdown p-component p-inputwrapper"
|
||||
placeholder="Map default layout"
|
||||
options={@layout_options}
|
||||
/>
|
||||
</div>
|
||||
</.form>
|
||||
</:actions>
|
||||
</.header>
|
||||
<.header :if={@active_settings_tab == "import"} class="bordered border-1 border-zinc-800">
|
||||
Import/Export Map Settings
|
||||
<:actions>
|
||||
<.form :if={assigns |> Map.get(:import_form, false)} for={@import_form} phx-change="import">
|
||||
|
||||
2
mix.exs
@@ -2,7 +2,7 @@ defmodule WandererApp.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@source_url "https://github.com/wanderer-industries/wanderer"
|
||||
@version "1.0.21"
|
||||
@version "1.3.0"
|
||||
|
||||
def project do
|
||||
[
|
||||
|
||||
21
priv/repo/migrations/20241006092351_add_map_options.exs
Normal file
@@ -0,0 +1,21 @@
|
||||
defmodule WandererApp.Repo.Migrations.AddMapOptions do
|
||||
@moduledoc """
|
||||
Updates resources based on their most recent snapshots.
|
||||
|
||||
This file was autogenerated with `mix ash_postgres.generate_migrations`
|
||||
"""
|
||||
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
alter table(:maps_v1) do
|
||||
add :options, :text
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
alter table(:maps_v1) do
|
||||
remove :options
|
||||
end
|
||||
end
|
||||
end
|
||||
186
priv/resource_snapshots/repo/maps_v1/20241006092351.json
Normal file
@@ -0,0 +1,186 @@
|
||||
{
|
||||
"attributes": [
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "fragment(\"gen_random_uuid()\")",
|
||||
"generated?": false,
|
||||
"primary_key?": true,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "id",
|
||||
"type": "uuid"
|
||||
},
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "name",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "slug",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "description",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "personal_note",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "[]",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "hubs",
|
||||
"type": [
|
||||
"array",
|
||||
"text"
|
||||
]
|
||||
},
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "\"wormholes\"",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "scope",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "false",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "deleted",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "false",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "only_tracked_characters",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "options",
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "inserted_at",
|
||||
"type": "utc_datetime_usec"
|
||||
},
|
||||
{
|
||||
"allow_nil?": false,
|
||||
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": null,
|
||||
"size": null,
|
||||
"source": "updated_at",
|
||||
"type": "utc_datetime_usec"
|
||||
},
|
||||
{
|
||||
"allow_nil?": true,
|
||||
"default": "nil",
|
||||
"generated?": false,
|
||||
"primary_key?": false,
|
||||
"references": {
|
||||
"deferrable": false,
|
||||
"destination_attribute": "id",
|
||||
"destination_attribute_default": null,
|
||||
"destination_attribute_generated": null,
|
||||
"index?": false,
|
||||
"match_type": null,
|
||||
"match_with": null,
|
||||
"multitenancy": {
|
||||
"attribute": null,
|
||||
"global": null,
|
||||
"strategy": null
|
||||
},
|
||||
"name": "maps_v1_owner_id_fkey",
|
||||
"on_delete": null,
|
||||
"on_update": null,
|
||||
"primary_key?": true,
|
||||
"schema": "public",
|
||||
"table": "character_v1"
|
||||
},
|
||||
"size": null,
|
||||
"source": "owner_id",
|
||||
"type": "uuid"
|
||||
}
|
||||
],
|
||||
"base_filter": null,
|
||||
"check_constraints": [],
|
||||
"custom_indexes": [],
|
||||
"custom_statements": [],
|
||||
"has_create_action": true,
|
||||
"hash": "E5FC6B5F1B9AD5E23163494C7C93A8002F9C812AFC7A26A8C33A344877086A03",
|
||||
"identities": [
|
||||
{
|
||||
"all_tenants?": false,
|
||||
"base_filter": null,
|
||||
"index_name": "maps_v1_unique_slug_index",
|
||||
"keys": [
|
||||
{
|
||||
"type": "atom",
|
||||
"value": "slug"
|
||||
}
|
||||
],
|
||||
"name": "unique_slug",
|
||||
"nils_distinct?": true,
|
||||
"where": null
|
||||
}
|
||||
],
|
||||
"multitenancy": {
|
||||
"attribute": null,
|
||||
"global": null,
|
||||
"strategy": null
|
||||
},
|
||||
"repo": "Elixir.WandererApp.Repo",
|
||||
"schema": null,
|
||||
"table": "maps_v1"
|
||||
}
|
||||