Skip to content

Commit 35bea36

Browse files
committed
feat: station interactionRanges
Also changes pokemon interactionRanges color to green to disambiguate. Fixes #1086.
1 parent a7ff8b0 commit 35bea36

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

server/src/ui/clientOptions.js

+5
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ function clientOptions(perms) {
135135
perm: ['stations', 'dynamax'],
136136
category: 'tooltips',
137137
},
138+
interactionRanges: {
139+
type: 'bool',
140+
perm: ['stations', 'dynamax'],
141+
category: 'markers',
142+
},
138143
stationsOpacity: {
139144
type: 'bool',
140145
perm: ['stations', 'dynamax'],

src/features/pokemon/PokemonTile.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ const BasePokemonTile = (pkmn) => {
219219
<Circle
220220
center={finalLocation}
221221
radius={80}
222-
color="#E3B3FB"
222+
color="#4E893E"
223223
dashArray="5, 5"
224224
weight={1}
225225
/>

src/features/station/StationTile.jsx

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* eslint-disable react/destructuring-assignment */
22
// @ts-check
33
import * as React from 'react'
4-
import { Marker, Popup } from 'react-leaflet'
4+
import { Circle, Marker, Popup } from 'react-leaflet'
55

66
import { useMarkerTimer } from '@hooks/useMarkerTimer'
7-
import { useMemory } from '@store/useMemory'
7+
import { basicEqualFn, useMemory } from '@store/useMemory'
88
import { useStorage } from '@store/useStorage'
99
import { useForcePopup } from '@hooks/useForcePopup'
1010
import { TooltipWrapper } from '@components/ToolTipWrapper'
@@ -21,11 +21,18 @@ const BaseStationTile = (station) => {
2121
const [stateChange, setStateChange] = React.useState(false)
2222
const [markerRef, setMarkerRef] = React.useState(null)
2323

24-
const individualTimer = useMemory((s) => s.timerList.includes(station.id))
24+
const [individualTimer, interactionRangeZoom] = useMemory((s) => {
25+
const { config, timerList } = s
26+
return [timerList.includes(station.id), config.general.interactionRangeZoom]
27+
}, basicEqualFn)
2528

26-
const showTimer = useStorage(
27-
(s) => s?.userSettings?.stations?.stationTimers || individualTimer,
28-
)
29+
const [showTimer, showInteractionRange] = useStorage((s) => {
30+
const { userSettings, zoom } = s
31+
return [
32+
userSettings.stations.stationTimers || individualTimer,
33+
!!userSettings.stations.interactionRanges && zoom >= interactionRangeZoom,
34+
]
35+
}, basicEqualFn)
2936

3037
const timers = React.useMemo(() => {
3138
const now = Date.now() / 1000
@@ -55,6 +62,14 @@ const BaseStationTile = (station) => {
5562
{!!(showTimer && timers.length > 0) && (
5663
<TooltipWrapper timers={timers} offset={[0, 4]} />
5764
)}
65+
{showInteractionRange && (
66+
<Circle
67+
center={[station.lat, station.lon]}
68+
radius={80}
69+
color="#EE94F7"
70+
weight={0.5}
71+
/>
72+
)}
5873
</Marker>
5974
)
6075
}

0 commit comments

Comments
 (0)