From 18c11a0aa9f0da76c3a250fc506ad3a6d40de3eb Mon Sep 17 00:00:00 2001 From: LocalNewsTV <62873746+LocalNewsTV@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:17:16 -0800 Subject: [PATCH] Prune code in Records.tsx --- app/src/UI/Overlay/Records/Records.tsx | 33 +------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/app/src/UI/Overlay/Records/Records.tsx b/app/src/UI/Overlay/Records/Records.tsx index 457501bca..7a2b318ad 100644 --- a/app/src/UI/Overlay/Records/Records.tsx +++ b/app/src/UI/Overlay/Records/Records.tsx @@ -1,9 +1,7 @@ import { MouseEvent, useEffect, useState } from 'react'; - import { Button } from '@mui/material'; import './Records.css'; import { OverlayHeader } from '../OverlayHeader'; -import Spinner from 'UI/Spinner/Spinner'; import { useHistory } from 'react-router-dom'; import { useDispatch, useSelector } from 'utils/use_selector'; import UserSettings from 'state/actions/userSettings/UserSettings'; @@ -16,15 +14,9 @@ import filterRecordsetsByNetworkState from 'utils/filterRecordsetsByNetworkState export const Records = () => { const DEFAULT_RECORD_TYPES = ['All InvasivesBC Activities', 'All IAPP Records', 'My Drafts']; - const activitiesGeoJSONState = useSelector((state) => state.Map?.activitiesGeoJSONDict); - const isIAPPGeoJSONLoaded = useSelector((state) => state.Map?.IAPPGeoJSONDict !== undefined); - const mapLayers = useSelector((state) => state.Map.layers); - const MapMode = useSelector((state) => state.Map.MapMode); const recordSets = useSelector((state) => state.UserSettings?.recordSets); const connected = useSelector((state) => state.Network.connected); const [highlightedSet, setHighlightedSet] = useState(); - const [isActivitiesGeoJSONLoaded, setIsActivitiesGeoJSONLoaded] = useState(false); - const [loadMap, setLoadMap] = useState({}); const history = useHistory(); const dispatch = useDispatch(); @@ -37,23 +29,6 @@ export const Records = () => { dispatch(UserSettings.RecordSet.syncCacheStatusWithCacheService()); }, []); - useEffect(() => { - setIsActivitiesGeoJSONLoaded(activitiesGeoJSONState.hasOwnProperty('s3')); - }, [activitiesGeoJSONState]); - - useEffect(() => { - const rv = {}; - mapLayers.forEach((layer) => { - const geojson = layer?.type === RecordSetType.Activity ? isActivitiesGeoJSONLoaded : isIAPPGeoJSONLoaded; - if (MapMode !== 'VECTOR_ENDPOINT') { - rv[layer?.recordSetID] = !layer?.loading && geojson; - } else { - rv[layer?.recordSetID] = !layer?.loading; - } - }); - setLoadMap(rv); - }, [JSON.stringify(mapLayers), isActivitiesGeoJSONLoaded, isIAPPGeoJSONLoaded, MapMode]); - //Record set handlers: const handleToggleLabel = (set: string, e: MouseEvent) => { e.stopPropagation(); @@ -116,13 +91,7 @@ export const Records = () => { isDefaultRecordset={DEFAULT_RECORD_TYPES.includes(recordSets[set]?.recordSetName)} handleNameChange={handleNameChange} recordsetKey={set} - > - {!loadMap?.[set] && ( -
- -
- )} - + >