import { memo } from 'react'; import { MapSolarSystemType } from '../../map.types'; import { Handle, NodeProps, Position } from 'reactflow'; import clsx from 'clsx'; import classes from './SolarSystemNodeTheme.module.scss'; import { PrimeIcons } from 'primereact/api'; import { useNodeKillsCount, useSolarSystemNode } from '../../hooks'; import { EFFECT_BACKGROUND_STYLES, MARKER_BOOKMARK_BG_STYLES, STATUS_CLASSES, } from '@/hooks/Mapper/components/map/constants'; import { WormholeClassComp } from '@/hooks/Mapper/components/map/components/WormholeClassComp'; import { UnsplashedSignature } from '@/hooks/Mapper/components/map/components/UnsplashedSignature'; import { TooltipPosition, WdTooltipWrapper } from '@/hooks/Mapper/components/ui-kit'; import { TooltipSize } from '@/hooks/Mapper/components/ui-kit/WdTooltipWrapper/utils.ts'; import { LocalCounter } from '@/hooks/Mapper/components/map/components/LocalCounter'; import { KillsCounter } from '@/hooks/Mapper/components/map/components/KillsCounter'; import { useLocalCounter } from '@/hooks/Mapper/components/hooks/useLocalCounter.ts'; // let render = 0; export const SolarSystemNodeTheme = memo((props: NodeProps) => { const nodeVars = useSolarSystemNode(props); const { localCounterCharacters } = useLocalCounter(nodeVars); const { killsCount: localKillsCount, killsActivityType: localKillsActivityType } = useNodeKillsCount( nodeVars.solarSystemId, ); // console.log('JOipP', `render ${nodeVars.id}`, render++); return ( <> {nodeVars.visible && (
{nodeVars.isShattered && (
)} {localKillsCount && localKillsCount > 0 && nodeVars.solarSystemId && localKillsActivityType && (
{localKillsCount}
)} {nodeVars.labelCustom !== '' && (
{nodeVars.labelCustom}
)} {nodeVars.labelsInfo.map(x => (
{x.shortName}
))}
)}
nodeVars.dbClick(e)} > {nodeVars.visible && ( <>
{nodeVars.classTitle ?? '-'}
{nodeVars.tag != null && nodeVars.tag !== '' && (
{nodeVars.tag}
)}
{nodeVars.systemName}
{nodeVars.isWormhole && (
{nodeVars.sortedStatics.map(whClass => ( ))}
)} {nodeVars.effectName !== null && nodeVars.isWormhole && (
)}
{nodeVars.customName && (
{nodeVars.customName}
)} {!nodeVars.isWormhole && !nodeVars.customName && (
{nodeVars.regionName}
)} {nodeVars.isWormhole && !nodeVars.customName &&
}
{nodeVars.locked && } {nodeVars.hubs.includes(nodeVars.solarSystemId) && ( )}
)}
{nodeVars.visible && ( <> {nodeVars.unsplashedLeft.length > 0 && (
{nodeVars.unsplashedLeft.map(sig => ( ))}
)} {nodeVars.unsplashedRight.length > 0 && (
{nodeVars.unsplashedRight.map(sig => ( ))}
)} )} {nodeVars.systemHighlighted === nodeVars.solarSystemId && (
)}
); }); SolarSystemNodeTheme.displayName = 'SolarSystemNodeTheme';