diff --git a/www/src/Pages/InputMacroAddonPage.tsx b/www/src/Pages/InputMacroAddonPage.tsx index 8852f62f7..7d5b59219 100644 --- a/www/src/Pages/InputMacroAddonPage.tsx +++ b/www/src/Pages/InputMacroAddonPage.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useMemo, useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { AppContext } from '../Contexts/AppContext'; import { Badge, Button, Col, Form, Nav, OverlayTrigger, Row, Tab, Table, Tooltip } from 'react-bootstrap'; import { Formik, useFormikContext } from 'formik'; @@ -8,7 +8,7 @@ import omit from 'lodash/omit'; import Section from '../Components/Section'; import WebApi from '../Services/WebApi'; -import { getButtonLabels, BUTTONS, BUTTON_MASKS } from '../Data/Buttons'; +import { getButtonLabels, BUTTONS, BUTTON_MASKS_OPTIONS } from '../Data/Buttons'; const MACRO_TYPES = [ { label: 'InputMacroAddon:input-macro-type.press', value: 1 }, @@ -167,7 +167,7 @@ const MacroInputComponent = (props) => { - {BUTTON_MASKS.filter(mask => buttonMask & mask.value).map((mask, i1) => + {BUTTON_MASKS_OPTIONS.filter(mask => buttonMask & mask.value).map((mask, i1) => { isInvalid={errors?.buttonMask} translation={t} buttonLabelType={buttonLabelType} - buttonMasks={BUTTON_MASKS} + buttonMasks={BUTTON_MASKS_OPTIONS} /> )} @@ -198,7 +198,7 @@ const MacroInputComponent = (props) => { isInvalid={errors?.buttonMask} translation={t} buttonLabelType={buttonLabelType} - buttonMasks={BUTTON_MASKS} + buttonMasks={BUTTON_MASKS_OPTIONS} /> @@ -407,7 +407,7 @@ const MacroComponent = (props) => { }} buttonLabelType={buttonLabelType} translation={t} - buttonMasks={BUTTON_MASKS.filter((b, i) => + buttonMasks={BUTTON_MASKS_OPTIONS.filter((b, i) => macroList.find((m, macroIdx) => index != macroIdx && m.useMacroTriggerButton && (m.macroTriggerButton === b.value) ) === undefined @@ -555,7 +555,7 @@ export default function MacrosPage() { {t(MACRO_TYPES.find((m) => m.value === macro.macroType).label)} {macro.useMacroTriggerButton==1 ? "Button" : "Pin"} {macro.useMacroTriggerButton ==0 ? --- : - {`${BUTTON_MASKS.find((b) => b.value == macro.macroTriggerButton).label}`}} + {`${BUTTON_MASKS_OPTIONS.find((b) => b.value == macro.macroTriggerButton).label}`}} {macro.macroInputs.length} {macro.enabled==true ? Enabled : Disabled} diff --git a/www/src/Pages/PinMapping.tsx b/www/src/Pages/PinMapping.tsx index 78b1caa51..5cb8cd132 100644 --- a/www/src/Pages/PinMapping.tsx +++ b/www/src/Pages/PinMapping.tsx @@ -211,7 +211,6 @@ export default function PinMapping() { useEffect(() => { fetchPins(); fetchProfiles(); - console.log('WTF'); }, []); const onBaseChange = useCallback( diff --git a/www/src/Services/WebApi.js b/www/src/Services/WebApi.js index 7524cf8cb..69f116186 100644 --- a/www/src/Services/WebApi.js +++ b/www/src/Services/WebApi.js @@ -182,8 +182,7 @@ export const baseWiiControls = { }; async function resetSettings() { - return Http - .get(`${baseUrl}/api/resetSettings`) + return Http.get(`${baseUrl}/api/resetSettings`) .then((response) => response.data) .catch(console.error); } @@ -229,8 +228,7 @@ async function setDisplayOptions(options, isPreview) { const url = !isPreview ? `${baseUrl}/api/setDisplayOptions` : `${baseUrl}/api/setPreviewDisplayOptions`; - return Http - .post(url, newOptions) + return Http.post(url, newOptions) .then((response) => { console.log(response.data); return true; @@ -251,12 +249,11 @@ async function getSplashImage() { } async function setSplashImage({ splashImage }) { - return Http - .post(`${baseUrl}/api/setSplashImage`, { - splashImage: btoa( - String.fromCharCode.apply(null, new Uint8Array(splashImage)), - ), - }) + return Http.post(`${baseUrl}/api/setSplashImage`, { + splashImage: btoa( + String.fromCharCode.apply(null, new Uint8Array(splashImage)), + ), + }) .then((response) => { return response.data; }) @@ -277,8 +274,7 @@ async function getGamepadOptions(setLoading) { } async function setGamepadOptions(options) { - return Http - .post(`${baseUrl}/api/setGamepadOptions`, sanitizeRequest(options)) + return Http.post(`${baseUrl}/api/setGamepadOptions`, sanitizeRequest(options)) .then((response) => { console.log(response.data); return true; @@ -306,8 +302,7 @@ async function getLedOptions(setLoading) { } async function setLedOptions(options) { - return Http - .post(`${baseUrl}/api/setLedOptions`, sanitizeRequest(options)) + return Http.post(`${baseUrl}/api/setLedOptions`, sanitizeRequest(options)) .then((response) => { console.log(response.data); return true; @@ -356,8 +351,7 @@ async function setCustomTheme(customThemeOptions) { }; }); - return Http - .post(`${baseUrl}/api/setCustomTheme`, sanitizeRequest(options)) + return Http.post(`${baseUrl}/api/setCustomTheme`, sanitizeRequest(options)) .then((response) => { console.log(response.data); return true; @@ -369,7 +363,7 @@ async function setCustomTheme(customThemeOptions) { } async function getPinMappingsV2() { try { - const { data } = await axios.get(`${baseUrl}/api/getPinMappingsV2`); + const { data } = await Http.get(`${baseUrl}/api/getPinMappingsV2`); return data; } catch (error) { console.log(error); @@ -377,7 +371,7 @@ async function getPinMappingsV2() { } async function setPinMappingsV2(mappings) { - return axios.post(`${baseUrl}/api/setPinMappingsV2`, mappings); + return Http.post(`${baseUrl}/api/setPinMappingsV2`, mappings); } async function getButtonLayouts(setLoading) { @@ -450,8 +444,7 @@ async function setKeyMappings(mappings) { let data = {}; Object.keys(mappings).map((button) => (data[button] = mappings[button].key)); - return Http - .post(`${baseUrl}/api/setKeyMappings`, sanitizeRequest(data)) + return Http.post(`${baseUrl}/api/setKeyMappings`, sanitizeRequest(data)) .then((response) => { console.log(response.data); return true; @@ -492,8 +485,7 @@ async function setAddonsOptions(options) { options.keyboardHostMap = data; } - return Http - .post(`${baseUrl}/api/setAddonsOptions`, sanitizeRequest(options)) + return Http.post(`${baseUrl}/api/setAddonsOptions`, sanitizeRequest(options)) .then((response) => { console.log(response.data); return true; @@ -520,8 +512,10 @@ async function getMacroAddonOptions(setLoading) { } async function setMacroAddonOptions(options) { - return Http - .post(`${baseUrl}/api/setMacroAddonOptions`, sanitizeRequest(options)) + return Http.post( + `${baseUrl}/api/setMacroAddonOptions`, + sanitizeRequest(options), + ) .then((response) => { console.log(response.data); return true; @@ -533,8 +527,7 @@ async function setMacroAddonOptions(options) { } async function setPS4Options(options) { - return Http - .post(`${baseUrl}/api/setPS4Options`, options) + return Http.post(`${baseUrl}/api/setPS4Options`, options) .then((response) => { console.log(response.data); return true; @@ -563,8 +556,7 @@ async function getWiiControls(setLoading) { async function setWiiControls(mappings) { console.dir(mappings); - return Http - .post(`${baseUrl}/api/setWiiControls`, sanitizeRequest(mappings)) + return Http.post(`${baseUrl}/api/setWiiControls`, sanitizeRequest(mappings)) .then((response) => { console.log(response.data); return true; @@ -592,8 +584,10 @@ async function getPeripheralOptions(setLoading) { async function setPeripheralOptions(mappings) { console.dir(mappings); - return Http - .post(`${baseUrl}/api/setPeripheralOptions`, sanitizeRequest(mappings)) + return Http.post( + `${baseUrl}/api/setPeripheralOptions`, + sanitizeRequest(mappings), + ) .then((response) => { console.log(response.data); return true; @@ -665,8 +659,7 @@ async function abortGetHeldPins() { } async function reboot(bootMode) { - return Http - .post(`${baseUrl}/api/reboot`, { bootMode }) + return Http.post(`${baseUrl}/api/reboot`, { bootMode }) .then((response) => response.data) .catch(console.error); }