diff --git a/package.json b/package.json index 072fd2939..634d46006 100644 --- a/package.json +++ b/package.json @@ -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>", diff --git a/server/src/graphql/scannerTypes.js b/server/src/graphql/scannerTypes.js index d4de60488..e6db35ff9 100644 --- a/server/src/graphql/scannerTypes.js +++ b/server/src/graphql/scannerTypes.js @@ -10,6 +10,7 @@ module.exports = gql` type: String isMad: Boolean route: JSON + radius: Int } type Gym { diff --git a/server/src/models/Device.js b/server/src/models/Device.js index 76b45f8e9..2bcdb8943 100644 --- a/server/src/models/Device.js +++ b/server/src/models/Device.js @@ -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) { diff --git a/src/components/popups/DevicePoly.jsx b/src/components/popups/DevicePoly.jsx index 13f354599..01ed77af1 100644 --- a/src/components/popups/DevicePoly.jsx +++ b/src/components/popups/DevicePoly.jsx @@ -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 ( + <> + + + + ) + } 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) => (