Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownskl committed Mar 25, 2024
1 parent c9bf864 commit 926af0b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion renderer/components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

interface ButtonProps {
className?: string;
hidden?: boolean
hidden?: boolean;
children;
}

Expand Down
56 changes: 27 additions & 29 deletions renderer/pages/settings/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,71 @@ 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)
return <p>
{
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 <p key={btn}>
Expand Down

0 comments on commit 926af0b

Please sign in to comment.