diff --git a/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts b/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts index 7defb99c..ca639bd8 100644 --- a/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts +++ b/assets/js/hooks/Mapper/components/hooks/useSystemInfo.ts @@ -14,9 +14,6 @@ export const useSystemInfo = ({ systemId }: UseSystemInfoProps) => { const { systems: systemStatics } = useLoadSystemStatic({ systems: [systemId] }); - // eslint-disable-next-line no-console - console.log('JOipP', `systemStatics`, systemStatics); - return useMemo(() => { const staticInfo = systemStatics.get(parseInt(systemId)); const dynamicInfo = getSystemById(systems, systemId); diff --git a/assets/js/hooks/Mapper/components/map/components/ContextMenuConnection/ContextMenuConnection.tsx b/assets/js/hooks/Mapper/components/map/components/ContextMenuConnection/ContextMenuConnection.tsx index 8f44b244..b98082a3 100644 --- a/assets/js/hooks/Mapper/components/map/components/ContextMenuConnection/ContextMenuConnection.tsx +++ b/assets/js/hooks/Mapper/components/map/components/ContextMenuConnection/ContextMenuConnection.tsx @@ -6,7 +6,14 @@ import { Edge } from '@reactflow/core/dist/esm/types/edges'; import { ConnectionType, MassState, ShipSizeStatus, SolarSystemConnection, TimeStatus } from '@/hooks/Mapper/types'; import clsx from 'clsx'; import classes from './ContextMenuConnection.module.scss'; -import { MASS_STATE_NAMES, MASS_STATE_NAMES_ORDER } from '@/hooks/Mapper/components/map/constants.ts'; +import { + MASS_STATE_NAMES, + MASS_STATE_NAMES_ORDER, + SHIP_SIZES_NAMES, + SHIP_SIZES_NAMES_ORDER, + SHIP_SIZES_NAMES_SHORT, + SHIP_SIZES_SIZE, +} from '@/hooks/Mapper/components/map/constants.ts'; export interface ContextMenuConnectionProps { contextMenuRef: RefObject; @@ -48,10 +55,6 @@ export const ContextMenuConnection: React.FC = ({ icon: PrimeIcons.CLOCK, command: onChangeTimeState, }, - ] - : []), - ...(isWormhole - ? [ { label: `Frigate`, className: clsx({ @@ -60,13 +63,9 @@ export const ContextMenuConnection: React.FC = ({ icon: PrimeIcons.CLOUD, command: () => onChangeShipSizeStatus( - edge.data?.ship_size_type === ShipSizeStatus.small ? ShipSizeStatus.normal : ShipSizeStatus.small, + edge.data?.ship_size_type === ShipSizeStatus.small ? ShipSizeStatus.large : ShipSizeStatus.small, ), }, - ] - : []), - ...(isWormhole - ? [ { label: `Save mass`, className: clsx({ @@ -75,19 +74,40 @@ export const ContextMenuConnection: React.FC = ({ icon: PrimeIcons.LOCK, command: () => onToggleMassSave(!edge.data?.locked), }, - ] - : []), - ...(isWormhole && !isFrigateSize - ? [ + ...(!isFrigateSize + ? [ + { + label: `Mass status`, + icon: PrimeIcons.CHART_PIE, + items: MASS_STATE_NAMES_ORDER.map(x => ({ + label: MASS_STATE_NAMES[x], + className: clsx({ + [classes.SelectedItem]: edge.data?.mass_status === x, + }), + command: () => onChangeMassState(x), + })), + }, + ] + : []), + { - label: `Mass status`, - icon: PrimeIcons.CHART_PIE, - items: MASS_STATE_NAMES_ORDER.map(x => ({ - label: MASS_STATE_NAMES[x], + label: `Ship Size`, + icon: PrimeIcons.CLOUD, + items: SHIP_SIZES_NAMES_ORDER.map(x => ({ + label: ( +
+
{SHIP_SIZES_NAMES_SHORT[x]}
+
{SHIP_SIZES_NAMES[x]}
+
+
+ {SHIP_SIZES_SIZE[x]} t. +
+
+ ) as unknown as string, // TODO my lovely kostyl className: clsx({ - [classes.SelectedItem]: edge.data?.mass_status === x, + [classes.SelectedItem]: edge.data?.ship_size_type === x, }), - command: () => onChangeMassState(x), + command: () => onChangeShipSizeStatus(x), })), }, ] @@ -98,7 +118,7 @@ export const ContextMenuConnection: React.FC = ({ command: onDeleteConnection, }, ]; - }, [edge, onChangeTimeState, onDeleteConnection, onChangeMassState, onChangeShipSizeStatus]); + }, [edge, onChangeTimeState, onDeleteConnection, onChangeShipSizeStatus, onToggleMassSave, onChangeMassState]); return ( <> diff --git a/assets/js/hooks/Mapper/components/map/components/SolarSystemEdge/SolarSystemEdge.tsx b/assets/js/hooks/Mapper/components/map/components/SolarSystemEdge/SolarSystemEdge.tsx index 49fd48f2..f455fa9d 100644 --- a/assets/js/hooks/Mapper/components/map/components/SolarSystemEdge/SolarSystemEdge.tsx +++ b/assets/js/hooks/Mapper/components/map/components/SolarSystemEdge/SolarSystemEdge.tsx @@ -8,6 +8,7 @@ import { ConnectionType, MassState, ShipSizeStatus, SolarSystemConnection, TimeS import { PrimeIcons } from 'primereact/api'; import { WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper'; import { useMapState } from '@/hooks/Mapper/components/map/MapProvider.tsx'; +import { SHIP_SIZES_DESCRIPTION, SHIP_SIZES_NAMES_SHORT } from '@/hooks/Mapper/components/map/constants.ts'; const MAP_TRANSLATES: Record = { [Position.Top]: 'translate(-48%, 0%)', @@ -30,6 +31,14 @@ const MAP_OFFSETS: Record = { [Position.Right]: { x: 0, y: 0 }, }; +export const SHIP_SIZES_COLORS = { + [ShipSizeStatus.small]: 'bg-indigo-400', + [ShipSizeStatus.medium]: 'bg-cyan-500', + [ShipSizeStatus.large]: '', + [ShipSizeStatus.freight]: 'bg-lime-400', + [ShipSizeStatus.capital]: 'bg-red-400', +}; + export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }: EdgeProps) => { const sourceNode = useStore(useCallback(store => store.nodeInternals.get(source), [source])); const targetNode = useStore(useCallback(store => store.nodeInternals.get(target), [target])); @@ -137,6 +146,19 @@ export const SolarSystemEdge = ({ id, source, target, markerEnd, style, data }: )} + + {isWormhole && data.ship_size_type !== ShipSizeStatus.large && ( + + {SHIP_SIZES_NAMES_SHORT[data.ship_size_type]} + + )} diff --git a/assets/js/hooks/Mapper/components/map/constants.ts b/assets/js/hooks/Mapper/components/map/constants.ts index c521e9ca..bd39c233 100644 --- a/assets/js/hooks/Mapper/components/map/constants.ts +++ b/assets/js/hooks/Mapper/components/map/constants.ts @@ -1,4 +1,4 @@ -import { ConnectionType, MassState } from '@/hooks/Mapper/types'; +import { ConnectionType, MassState, ShipSizeStatus } from '@/hooks/Mapper/types'; export enum SOLAR_SYSTEM_CLASS_IDS { ccp1 = -1, @@ -727,16 +727,41 @@ export const MASS_STATE_NAMES = { [MassState.verge]: 'Verge of collapse', }; -// export const SHIP_SIZES_NAMES_ORDER = [ -// ShipSizeStatus.small, -// ShipSizeStatus.normal, -// // ShipSizeStatus.large, -// // ShipSizeStatus.capital, -// ]; -// -// export const SHIP_SIZES_NAMES = { -// [ShipSizeStatus.small]: 'Frigate', -// [ShipSizeStatus.normal]: 'Normal', -// // [ShipSizeStatus.large]: 'Normal', -// // [ShipSizeStatus.capital]: 'Normal', -// }; +export const SHIP_SIZES_NAMES_ORDER = [ + ShipSizeStatus.small, + ShipSizeStatus.medium, + ShipSizeStatus.large, + ShipSizeStatus.freight, + ShipSizeStatus.capital, +]; + +export const SHIP_SIZES_NAMES = { + [ShipSizeStatus.small]: 'Frigate', + [ShipSizeStatus.medium]: 'Medium', + [ShipSizeStatus.large]: 'Normal', + [ShipSizeStatus.freight]: 'Huge', + [ShipSizeStatus.capital]: 'Capital', +}; +export const SHIP_SIZES_SIZE = { + [ShipSizeStatus.small]: '5K', + [ShipSizeStatus.medium]: '62K', + [ShipSizeStatus.large]: '375K', + [ShipSizeStatus.freight]: '1M', + [ShipSizeStatus.capital]: '2M', +}; + +export const SHIP_SIZES_DESCRIPTION = { + [ShipSizeStatus.small]: 'Frigate wormhole - up to Destroyer | 5K t.', + [ShipSizeStatus.medium]: 'Cruise wormhole - up to Battlecruiser | 62K t.', + [ShipSizeStatus.large]: 'Large wormhole - up to Battleship | 375K t.', + [ShipSizeStatus.freight]: 'Huge wormhole - up to Freighter | 1M t.', + [ShipSizeStatus.capital]: 'Capital wormhole - up to Capital | 2M t.', +}; + +export const SHIP_SIZES_NAMES_SHORT = { + [ShipSizeStatus.small]: 'S', + [ShipSizeStatus.medium]: 'M', + [ShipSizeStatus.large]: 'L', + [ShipSizeStatus.freight]: 'H', + [ShipSizeStatus.capital]: 'XL', +}; diff --git a/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettings.tsx b/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettings.tsx index ed088050..0fcc623f 100644 --- a/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettings.tsx +++ b/assets/js/hooks/Mapper/components/mapRootContent/components/MapSettings/MapSettings.tsx @@ -58,11 +58,11 @@ const SIGNATURES_CHECKBOXES_PROPS: CheckboxesList = [ const CONNECTIONS_CHECKBOXES_PROPS: CheckboxesList = [ { prop: UserSettingsRemoteProps.delete_connection_with_sigs, label: 'Delete connections to linked signatures' }, + { prop: InterfaceStoredSettingsProps.isThickConnections, label: 'Thicker connections' }, ]; const UI_CHECKBOXES_PROPS: CheckboxesList = [ { prop: InterfaceStoredSettingsProps.isShowMenu, label: 'Enable compact map menu bar' }, - { prop: InterfaceStoredSettingsProps.isThickConnections, label: 'Thicker connections' }, { prop: InterfaceStoredSettingsProps.isShowBackgroundPattern, label: 'Show background pattern' }, { prop: InterfaceStoredSettingsProps.isSoftBackground, label: 'Enable soft background' }, ]; diff --git a/assets/js/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect/SignatureWormholeTypeSelect.tsx b/assets/js/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect/SignatureWormholeTypeSelect.tsx index b17dde62..03dc04cd 100644 --- a/assets/js/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect/SignatureWormholeTypeSelect.tsx +++ b/assets/js/hooks/Mapper/components/mapRootContent/components/SignatureSettings/components/SignatureWormholeTypeSelect/SignatureWormholeTypeSelect.tsx @@ -21,9 +21,6 @@ const getPossibleWormholes = (systemStatic: SolarSystemStaticInfoRaw, wormholes: return x.src.some(x => { const [group, type] = x.split('-'); - // eslint-disable-next-line no-console - console.log('JOipP', `group, type`, group, type); - if (type === 'shattered') { return systemStatic.is_shattered && group === spawnClassGroup; } @@ -32,11 +29,6 @@ const getPossibleWormholes = (systemStatic: SolarSystemStaticInfoRaw, wormholes: }); }); - // eslint-disable-next-line no-console - console.log('JOipP', `possibleWHTypes`, possibleWHTypes); - - // debugger; - return { statics: possibleWHTypes .filter(x => x.respawn.some(y => y === Respawn.static)) diff --git a/assets/js/hooks/Mapper/types/connection.ts b/assets/js/hooks/Mapper/types/connection.ts index 2bdd5ec7..30c8b2a1 100644 --- a/assets/js/hooks/Mapper/types/connection.ts +++ b/assets/js/hooks/Mapper/types/connection.ts @@ -14,16 +14,12 @@ export enum TimeStatus { eol, } -// export enum ShipSizeStatus { -// small, // frigates, destroyers - less than 5K t -// medium, // less than 20K t -// large, // less than 375K t -// capital, // less than 1.8M t -// } - export enum ShipSizeStatus { - small, // frigates, destroyers - less than 5K t - normal, + small = 0, // frigates, destroyers - less than 5K t + medium = 1, // less than 62K t + large = 2, // less than 375K t + freight = 3, // less than 1M t + capital = 4, // less than 1.8M t } export type SolarSystemConnection = {