File tree Expand file tree Collapse file tree 5 files changed +24
-3
lines changed
Expand file tree Collapse file tree 5 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " reactmap" ,
3- "version" : " 1.2.1 " ,
3+ "version" : " 1.2.2 " ,
44 "description" : " React based frontend map." ,
55 "main" : " ReactMap.mjs" ,
66 "author" :
" TurtIeSocks <[email protected] >" ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ module.exports = gql`
1010 type: String
1111 isMad: Boolean
1212 route: JSON
13+ radius: Int
1314 }
1415
1516 type Gym {
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ module.exports = class Device extends Model {
3636 'instance_name' ,
3737 raw ( 'json_extract(data, "$.area")' )
3838 . as ( 'route' ) ,
39+ raw ( 'json_extract(data, "$.radius")' )
40+ . as ( 'radius' ) ,
3941 )
4042 }
4143 if ( areaRestrictions . length ) {
Original file line number Diff line number Diff line change 11/* eslint-disable react/no-array-index-key */
22import React , { memo } from 'react'
3- import { Polyline , Polygon } from 'react-leaflet'
3+ import { Polyline , Polygon , Circle } from 'react-leaflet'
44
55const DevicePoly = ( { device, color } ) => {
6+ if ( ! device . route ) return null
7+
68 if ( typeof device . route === 'string' ) {
79 device . route = JSON . parse ( device . route )
810 }
11+ if ( device . type === 'leveling' ) {
12+ return (
13+ < >
14+ < Circle
15+ center = { device . route }
16+ pathOptions = { { color } }
17+ />
18+ < Circle
19+ center = { device . route }
20+ radius = { device . radius }
21+ pathOptions = { { color } }
22+ />
23+ </ >
24+ )
25+ }
926 const arrayRoute = device . route [ 0 ] . lat ? [ device . route ] : device . route
1027 if ( Array . isArray ( arrayRoute ) ) {
11- return device . type === 'circle_pokemon'
28+ return device ? .type ?. includes ( 'circle' )
1229 ? arrayRoute . map ( ( polygon , i ) => (
1330 < Polyline
1431 key = { i }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const getAllDevices = gql`
1111 route
1212 type
1313 isMad
14+ radius
1415 }
1516 }
1617`
You can’t perform that action at this time.
0 commit comments