fix(Map): Removed unnecessary code onFE part

This commit is contained in:
achichenkov
2025-04-20 18:34:59 +03:00
parent 77d549ac1b
commit 196f2c2c3b
4 changed files with 17 additions and 51 deletions

View File

@@ -217,7 +217,7 @@ export const WORMHOLES_ADDITIONAL_INFO_RAW: WormholesAdditionalInfoType[] = [
wormholeClassID: 14, wormholeClassID: 14,
effectPower: 2, effectPower: 2,
title: 'Class 14 (Sentinel Drifter)', title: 'Class 14 (Sentinel Drifter)',
shortTitle: 'Sentinel', shortTitle: 'Sentinel MZ',
}, },
{ {
id: 'barbican', id: 'barbican',
@@ -225,7 +225,7 @@ export const WORMHOLES_ADDITIONAL_INFO_RAW: WormholesAdditionalInfoType[] = [
wormholeClassID: 15, wormholeClassID: 15,
effectPower: 2, effectPower: 2,
title: 'Class 15 (Barbican Drifter)', title: 'Class 15 (Barbican Drifter)',
shortTitle: 'Barbican', shortTitle: 'Liberated Barbican',
}, },
{ {
id: 'vidette', id: 'vidette',
@@ -233,7 +233,7 @@ export const WORMHOLES_ADDITIONAL_INFO_RAW: WormholesAdditionalInfoType[] = [
wormholeClassID: 16, wormholeClassID: 16,
effectPower: 2, effectPower: 2,
title: 'Class 16 (Vidette Drifter)', title: 'Class 16 (Vidette Drifter)',
shortTitle: 'Vidette', shortTitle: 'Sanctified Vidette',
}, },
{ {
id: 'conflux', id: 'conflux',
@@ -241,7 +241,7 @@ export const WORMHOLES_ADDITIONAL_INFO_RAW: WormholesAdditionalInfoType[] = [
wormholeClassID: 17, wormholeClassID: 17,
effectPower: 2, effectPower: 2,
title: 'Class 17 (Conflux Drifter)', title: 'Class 17 (Conflux Drifter)',
shortTitle: 'Conflux', shortTitle: 'Conflux Eyrie',
}, },
{ {
id: 'redoubt', id: 'redoubt',
@@ -249,7 +249,7 @@ export const WORMHOLES_ADDITIONAL_INFO_RAW: WormholesAdditionalInfoType[] = [
wormholeClassID: 18, wormholeClassID: 18,
effectPower: 2, effectPower: 2,
title: 'Class 18 (Redoubt Drifter)', title: 'Class 18 (Redoubt Drifter)',
shortTitle: 'Redoubt', shortTitle: 'Azdaja Redoubt',
}, },
{ {
id: 'a1', id: 'a1',

View File

@@ -1,10 +1,5 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types'; import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
import {
SOLAR_SYSTEM_CLASS_GROUPS,
SOLAR_SYSTEM_CLASSES_TO_CLASS_GROUPS,
WORMHOLES_ADDITIONAL_INFO_BY_CLASS_ID,
} from '@/hooks/Mapper/components/map/constants.ts';
interface UseSystemNameParams { interface UseSystemNameParams {
isTempSystemNameEnabled: boolean; isTempSystemNameEnabled: boolean;
@@ -23,19 +18,7 @@ export const useSystemName = ({
name, name,
systemStaticInfo, systemStaticInfo,
}: UseSystemNameParams) => { }: UseSystemNameParams) => {
const { solar_system_name = '', system_class } = systemStaticInfo; const { solar_system_name = '' } = systemStaticInfo;
const systemPreparedName = useMemo(() => {
const { id: whType, shortTitle } = WORMHOLES_ADDITIONAL_INFO_BY_CLASS_ID[system_class];
// @ts-ignore
const spawnClassGroup = SOLAR_SYSTEM_CLASSES_TO_CLASS_GROUPS[whType];
if (spawnClassGroup === SOLAR_SYSTEM_CLASS_GROUPS.drifter) {
return shortTitle;
}
return solar_system_name;
}, [system_class, solar_system_name]);
const computedTemporaryName = useMemo(() => { const computedTemporaryName = useMemo(() => {
if (!isTempSystemNameEnabled) { if (!isTempSystemNameEnabled) {
@@ -43,19 +26,19 @@ export const useSystemName = ({
} }
if (isShowLinkedSigIdTempName && linkedSigPrefix) { if (isShowLinkedSigIdTempName && linkedSigPrefix) {
return temporary_name ? `${linkedSigPrefix}${temporary_name}` : `${linkedSigPrefix}${systemPreparedName}`; return temporary_name ? `${linkedSigPrefix}${temporary_name}` : `${linkedSigPrefix}${solar_system_name}`;
} }
return temporary_name ?? ''; return temporary_name ?? '';
}, [isTempSystemNameEnabled, temporary_name, systemPreparedName, isShowLinkedSigIdTempName, linkedSigPrefix]); }, [isTempSystemNameEnabled, temporary_name, solar_system_name, isShowLinkedSigIdTempName, linkedSigPrefix]);
const systemName = useMemo(() => { const systemName = useMemo(() => {
if (isTempSystemNameEnabled && computedTemporaryName) { if (isTempSystemNameEnabled && computedTemporaryName) {
return computedTemporaryName; return computedTemporaryName;
} }
return systemPreparedName; return solar_system_name;
}, [isTempSystemNameEnabled, computedTemporaryName, systemPreparedName]); }, [isTempSystemNameEnabled, computedTemporaryName, solar_system_name]);
const customName = useMemo(() => { const customName = useMemo(() => {
if (isTempSystemNameEnabled && computedTemporaryName && name) { if (isTempSystemNameEnabled && computedTemporaryName && name) {

View File

@@ -4,12 +4,7 @@ import classes from './SystemViewStandalone.module.scss';
import clsx from 'clsx'; import clsx from 'clsx';
import { WithClassName } from '@/hooks/Mapper/types/common.ts'; import { WithClassName } from '@/hooks/Mapper/types/common.ts';
import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types'; import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
import { HTMLProps, MouseEvent, useCallback, useMemo } from 'react'; import { HTMLProps, MouseEvent, useCallback } from 'react';
import {
SOLAR_SYSTEM_CLASS_GROUPS,
SOLAR_SYSTEM_CLASSES_TO_CLASS_GROUPS,
WORMHOLES_ADDITIONAL_INFO_BY_CLASS_ID,
} from '@/hooks/Mapper/components/map/constants.ts';
export type SystemViewStandaloneStatic = Pick< export type SystemViewStandaloneStatic = Pick<
SolarSystemStaticInfoRaw, SolarSystemStaticInfoRaw,
@@ -45,18 +40,6 @@ export const SystemViewStandalone = ({
const isWH = isWormholeSpace(system_class); const isWH = isWormholeSpace(system_class);
1; 1;
const systemPreparedName = useMemo(() => {
const { id: whType, shortTitle } = WORMHOLES_ADDITIONAL_INFO_BY_CLASS_ID[system_class];
// @ts-ignore
const spawnClassGroup = SOLAR_SYSTEM_CLASSES_TO_CLASS_GROUPS[whType];
if (spawnClassGroup === SOLAR_SYSTEM_CLASS_GROUPS.drifter) {
return shortTitle;
}
return solar_system_name;
}, [system_class, solar_system_name]);
const handleClick = useCallback( const handleClick = useCallback(
(e: MouseEvent) => { (e: MouseEvent) => {
e.preventDefault(); e.preventDefault();
@@ -79,7 +62,7 @@ export const SystemViewStandalone = ({
[classes.CompactName]: compact, [classes.CompactName]: compact,
})} })}
> >
{customName ?? systemPreparedName} {customName ?? solar_system_name}
</span> </span>
{!hideRegion && !isWH && <span className="whitespace-nowrap">{region_name}</span>} {!hideRegion && !isWH && <span className="whitespace-nowrap">{region_name}</span>}
</div> </div>

View File

@@ -110,7 +110,7 @@
"wormholeClassID": 14, "wormholeClassID": 14,
"effectPower": 2, "effectPower": 2,
"title": "Class 14 (Sentinel Drifter)", "title": "Class 14 (Sentinel Drifter)",
"shortTitle": "Sentinel" "shortTitle": "Sentinel MZ"
}, },
{ {
"id": "barbican", "id": "barbican",
@@ -118,7 +118,7 @@
"wormholeClassID": 15, "wormholeClassID": 15,
"effectPower": 2, "effectPower": 2,
"title": "Class 15 (Barbican Drifter)", "title": "Class 15 (Barbican Drifter)",
"shortTitle": "Barbican" "shortTitle": "Lib. Barbican"
}, },
{ {
"id": "vidette", "id": "vidette",
@@ -126,7 +126,7 @@
"wormholeClassID": 16, "wormholeClassID": 16,
"effectPower": 2, "effectPower": 2,
"title": "Class 16 (Vidette Drifter)", "title": "Class 16 (Vidette Drifter)",
"shortTitle": "Vidette" "shortTitle": "Sanct. Vidette"
}, },
{ {
"id": "conflux", "id": "conflux",
@@ -134,7 +134,7 @@
"wormholeClassID": 17, "wormholeClassID": 17,
"effectPower": 2, "effectPower": 2,
"title": "Class 17 (Conflux Drifter)", "title": "Class 17 (Conflux Drifter)",
"shortTitle": "Conflux" "shortTitle": "Conflux Eyrie"
}, },
{ {
"id": "redoubt", "id": "redoubt",
@@ -142,7 +142,7 @@
"wormholeClassID": 18, "wormholeClassID": 18,
"effectPower": 2, "effectPower": 2,
"title": "Class 18 (Redoubt Drifter)", "title": "Class 18 (Redoubt Drifter)",
"shortTitle": "Redoubt" "shortTitle": "Azdaja Redoubt"
}, },
{ {
"id": "a1", "id": "a1",