From 9f2ab861bbef88ebc136f42194ce9ee9e9960394 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sun, 28 Jun 2020 15:44:36 +1000 Subject: [PATCH] Fixed bug with token and map settings modal values being edited with no item selected --- src/components/map/MapSettings.js | 28 ++++++++++++++++----------- src/components/token/TokenSettings.js | 11 ++++++----- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/components/map/MapSettings.js b/src/components/map/MapSettings.js index 79c6742..bfabeec 100644 --- a/src/components/map/MapSettings.js +++ b/src/components/map/MapSettings.js @@ -26,6 +26,9 @@ function MapSettings({ } } + const mapEmpty = !map || isEmpty(map); + const mapStateEmpty = !mapState || isEmpty(mapState); + return ( @@ -38,7 +41,7 @@ function MapSettings({ onChange={(e) => onSettingsChange("gridX", parseInt(e.target.value)) } - disabled={!map || map.type === "default"} + disabled={mapEmpty || map.type === "default"} min={1} my={1} /> @@ -52,7 +55,7 @@ function MapSettings({ onChange={(e) => onSettingsChange("gridY", parseInt(e.target.value)) } - disabled={!map || map.type === "default"} + disabled={mapEmpty || map.type === "default"} min={1} my={1} /> @@ -66,7 +69,7 @@ function MapSettings({ name="name" value={(map && map.name) || ""} onChange={(e) => onSettingsChange("name", e.target.value)} - disabled={!map || map.type === "default"} + disabled={mapEmpty || map.type === "default"} my={1} /> @@ -74,7 +77,7 @@ function MapSettings({