import { useCallback } from 'react'; import clsx from 'clsx'; import { useAutoAnimate } from '@formkit/auto-animate/react'; import { Commands } from '@/hooks/Mapper/types/mapHandlers.ts'; import { CharacterTypeRaw } from '@/hooks/Mapper/types'; import { emitMapEvent } from '@/hooks/Mapper/events'; import { useMapRootState } from '@/hooks/Mapper/mapRootProvider'; import classes from './Characters.module.scss'; import { isDocked } from '@/hooks/Mapper/helpers/isDocked.ts'; import { PrimeIcons } from 'primereact/api'; interface CharactersProps { data: CharacterTypeRaw[]; } export const Characters = ({ data }: CharactersProps) => { const [parent] = useAutoAnimate(); const { data: { mainCharacterEveId, followingCharacterEveId }, } = useMapRootState(); const handleSelect = useCallback((character: CharacterTypeRaw) => { emitMapEvent({ name: Commands.centerSystem, data: character?.location?.solar_system_id?.toString(), }); }, []); const items = data.map(character => (
  • handleSelect(character)} >
    {mainCharacterEveId === character.eve_id && ( )} {followingCharacterEveId === character.eve_id && ( )} {isDocked(character.location) &&
    }
  • )); return ( ); };