mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-13 12:46:14 +00:00
Some checks failed
Build / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build / Manual Approval (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { useMemo } from 'react';
|
|
import { SystemSignature } from '@/hooks/Mapper/types';
|
|
import { prepareUnsplashedChunks } from '@/hooks/Mapper/components/map/helpers';
|
|
|
|
export type UnsplashedSignatureType = SystemSignature & { sig_id: string };
|
|
|
|
export function useUnsplashedSignatures(systemSigs: SystemSignature[], isShowUnsplashedSignatures: boolean) {
|
|
return useMemo(() => {
|
|
if (!isShowUnsplashedSignatures) {
|
|
return {
|
|
unsplashedLeft: [] as SystemSignature[],
|
|
unsplashedRight: [] as SystemSignature[],
|
|
};
|
|
}
|
|
const chunks = prepareUnsplashedChunks(
|
|
systemSigs
|
|
.filter(s => s.group === 'Wormhole' && !s.linked_system)
|
|
.map(s => ({
|
|
eve_id: s.eve_id,
|
|
type: s.type,
|
|
custom_info: s.custom_info,
|
|
kind: s.kind,
|
|
name: s.name,
|
|
group: s.group,
|
|
})) as UnsplashedSignatureType[],
|
|
);
|
|
const [unsplashedLeft, unsplashedRight] = chunks;
|
|
return { unsplashedLeft, unsplashedRight };
|
|
}, [isShowUnsplashedSignatures, systemSigs]);
|
|
}
|