Update the react map for some new events.

This commit is contained in:
Dan Albert
2022-03-03 23:31:07 -08:00
parent 4539e91fa9
commit 92236a5bc3
16 changed files with 145 additions and 65 deletions

View File

@@ -1,16 +1,19 @@
import { LayerGroup } from "react-leaflet";
import Tgo from "../tgos/Tgo";
import { TgoType } from "../../api/tgo";
import { selectTgos } from "../../api/tgosSlice";
import { useAppSelector } from "../../app/hooks";
interface TgosLayerProps {
type: TgoType;
categories?: string[];
exclude?: true;
}
export default function TgosLayer(props: TgosLayerProps) {
const allTgos = useAppSelector(selectTgos);
const tgos = allTgos.tgosByType[props.type];
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) => {