From 75e8ec111c4756c0656ca7bafe5bd76d8a442480 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Sun, 14 Mar 2021 20:33:09 -0400 Subject: [PATCH] Add Submission Cells - Add ability to see submission cells - Refactor bounds variable --- client/src/components/MapTiles.jsx | 26 +++--- client/src/components/gyms/Gym.jsx | 7 +- client/src/components/layout/Drawer.jsx | 2 +- client/src/components/pokemon/Pokemon.jsx | 7 +- client/src/components/pokestops/Pokestop.jsx | 7 +- client/src/components/portals/Portal.jsx | 13 +-- client/src/components/s2Cell/S2Cell.jsx | 7 +- .../src/components/spawnpoints/Spawnpoint.jsx | 13 +-- .../src/components/submissionCells/Popup.jsx | 30 +++++++ .../submissionCells/SubmissionCells.jsx | 80 +++++++++++++++++++ .../components/submissionCells/data/Ring.js | 10 +++ .../submissionCells/data/getPlacementCells.js | 47 +++++++++++ .../submissionCells/data/getTypeCells.js | 53 ++++++++++++ .../submissionCells/placementStyle.js | 9 +++ .../components/submissionCells/typeStyle.js | 11 +++ client/src/components/weather/Weather.jsx | 7 +- client/src/services/Query.js | 6 ++ client/src/services/data/submissionCells.js | 18 +++++ 18 files changed, 293 insertions(+), 60 deletions(-) create mode 100644 client/src/components/submissionCells/Popup.jsx create mode 100644 client/src/components/submissionCells/SubmissionCells.jsx create mode 100644 client/src/components/submissionCells/data/Ring.js create mode 100644 client/src/components/submissionCells/data/getPlacementCells.js create mode 100644 client/src/components/submissionCells/data/getTypeCells.js create mode 100644 client/src/components/submissionCells/placementStyle.js create mode 100644 client/src/components/submissionCells/typeStyle.js create mode 100644 client/src/services/data/submissionCells.js diff --git a/client/src/components/MapTiles.jsx b/client/src/components/MapTiles.jsx index 66921d38f..5ff16b54d 100644 --- a/client/src/components/MapTiles.jsx +++ b/client/src/components/MapTiles.jsx @@ -9,17 +9,14 @@ import Spawnpoint from './spawnpoints/Spawnpoint.jsx' import Portal from './portals/Portal.jsx' import Weather from './weather/Weather.jsx' import S2Cell from './s2Cell/S2Cell.jsx' +import SubmissionCell from './submissionCells/SubmissionCells.jsx' const MapTiles = ({ map, settings }) => { const [bounds, setBounds] = useState({ - _southWest: { - lat: settings.map.startLat - 0.025, - lng: settings.map.startLon - 0.025 - }, - _northEast: { - lat: settings.map.startLat + 0.025, - lng: settings.map.startLon + 0.025 - } + minLat: settings.map.startLat - 0.025, + maxLat: settings.map.startLat + 0.025, + minLon: settings.map.startLon - 0.025, + maxLon: settings.map.startLon + 0.025 }) const [selected, setSelected] = useState({ gyms: settings.map.filters.gyms, @@ -31,14 +28,20 @@ const MapTiles = ({ map, settings }) => { pokemon: settings.map.filters.pokemon, portals: settings.map.filters.portals, scanCells: settings.map.filters.scanCells, - s2Cells: settings.map.filters.submissionCells, + submissionCells: settings.map.filters.submissionCells, weather: settings.map.filters.weather, scanAreas: settings.map.filters.scanAreas, devices: settings.map.filters.devices }) const onMove = useCallback(() => { - setBounds(map.getBounds()) + const mapBounds = map.getBounds() + setBounds({ + minLat: mapBounds._southWest.lat - 0.01, + maxLat: mapBounds._northEast.lat + 0.01, + minLon: mapBounds._southWest.lng - 0.01, + maxLon: mapBounds._northEast.lng + 0.01 + }) }, [map]) useEffect(() => { @@ -60,7 +63,8 @@ const MapTiles = ({ map, settings }) => { {selected.pokestops && } {selected.pokemon && } {selected.portals && } - {selected.s2Cells && } + {selected.scanCells && } + {selected.submissionCells && } {selected.spawnpoints && } {selected.weather && }