diff --git a/package.json b/package.json index 5017cfc52..c0a48b3b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reactmap", - "version": "1.6.5", + "version": "1.6.6", "description": "React based frontend map.", "main": "ReactMap.js", "author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>", @@ -113,7 +113,7 @@ "react-virtualized-auto-sizer": "^1.0.5", "react-window": "^1.8.6", "require-from-string": "^2.0.2", - "suncalc": "^1.8.0", + "suncalc": "^1.9.0", "zustand": "^4.0.0-rc.1" } } \ No newline at end of file diff --git a/src/components/Clustering.jsx b/src/components/Clustering.jsx index 03bc11b1c..15e71c4d2 100644 --- a/src/components/Clustering.jsx +++ b/src/components/Clustering.jsx @@ -21,7 +21,7 @@ export default function Clustering({ config, userIcons, setParams, - isNight, + timeOfDay, onlyAreas, }) { const Component = index[category] @@ -59,7 +59,7 @@ export default function Clustering({ params={params} setParams={setParams} showCircles={showCircles} - isNight={isNight} + timeOfDay={timeOfDay} onlyAreas={onlyAreas} /> ) diff --git a/src/components/Map.jsx b/src/components/Map.jsx index e6228e141..b84cb9177 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -27,14 +27,15 @@ const userSettingsCategory = (category) => { } } -const getTileServer = (tileServers, settings, isNight) => { +const getTileServer = (tileServers, settings, timeOfDay) => { const fallbackTs = Object.values(tileServers).find( (server) => server.name !== 'auto', ) if (tileServers?.[settings.tileServers]?.name === 'auto') { - const autoTile = isNight - ? Object.values(tileServers).find((server) => server.style === 'dark') - : Object.values(tileServers).find((server) => server.style === 'light') + const autoTile = + timeOfDay === 'night' + ? Object.values(tileServers).find((server) => server.style === 'dark') + : Object.values(tileServers).find((server) => server.style === 'light') return autoTile || fallbackTs } return tileServers[settings.tileServers] || fallbackTs @@ -68,8 +69,8 @@ export default function Map({ const settings = useStore((state) => state.settings) const icons = useStore((state) => state.icons) const setLocation = useStore((s) => s.setLocation) - const isNight = useStatic((state) => state.isNight) - const setIsNight = useStatic((state) => state.setIsNight) + const timeOfDay = useStatic((state) => state.timeOfDay) + const setTimeOfDay = useStatic((state) => state.setTimeOfDay) const setZoom = useStore((state) => state.setZoom) const userSettings = useStore((state) => state.userSettings) @@ -93,14 +94,14 @@ export default function Map({ const newCenter = latLon || map.getCenter() setLocation([newCenter.lat, newCenter.lng]) setZoom(Math.floor(map.getZoom())) - setIsNight(Utility.nightCheck(newCenter.lat, newCenter.lng)) + setTimeOfDay(Utility.timeCheck(newCenter.lat, newCenter.lng)) }, [map], ) const tileServer = useMemo( - () => getTileServer(tileServers, settings, isNight), - [isNight, settings.tileServers], + () => getTileServer(tileServers, settings, timeOfDay), + [timeOfDay, settings.tileServers], ) const onFocus = () => setWindowState(true) @@ -142,6 +143,7 @@ export default function Map({ key={tileServer?.name} attribution={tileServer?.attribution || ''} url={ + tileServer?.[timeOfDay] || tileServer?.url || 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png' } @@ -262,7 +264,7 @@ export default function Map({ staticUserSettings={staticUserSettings[category]} params={manualParams} setParams={setManualParams} - isNight={isNight} + timeOfDay={timeOfDay} isMobile={isMobile} setError={setError} active={active} diff --git a/src/components/QueryData.jsx b/src/components/QueryData.jsx index 85c419797..915e6895b 100644 --- a/src/components/QueryData.jsx +++ b/src/components/QueryData.jsx @@ -29,7 +29,7 @@ export default function QueryData({ Icons, userIcons, setParams, - isNight, + timeOfDay, setExcludeList, setError, active, @@ -151,13 +151,13 @@ export default function QueryData({ staticUserSettings={staticUserSettings} params={params} setParams={setParams} - isNight={isNight} + timeOfDay={timeOfDay} onlyAreas={onlyAreas} /> {category === 'weather' && ( {active.gameplay_condition} { const { pokemon: pokemonMod, weather: weatherMod } = Icons.modifiers let badge @@ -99,7 +99,7 @@ export const fancyMarker = ( }} > {pkmn.weather}