diff --git a/www/package-lock.json b/www/package-lock.json index 566420bb5..46608c9fb 100644 --- a/www/package-lock.json +++ b/www/package-lock.json @@ -1219,10 +1219,11 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.1.tgz", - "integrity": "sha512-X+2qazGS3jxLAIz5JDXDzglAF3KpijdhFxlf/V1+hEsOUc+HnWi81L/uv/EvGuV90WY+7mPGFCUDGfQC3Gj95Q==", - "dev": true + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==", + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { "version": "20.5.9", diff --git a/www/server/app.js b/www/server/app.js index 2da7b59f6..e15b278f4 100644 --- a/www/server/app.js +++ b/www/server/app.js @@ -253,6 +253,18 @@ app.get('/api/getCustomTheme', (req, res) => { }); }); +app.get('/api/getPinMappingsV2', (req, res) => { + return res.send( + Object.entries(picoController).reduce( + (acc, [key, value]) => ({ + ...acc, + [key]: { action: value, customButtonMask: 0, customDpadMask: 0 }, + }), + {}, + ), + ); +}); + app.get('/api/getPinMappings', (req, res) => { return res.send(picoController); }); diff --git a/www/src/Addons/Bootsel.tsx b/www/src/Addons/Bootsel.tsx index 42d08aa33..1ff8a461d 100644 --- a/www/src/Addons/Bootsel.tsx +++ b/www/src/Addons/Bootsel.tsx @@ -5,7 +5,7 @@ import * as yup from 'yup'; import Section from '../Components/Section'; import FormSelect from '../Components/FormSelect'; -import { BUTTON_MASKS } from '../Data/Buttons'; +import { BUTTON_MASKS_OPTIONS } from '../Data/Buttons'; export const bootselScheme = { BootselButtonAddonEnabled: yup @@ -15,7 +15,10 @@ export const bootselScheme = { bootselButtonMap: yup .number() .label('BOOTSEL Button Map') - .validateSelectionWhenValue('BootselButtonAddonEnabled', BUTTON_MASKS), + .validateSelectionWhenValue( + 'BootselButtonAddonEnabled', + BUTTON_MASKS_OPTIONS, + ), }; export const bootselState = { @@ -42,7 +45,7 @@ const Bootsel = ({ values, errors, handleChange, handleCheckbox }) => { isInvalid={errors.bootselButtonMap} onChange={handleChange} > - {BUTTON_MASKS.map((o, i) => ( + {BUTTON_MASKS_OPTIONS.map((o, i) => ( diff --git a/www/src/Addons/FocusMode.tsx b/www/src/Addons/FocusMode.tsx index a8a40c428..ac444fb8e 100644 --- a/www/src/Addons/FocusMode.tsx +++ b/www/src/Addons/FocusMode.tsx @@ -7,7 +7,7 @@ import Section from '../Components/Section'; import FormControl from '../Components/FormControl'; import FormSelect from '../Components/FormSelect'; -import { BUTTON_MASKS } from '../Data/Buttons'; +import { BUTTON_MASKS_OPTIONS } from '../Data/Buttons'; export const focusModeScheme = { FocusModeAddonEnabled: yup @@ -93,7 +93,7 @@ const FocusMode = ({ /> - {BUTTON_MASKS.map((mask) => + {BUTTON_MASKS_OPTIONS.map((mask) => values.focusModeButtonLockMask & mask.value ? ( - {BUTTON_MASKS.map((o, i) => ( + {BUTTON_MASKS_OPTIONS.map((o, i) => ( + ); } diff --git a/www/src/Pages/SettingsPage.jsx b/www/src/Pages/SettingsPage.jsx index 04fcb66d4..7819da86d 100644 --- a/www/src/Pages/SettingsPage.jsx +++ b/www/src/Pages/SettingsPage.jsx @@ -11,7 +11,7 @@ import { AppContext } from '../Contexts/AppContext'; import KeyboardMapper, { validateMappings } from '../Components/KeyboardMapper'; import Section from '../Components/Section'; import WebApi, { baseButtonMappings } from '../Services/WebApi'; -import { BUTTON_MASKS, getButtonLabels } from '../Data/Buttons'; +import { BUTTON_MASKS_OPTIONS, getButtonLabels } from '../Data/Buttons'; import './SettingsPage.scss'; @@ -1350,7 +1350,7 @@ export default function SettingsPage() { + - {BUTTON_MASKS.map((mask) => + {BUTTON_MASKS_OPTIONS.map((mask) => values[o] && values[o]?.buttonsMask & mask.value ? ( <> @@ -1377,7 +1377,7 @@ export default function SettingsPage() { ); }} > - {BUTTON_MASKS.map((o, i2) => ( + {BUTTON_MASKS_OPTIONS.map((o, i2) => (