showplan tests

This commit is contained in:
michael-grace 2020-11-15 19:36:47 +00:00
parent 98c871406b
commit 99f1de735b
3 changed files with 23 additions and 3 deletions

View file

@ -58,7 +58,7 @@ export const bapsicleMiddleware: Middleware<{}, RootState, Dispatch<any>> = (
store.getState().showplan.plan?.forEach((item) => {
if (
item.channel === message.channel &&
item.weight === message.planItem
item.weight === message.weight
) {
itemToLoad = item;
}

View file

@ -4,7 +4,11 @@ import Modal from "react-modal";
import { useDispatch, useSelector } from "react-redux";
import { Button } from "reactstrap";
import BAPSicleLogo from "../assets/images/bapsicle.png";
import { connectBAPSicle, disconnectBAPSicle } from "../bapsicle";
import {
connectBAPSicle,
disconnectBAPSicle,
sendBAPSicleChannel,
} from "../bapsicle";
import { RootState } from "../rootReducer";
interface BAPSicleModalProps {
@ -17,6 +21,7 @@ export function BAPSicleModal(props: BAPSicleModalProps) {
const connectionState = useSelector((state: RootState) => state.connection);
const [connectType, setConnectType] = useState("Connect");
const dispatch = useDispatch();
const showplan = useSelector((state: RootState) => state.showplan);
if (
connectType !== "Connect" &&
@ -58,6 +63,21 @@ export function BAPSicleModal(props: BAPSicleModalProps) {
props.close();
}}
/>
<button
onClick={() => {
for (var i = 0; i < showplan.plan!.length; i++) {
let item = showplan.plan![i];
sendBAPSicleChannel({
channel: item.channel,
command: "ADD",
weight: item.weight,
title: item.title,
});
}
}}
>
Load Show Plan
</button>
</Modal>
);
}

View file

@ -41,7 +41,7 @@ export const Item = memo(function Item({
sendBAPSicleChannel({
channel: column,
command: "LOAD",
planItem: index,
weight: index,
});
dispatch(MixerState.load(column, x));
}