mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-29 04:23:22 +00:00
24 lines
703 B
TypeScript
24 lines
703 B
TypeScript
import { CharacterCard, CharacterCardProps } from '@/hooks/Mapper/components/ui-kit/CharacterCard';
|
|
import { useMapRootState } from '@/hooks/Mapper/mapRootProvider';
|
|
import { useMemo } from 'react';
|
|
|
|
type CharacterCardByIdProps = {
|
|
characterId: string;
|
|
} & Omit<CharacterCardProps, 'isOwn'>;
|
|
|
|
export const CharacterCardById = ({ characterId, ...props }: CharacterCardByIdProps) => {
|
|
const {
|
|
data: { characters },
|
|
} = useMapRootState();
|
|
|
|
const charInfo = useMemo(() => {
|
|
return characters.find(x => x.eve_id === characterId);
|
|
}, [characterId, characters]);
|
|
|
|
if (!charInfo) {
|
|
return 'No character found.';
|
|
}
|
|
|
|
return <CharacterCard isOwn={false} {...charInfo} {...props} />;
|
|
};
|