From 27b66aa7800b49382adfcc96d5a6c97619e7a7bc Mon Sep 17 00:00:00 2001 From: Raphael Paul Laude Date: Fri, 25 Oct 2024 09:15:07 -0400 Subject: [PATCH 1/3] should disable shatter button if not shatterable map --- app/src/app/components/sidebar/MapModeSelector.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/app/components/sidebar/MapModeSelector.jsx b/app/src/app/components/sidebar/MapModeSelector.jsx index 2938f8b7..ed1d5fe4 100644 --- a/app/src/app/components/sidebar/MapModeSelector.jsx +++ b/app/src/app/components/sidebar/MapModeSelector.jsx @@ -14,15 +14,21 @@ import { RecentMapsModal } from "@components/sidebar/RecentMapsModal"; export function MapModeSelector() { const activeTool = useMapStore((state) => state.activeTool); const setActiveTool = useMapStore((state) => state.setActiveTool); + const mapDocument = useMapStore((state) => state.mapDocument); if (!activeTool) return null; const activeTools = [ { mode: "pan", disabled: false, label: "Pan", icon: }, { mode: "brush", disabled: false, label: "Brush", icon: }, - { mode: "eraser", disabled: false, label: "Erase", icon: }, { - mode: "shatter", + mode: "eraser", disabled: false, + label: "Erase", + icon: , + }, + { + mode: "shatter", + disabled: !mapDocument.child_layer, label: "Shatter", icon: , }, From f264c8b74268c4f8e668e90e555e24ee7446ab54 Mon Sep 17 00:00:00 2001 From: Raphael Paul Laude Date: Fri, 25 Oct 2024 09:17:10 -0400 Subject: [PATCH 2/3] update formatting --- app/src/app/components/sidebar/MapModeSelector.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/app/components/sidebar/MapModeSelector.jsx b/app/src/app/components/sidebar/MapModeSelector.jsx index ed1d5fe4..ea883f35 100644 --- a/app/src/app/components/sidebar/MapModeSelector.jsx +++ b/app/src/app/components/sidebar/MapModeSelector.jsx @@ -20,12 +20,7 @@ export function MapModeSelector() { const activeTools = [ { mode: "pan", disabled: false, label: "Pan", icon: }, { mode: "brush", disabled: false, label: "Brush", icon: }, - { - mode: "eraser", - disabled: false, - label: "Erase", - icon: , - }, + { mode: "eraser", disabled: false, label: "Erase", icon: }, { mode: "shatter", disabled: !mapDocument.child_layer, From e0af5520cee2da8536a5fedcf1c28391380d005c Mon Sep 17 00:00:00 2001 From: Raphael Paul Laude Date: Fri, 25 Oct 2024 12:10:08 -0400 Subject: [PATCH 3/3] handle null mapdocument --- app/src/app/components/sidebar/MapModeSelector.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/app/components/sidebar/MapModeSelector.jsx b/app/src/app/components/sidebar/MapModeSelector.jsx index ea883f35..d2dcd2b4 100644 --- a/app/src/app/components/sidebar/MapModeSelector.jsx +++ b/app/src/app/components/sidebar/MapModeSelector.jsx @@ -23,7 +23,7 @@ export function MapModeSelector() { { mode: "eraser", disabled: false, label: "Erase", icon: }, { mode: "shatter", - disabled: !mapDocument.child_layer, + disabled: !mapDocument?.child_layer, label: "Shatter", icon: , },