generated from SteamDeckHomebrew/decky-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup controller lighting panel code (#10)
* cleanup custom hook usage * move rgb components into folder * move controller components into folder * more code cleanup * extract rgb per games toggle * refactor rgb settings into reusable component
- Loading branch information
1 parent
d03c590
commit 0d64437
Showing
12 changed files
with
200 additions
and
300 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
src/components/RemapActionDropdown.tsx → ...onents/controller/RemapActionDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ToggleField, PanelSection, ServerAPI } from 'decky-frontend-lib'; | ||
import { VFC } from 'react'; | ||
import { useState } from 'react'; | ||
import { useRgbProfileDisplayName } from '../../hooks/rgb'; | ||
import { RgbPerGameProfilesToggle } from './RgbPerGameProfilesToggle'; | ||
import { RgbSettings } from './RgbSettings'; | ||
|
||
const DEFAULT_STATE = { | ||
isTouchpad: true | ||
}; | ||
|
||
const ControllerLightingPanel: VFC<{ serverAPI: ServerAPI }> = ({ | ||
serverAPI | ||
}) => { | ||
const displayName = useRgbProfileDisplayName(); | ||
const [isTouchpad, setIsTouchpad] = useState(DEFAULT_STATE.isTouchpad); | ||
|
||
const TPadToggleChange = (value: boolean) => { | ||
setIsTouchpad(value); | ||
console.log(`Toggle value: ${value}`); | ||
serverAPI!.callPluginMethod('set_touchpad', { enable: value }); | ||
}; | ||
|
||
let title = | ||
displayName === 'Default' | ||
? 'Controller Lighting - Default' | ||
: `Controller Lighting - ${displayName.substring(0, 10)}...`; | ||
|
||
return ( | ||
<PanelSection title={title}> | ||
<div> | ||
<RgbPerGameProfilesToggle /> | ||
<RgbSettings controller="RIGHT" /> | ||
<RgbSettings controller="LEFT" /> | ||
|
||
<ToggleField | ||
label="Touchpad" | ||
checked={isTouchpad} | ||
onChange={(value) => TPadToggleChange(value)} | ||
></ToggleField> | ||
</div> | ||
</PanelSection> | ||
); | ||
}; | ||
|
||
export default ControllerLightingPanel; |
4 changes: 2 additions & 2 deletions
4
src/components/RgbModeSlider.tsx → src/components/rgb/RgbModeSlider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.