Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactmap",
"version": "1.2.1",
"version": "1.2.2",
"description": "React based frontend map.",
"main": "ReactMap.mjs",
"author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>",
Expand Down
1 change: 1 addition & 0 deletions server/src/graphql/scannerTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = gql`
type: String
isMad: Boolean
route: JSON
radius: Int
}

type Gym {
Expand Down
2 changes: 2 additions & 0 deletions server/src/models/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module.exports = class Device extends Model {
'instance_name',
raw('json_extract(data, "$.area")')
.as('route'),
raw('json_extract(data, "$.radius")')
.as('radius'),
)
}
if (areaRestrictions.length) {
Expand Down
21 changes: 19 additions & 2 deletions src/components/popups/DevicePoly.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
/* eslint-disable react/no-array-index-key */
import React, { memo } from 'react'
import { Polyline, Polygon } from 'react-leaflet'
import { Polyline, Polygon, Circle } from 'react-leaflet'

const DevicePoly = ({ device, color }) => {
if (!device.route) return null

if (typeof device.route === 'string') {
device.route = JSON.parse(device.route)
}
if (device.type === 'leveling') {
return (
<>
<Circle
center={device.route}
pathOptions={{ color }}
/>
<Circle
center={device.route}
radius={device.radius}
pathOptions={{ color }}
/>
</>
)
}
const arrayRoute = device.route[0].lat ? [device.route] : device.route
if (Array.isArray(arrayRoute)) {
return device.type === 'circle_pokemon'
return device?.type?.includes('circle')
? arrayRoute.map((polygon, i) => (
<Polyline
key={i}
Expand Down
1 change: 1 addition & 0 deletions src/services/queries/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const getAllDevices = gql`
route
type
isMad
radius
}
}
`
Expand Down