From 926af0b941d281eab2a93f43381a5b523a241258 Mon Sep 17 00:00:00 2001 From: Jim Kroon Date: Tue, 26 Mar 2024 00:00:37 +0100 Subject: [PATCH] Lint fixes --- renderer/components/ui/card.tsx | 2 +- renderer/pages/settings/input.tsx | 56 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/renderer/components/ui/card.tsx b/renderer/components/ui/card.tsx index 5f81586b..4d886cbf 100644 --- a/renderer/components/ui/card.tsx +++ b/renderer/components/ui/card.tsx @@ -2,7 +2,7 @@ import React from 'react' interface ButtonProps { className?: string; - hidden?: boolean + hidden?: boolean; children; } diff --git a/renderer/pages/settings/input.tsx b/renderer/pages/settings/input.tsx index af48b13b..8ce88045 100644 --- a/renderer/pages/settings/input.tsx +++ b/renderer/pages/settings/input.tsx @@ -5,30 +5,28 @@ import SettingsSidebar from '../../components/settings/sidebar' import Card from '../../components/ui/card' import { useSettings } from '../../context/userContext' -import { MouseKeyboardConfig } from 'xbox-xcloud-player/dist/Driver/Keyboard' -function getUniqueButtons(keyMapping) { - const buttons = [] - for(const button in keyMapping) { - // k = actualButton, v = gamepadButton - buttons.push(keyMapping[button]) - } - const uniqueButtons = buttons.filter((v, i, a) => a.indexOf(v) === i) - return uniqueButtons -} +// function getUniqueButtons(keyMapping) { +// const buttons = [] +// for(const button in keyMapping) { +// // k = actualButton, v = gamepadButton +// buttons.push(keyMapping[button]) +// } +// const uniqueButtons = buttons.filter((v, i, a) => a.indexOf(v) === i) +// return uniqueButtons +// } function invert(obj) { - var new_obj = {}; - for (var prop in obj) { - if(obj.hasOwnProperty(prop)) { - new_obj[obj[prop]] = prop; - } + const new_obj = {} + for (const prop in obj) { + // if(obj.hasOwnProperty(prop)) { + new_obj[obj[prop]] = prop + // } } - return new_obj; + return new_obj } function KeySettings({keyConfigs, setKeyConfig}) { - // const mappableButtons = getUniqueButtons(MouseKeyboardConfig.default()._keymapping) const mappableButtons = ['DPadUp', 'DPadDown', 'DPadLeft', 'DPadRight', 'A', 'B', 'X', 'Y', 'View', 'Menu', 'Nexus', 'LeftShoulder', 'RightShoulder', 'LeftTrigger', 'RightTrigger', 'LeftThumb', 'RightThumb'] console.log('KEYS:', keyConfigs, mappableButtons) keyConfigs = invert(keyConfigs) @@ -36,42 +34,42 @@ function KeySettings({keyConfigs, setKeyConfig}) { { mappableButtons.map( (btn:string) => { - let fullBtnText = ''; + let fullBtnText = '' switch(btn){ case 'DPadUp': fullBtnText = 'DPad Up' - break; + break case 'DPadDown': fullBtnText = 'DPad Down' - break; + break case 'DPadLeft': fullBtnText = 'DPad Left' - break; + break case 'DPadRight': fullBtnText = 'DPad Right' - break; + break case 'LeftShoulder': fullBtnText = 'Left Shoulder' - break; + break case 'RightShoulder': fullBtnText = 'Right Shoulder' - break; + break case 'LeftTrigger': fullBtnText = 'Left Trigger' - break; + break case 'RightTrigger': fullBtnText = 'Right Trigger' - break; + break case 'LeftThumb': fullBtnText = 'Left Thumbstick' - break; + break case 'RightThumb': fullBtnText = 'Right Thumbstick' - break; + break default: fullBtnText = btn - break; + break } return