Skip to content

Commit

Permalink
Fix merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pelsin committed May 4, 2024
1 parent 12ed309 commit 2f0892f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 40 deletions.
14 changes: 7 additions & 7 deletions www/src/Pages/InputMacroAddonPage.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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 },
Expand Down Expand Up @@ -167,7 +167,7 @@ const MacroInputComponent = (props) => {
</Col>
<Col sm={"auto"}>
<Row className="d-flex justify-content-center">
{BUTTON_MASKS.filter(mask => buttonMask & mask.value).map((mask, i1) =>
{BUTTON_MASKS_OPTIONS.filter(mask => buttonMask & mask.value).map((mask, i1) =>
<Col key={`${key}.buttonMask[${i1}]`} sm={"auto"} className="px-1">
<ButtonMasksComponent
id={`${key}.buttonMask[${i1}]`}
Expand All @@ -182,7 +182,7 @@ const MacroInputComponent = (props) => {
isInvalid={errors?.buttonMask}
translation={t}
buttonLabelType={buttonLabelType}
buttonMasks={BUTTON_MASKS}
buttonMasks={BUTTON_MASKS_OPTIONS}
/>
</Col>
)}
Expand All @@ -198,7 +198,7 @@ const MacroInputComponent = (props) => {
isInvalid={errors?.buttonMask}
translation={t}
buttonLabelType={buttonLabelType}
buttonMasks={BUTTON_MASKS}
buttonMasks={BUTTON_MASKS_OPTIONS}
/>
</Col>
</Row>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -555,7 +555,7 @@ export default function MacrosPage() {
<td>{t(MACRO_TYPES.find((m) => m.value === macro.macroType).label)}</td>
<td>{macro.useMacroTriggerButton==1 ? "Button" : "Pin"}</td>
{macro.useMacroTriggerButton ==0 ? <td><em>---</em></td> :
<td>{`${BUTTON_MASKS.find((b) => b.value == macro.macroTriggerButton).label}`}</td>}
<td>{`${BUTTON_MASKS_OPTIONS.find((b) => b.value == macro.macroTriggerButton).label}`}</td>}
<td>{macro.macroInputs.length}</td>
<td>{macro.enabled==true ? <Badge bg="success">Enabled</Badge> : <Badge bg="danger">Disabled</Badge>}</td>
</tr>
Expand Down
1 change: 0 additions & 1 deletion www/src/Pages/PinMapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export default function PinMapping() {
useEffect(() => {
fetchPins();
fetchProfiles();
console.log('WTF');
}, []);

const onBaseChange = useCallback(
Expand Down
57 changes: 25 additions & 32 deletions www/src/Services/WebApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
})
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -369,15 +363,15 @@ 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);
}
}

async function setPinMappingsV2(mappings) {
return axios.post(`${baseUrl}/api/setPinMappingsV2`, mappings);
return Http.post(`${baseUrl}/api/setPinMappingsV2`, mappings);
}

async function getButtonLayouts(setLoading) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 2f0892f

Please sign in to comment.