-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoffer Engman
committed
Oct 7, 2023
1 parent
18b3279
commit 1d7a213
Showing
7 changed files
with
53 additions
and
33 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { useDispatch } from 'react-redux' | ||
import { randomRGB } from '../utils/color' | ||
import { changeColor, setPressed } from '../redux/components/pad/padActions' | ||
import React, { useEffect } from 'react' | ||
import { CHANNELS } from '../constants/ipc' | ||
import { BUTTON_DOWN } from '../constants/events' | ||
|
||
const Receiver = () => { | ||
const dispatch = useDispatch() | ||
|
||
console.log('DSDSDS') | ||
useEffect(() => console.log('Receiver listening!'), []) | ||
|
||
// @ts-ignore | ||
window.api.receive(CHANNELS.LP.PAD, ({ event, button }) => { | ||
dispatch(setPressed(button, event === 'BUTTON_DOWN' ?? false)) | ||
dispatch(changeColor(button, randomRGB())) | ||
dispatch(setPressed(button.nr, event === BUTTON_DOWN ?? false)) | ||
}) | ||
|
||
return ( | ||
<></> | ||
) | ||
} | ||
|
||
export default Receiver |
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,2 @@ | ||
export const BUTTON_DOWN = 'BUTTON_DOWN' | ||
export const BUTTON_UP = 'BUTTON_UP' |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import AppRoutes from 'Core/routes' | ||
import React from 'react' | ||
import { Provider } from 'react-redux' | ||
import { HistoryRouter } from 'redux-first-history/rr6' | ||
import Nav from './nav' | ||
import './root.css' | ||
import Receiver from '../components/Receiver' | ||
|
||
type Props = { | ||
store: any | ||
history: any | ||
} | ||
|
||
const Root = ({ store, history }: Props) => { | ||
return ( | ||
<React.Fragment> | ||
<Provider store={store}> | ||
<HistoryRouter history={history}> | ||
<Receiver /> | ||
<Nav history={history}></Nav> | ||
<AppRoutes></AppRoutes> | ||
</HistoryRouter> | ||
</Provider> | ||
</React.Fragment> | ||
) | ||
} | ||
|
||
export default Root |
File renamed without changes.