From 2462154628d52e86f780c02c3c3058b97ffffc11 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 18 Mar 2024 12:11:18 -0700 Subject: [PATCH] Refactor SpecialModifiers component to finish fixing an issue where OSM shift keys weren't editable after save - Updated `isInCategory` checks to use `key.code` for consistency in `SpecialModifiers.js` - Simplified `isModifier` check and used it to streamline the disabled condition for the OneShot switch Fixes #1299 --- .../screens/Editor/Sidebar/SpecialModifiers.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/renderer/screens/Editor/Sidebar/SpecialModifiers.js b/src/renderer/screens/Editor/Sidebar/SpecialModifiers.js index b4fba53c0..ce9a9ad8c 100644 --- a/src/renderer/screens/Editor/Sidebar/SpecialModifiers.js +++ b/src/renderer/screens/Editor/Sidebar/SpecialModifiers.js @@ -34,9 +34,9 @@ export const SpecialModifiers = (props) => { const { currentKey: key } = props; let isChecked = false; if (mod === "oneshot") { - isChecked = db.isInCategory(key, mod); + isChecked = db.isInCategory(key.code, mod); } else { - isChecked = db.isInCategory(key, mod) && !db.isInCategory(key.code, "dualuse"); + isChecked = db.isInCategory(key.code, mod) && !db.isInCategory(key.code, "dualuse"); } return ; }; @@ -47,7 +47,7 @@ export const SpecialModifiers = (props) => { const isShifted = db.isInCategory(key.code, "shift"); const isTopsyTurvy = db.isInCategory(key.code, "topsyturvy"); const isMod = (key, mod) => key.baseCode == mod || key.code == mod; - + const isModifier = db.isInCategory(key.baseCode || key.code, "modifier"); const c = db.constants.codes; const topsyTurvyAvailable = usePluginAvailable("TopsyTurvy"); @@ -74,11 +74,7 @@ export const SpecialModifiers = (props) => {