diff --git a/app/src/components/Pad.tsx b/app/src/components/Pad.tsx index 7d7f9b2..bc9901c 100644 --- a/app/src/components/Pad.tsx +++ b/app/src/components/Pad.tsx @@ -4,6 +4,7 @@ import React, { useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' import { ColorOff, randomRGB, rgbToHex } from '../utils/color' import { changeColor, setPressed } from '../redux/components/pad/padActions' +import { CHANNELS } from '../constants/ipc' const Pad = ({ x, y }) => { const button = parseInt(`${y}${x}`) @@ -11,7 +12,7 @@ const Pad = ({ x, y }) => { const dispatch = useDispatch() const { isPressed, color } = useSelector((state) => state.pad.buttons[button]) - useEffect(() => window.api.send('lpPadColor', { button, color }), [color]) + useEffect(() => window.api.send(CHANNELS.LP.PAD_COLOR, { button, color }), [color]) useEffect(() => { console.log('INVOKE PRESSED =>', button, 'STATE: ', isPressed) diff --git a/app/src/constants/ipc.ts b/app/src/constants/ipc.ts index f76cc0a..32bea5f 100644 --- a/app/src/constants/ipc.ts +++ b/app/src/constants/ipc.ts @@ -1,6 +1,7 @@ export const CHANNELS = { LP: { CLEAR: 'lpClear', + PAD: 'pad', PAD_COLOR: 'lpPadColor' }, DMX: { diff --git a/app/src/pages/launchpad/launchpad.tsx b/app/src/pages/launchpad/launchpad.tsx index 668dfc1..5e943b5 100644 --- a/app/src/pages/launchpad/launchpad.tsx +++ b/app/src/pages/launchpad/launchpad.tsx @@ -26,7 +26,7 @@ const Launchpad = (props) => { const dispatch = useDispatch() // @ts-ignore - window.api.receive('pad', ({ event, button }) => { + window.api.receive(CHANNELS.LP.PAD, ({ event, button }) => { dispatch( setPressed({ pressed: event === 'BUTTON_DOWN' ?? false,