mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
25 lines
678 B
TypeScript
25 lines
678 B
TypeScript
import { selectTgos } from "../../api/tgosSlice";
|
|
import { useAppSelector } from "../../app/hooks";
|
|
import Tgo from "../tgos/Tgo";
|
|
import { LayerGroup } from "react-leaflet";
|
|
|
|
interface TgosLayerProps {
|
|
categories?: string[];
|
|
exclude?: true;
|
|
}
|
|
|
|
export default function TgosLayer(props: TgosLayerProps) {
|
|
const allTgos = Object.values(useAppSelector(selectTgos).tgos);
|
|
const categoryFilter = props.categories ?? [];
|
|
const tgos = allTgos.filter(
|
|
(tgo) => categoryFilter.includes(tgo.category) === (props.exclude ?? false)
|
|
);
|
|
return (
|
|
<LayerGroup>
|
|
{tgos.map((tgo) => {
|
|
return <Tgo key={tgo.name} tgo={tgo} />;
|
|
})}
|
|
</LayerGroup>
|
|
);
|
|
}
|