Skip to content

Commit

Permalink
feat: fader -> channel routing. implementing faders reducer in channe…
Browse files Browse the repository at this point in the history
…l component
  • Loading branch information
olzzon committed Aug 19, 2019
1 parent 93af7b1 commit 85a1705
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
14 changes: 7 additions & 7 deletions src/components/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor

const mapStateToProps = (state: any, props: any): IChannelInjectProps => {
return {
pgmOn: state.channels[0].channel[props.channelIndex].pgmOn,
pstOn: state.channels[0].channel[props.channelIndex].pstOn,
pflOn: state.channels[0].channel[props.channelIndex].pflOn,
showChannel: state.channels[0].channel[props.channelIndex].showChannel,
faderLevel: state.channels[0].channel[props.channelIndex].faderLevel,
pgmOn: state.faders[0].fader[props.channelIndex].pgmOn,
pstOn: state.faders[0].fader[props.channelIndex].pstOn,
pflOn: state.faders[0].fader[props.channelIndex].pflOn,
showChannel: state.faders[0].fader[props.channelIndex].showChannel,
faderLevel: state.faders[0].fader[props.channelIndex].faderLevel,
channelType: state.channels[0].channel[props.channelIndex].channelType,
channelTypeIndex: state.channels[0].channel[props.channelIndex].channelTypeIndex,
label: state.channels[0].channel[props.channelIndex].label,
snapOn: state.channels[0].channel[props.channelIndex].snapOn.map((item: number) => {return item}),
label: state.faders[0].fader[props.channelIndex].label,
snapOn: state.faders[0].fader[props.channelIndex].snapOn.map((item: number) => {return item}),
mixerProtocol: state.settings[0].mixerProtocol,
showSnaps: state.settings[0].showSnaps,
showPfl: state.settings[0].showPfl
Expand Down
4 changes: 2 additions & 2 deletions src/reducers/fadersReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ const defaultFadersReducerState = (numberOfTypeChannels: Array<number>) => {
vuVal: 0.0
});
for (let y=0; y < DEFAULTS.NUMBER_OF_SNAPS; y++) {
defaultObj[0].fader[totalNumberOfFaders].snapOn.push(false);
defaultObj[0].fader[index].snapOn.push(false);
}
}
return defaultObj;
};

export const channels = ((state = defaultFadersReducerState([1]), action: any): Array<IFaders> => {
export const faders = ((state = defaultFadersReducerState([1]), action: any): Array<IFaders> => {

let nextState = [{
vuMeters: [...state[0].vuMeters],
Expand Down
5 changes: 4 additions & 1 deletion src/reducers/indexReducer.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { combineReducers } from 'redux';
import { IChannels, channels} from './channelsReducer';
import { ISettings, settings } from './settingsReducer';
import {  IFaders, faders, } from './fadersReducer';

export interface IStore {
settings: Array<ISettings>,
channels: Array<IChannels>
channels: Array<IChannels>,
faders: Array<IFaders>
};

const indexReducer = combineReducers({
channels,
faders,
settings
});

Expand Down

0 comments on commit 85a1705

Please sign in to comment.