From 5129c6bee375bf0cbe0510feab80e86a6ff7a2b5 Mon Sep 17 00:00:00 2001 From: TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com> Date: Mon, 25 Apr 2022 19:05:22 -0400 Subject: [PATCH] Clickable Weather - Zoomed in weather icon is now clickable - Toggleable in the weather user options - Defaults to false - Also fixes the error page redirect --- public/base-locales/en.json | 4 +- server/src/configs/default.json | 3 + server/src/services/ui/clientOptions.js | 3 + src/components/Errors.jsx | 16 +---- src/components/QueryData.jsx | 1 + src/components/layout/dialogs/UserOptions.jsx | 2 +- .../layout/general/ActiveWeather.jsx | 71 ++++++++++++------- 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/public/base-locales/en.json b/public/base-locales/en.json index aa3bca73f..b07c3119c 100644 --- a/public/base-locales/en.json +++ b/public/base-locales/en.json @@ -178,6 +178,7 @@ "nests_options": "Nest Options", "wayfarer_options": "Wayfarer Options", "admin_options": "Admin Options", + "weather_options": "Weather Options", "clustering": "Clustering", "glow": "Glow", "legacy_filter": "Legacy Filter", @@ -533,5 +534,6 @@ "points": "Points", "day": "Day", "days": "Days", - "react_error": "Something Went Wrong" + "react_error": "Something Went Wrong", + "clickable_icon": "Icon is Clickable" } diff --git a/server/src/configs/default.json b/server/src/configs/default.json index f7f8d48f8..eeb09204a 100644 --- a/server/src/configs/default.json +++ b/server/src/configs/default.json @@ -259,6 +259,9 @@ "clustering": true, "oldPortals": "#0000ff", "newPortals": "#16b819" + }, + "weather": { + "clickableIcon": false } }, "defaultFilters": { diff --git a/server/src/services/ui/clientOptions.js b/server/src/services/ui/clientOptions.js index 3888d294b..0dc12e8f8 100644 --- a/server/src/services/ui/clientOptions.js +++ b/server/src/services/ui/clientOptions.js @@ -44,6 +44,9 @@ module.exports = function clientOptions(perms) { oldPortals: { type: 'color', perm: ['portals'] }, newPortals: { type: 'color', perm: ['portals'] }, }, + weather: { + clickableIcon: { type: 'bool', perm: ['weather'] }, + }, } levels.forEach(level => { diff --git a/src/components/Errors.jsx b/src/components/Errors.jsx index 8efaeea21..51b7ae6b7 100644 --- a/src/components/Errors.jsx +++ b/src/components/Errors.jsx @@ -1,7 +1,6 @@ import React from 'react' import { Grid, Typography, Button } from '@material-ui/core' import { useTranslation } from 'react-i18next' -import LinkWrapper from './layout/custom/LinkWrapper' export default function Errors() { const { t } = useTranslation() @@ -26,18 +25,9 @@ export default function Errors() { - - {t('go_back')} - - )} - /> + ) diff --git a/src/components/QueryData.jsx b/src/components/QueryData.jsx index 94372cedb..d8ebeb643 100644 --- a/src/components/QueryData.jsx +++ b/src/components/QueryData.jsx @@ -156,6 +156,7 @@ export default function QueryData({ weather={renderedData[category]} isMobile={isMobile} zoom={config.activeWeatherZoom} + clickable={userSettings.clickableIcon} map={map} /> )} diff --git a/src/components/layout/dialogs/UserOptions.jsx b/src/components/layout/dialogs/UserOptions.jsx index 128a481e0..295da34a8 100644 --- a/src/components/layout/dialogs/UserOptions.jsx +++ b/src/components/layout/dialogs/UserOptions.jsx @@ -97,7 +97,7 @@ export default function UserOptions({ category, toggleDialog, isMobile }) { return ( <>
diff --git a/src/components/layout/general/ActiveWeather.jsx b/src/components/layout/general/ActiveWeather.jsx index f24e55fb1..d1e8b7b82 100644 --- a/src/components/layout/general/ActiveWeather.jsx +++ b/src/components/layout/general/ActiveWeather.jsx @@ -1,41 +1,62 @@ -import React from 'react' +/* eslint-disable jsx-a11y/no-static-element-interactions */ +import React, { Fragment, useState } from 'react' +import { Dialog, DialogContent } from '@material-ui/core' import booleanPointInPolygon from '@turf/boolean-point-in-polygon' import { point, polygon } from '@turf/helpers' import { useStore } from '@hooks/useStore' +import WeatherPopup from '@components/popups/Weather' +import Header from './Header' +import Footer from './Footer' -export default function ActiveWeather({ Icons, isNight, map, zoom, weather, isMobile }) { +export default function ActiveWeather({ Icons, isNight, map, zoom, weather, isMobile, clickable }) { const location = useStore(state => state.location) + const [open, setOpen] = useState(false) + const { disableColorShift = false } = Icons.getModifiers('weather') const active = weather.find( cell => cell && booleanPointInPolygon(point(location), polygon([cell.polygon])), ) return active?.gameplay_condition && map.getZoom() > zoom ? ( -
- {active.gameplay_condition} +
setOpen(Boolean(clickable))} style={{ - width: isMobile ? 24 : 36, - height: isMobile ? 24 : 36, + zIndex: 1000, + position: 'absolute', + top: 20, + right: 20, + height: isMobile ? 36 : 50, + width: isMobile ? 36 : 50, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', }} - /> -
+ > + {active.gameplay_condition} +
+ setOpen(false)} maxWidth="xs"> +
setOpen(false)} /> + + + +
+ ) : null }