Skip to content

Commit

Permalink
chore: client cleanup - remove snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Dec 19, 2019
1 parent 89e34e3 commit 7a14b5e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 116 deletions.
52 changes: 1 addition & 51 deletions src/components/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import ReactSlider from 'react-slider'
//assets:
import '../assets/css/Channel.css';
import { SOCKET_TOGGLE_PGM, SOCKET_TOGGLE_VO, SOCKET_TOGGLE_PST, SOCKET_TOGGLE_PFL, SOCKET_TOGGLE_MUTE, SOCKET_SET_FADERLEVEL } from '../../server/constants/SOCKET_IO_DISPATCHERS'
import {
TOGGLE_SNAP
} from '../../server/reducers/faderActions'
import { IFader } from '../../server/reducers/fadersReducer';
import { IChannels } from '../../server/reducers/channelsReducer';
import { ISettings } from '../../server/reducers/settingsReducer';
Expand All @@ -24,7 +21,6 @@ interface IChannelInjectProps {
settings: ISettings
channelType: number,
channelTypeIndex: number,
snapOn: boolean[],
}

interface IChannelProps {
Expand All @@ -41,12 +37,6 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
}

public shouldComponentUpdate(nextProps: IChannelInjectProps) {
let snapChanged: boolean = false;
nextProps.snapOn.map((snapOn, index) => {
if (snapOn === this.props.snapOn[index]) {
snapChanged = true;
}
})
return (
nextProps.fader.pgmOn != this.props.fader.pgmOn ||
nextProps.fader.pstOn != this.props.fader.pstOn ||
Expand All @@ -57,8 +47,7 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
nextProps.settings.mixerProtocol != this.props.settings.mixerProtocol ||
nextProps.settings.showSnaps != this.props.settings.showSnaps ||
nextProps.settings.showPfl != this.props.settings.showPfl ||
nextProps.settings.showChanStrip != this.props.settings.showChanStrip ||
snapChanged
nextProps.settings.showChanStrip != this.props.settings.showChanStrip
)
}

Expand Down Expand Up @@ -97,15 +86,6 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
});
}


handleSnap(snapIndex: number) {
this.props.dispatch({
type: TOGGLE_SNAP,
channel: this.faderIndex,
snapIndex: snapIndex
});
}

fader() {
let thumb = 'channel-volume-thumb' + (this.props.fader.pgmOn ? '-color-pgm' : '') + (this.props.fader.voOn ? '-color-vo' : '')
if (this.props.fader.muteOn) {
Expand Down Expand Up @@ -231,27 +211,6 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
)
}


snapButton = (snapIndex: number) => {
if (this.props.settings.showSnaps) {
return (
<div key={snapIndex} className="channel-snap-line">
<button
className={ClassNames("channel-snap-button", {
'on': this.props.snapOn[snapIndex]
})}
onClick={event => {
this.handleSnap(snapIndex);
}}
>{snapIndex + 1 }</button>
<br/>
</div>
)
} else {
return("")
}
}

render() {
return (
this.props.fader.showChannel === false ?
Expand All @@ -260,7 +219,6 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
<div
className={
ClassNames("channel-body", {
"with-snaps": this.props.settings.showSnaps,
"with-pfl": this.props.settings.showPfl,
"mute-on": this.props.fader.muteOn
})}>
Expand Down Expand Up @@ -294,13 +252,6 @@ class Channel extends React.Component<IChannelProps & IChannelInjectProps & Stor
{this.chanStripButton()}
<br/>
</React.Fragment>
<div className="channel-snap-body">
{this.props.snapOn
.map((none: any, index: number) => {
return this.snapButton(index)
})
}
</div>
</div>
)
}
Expand All @@ -313,7 +264,6 @@ const mapStateToProps = (state: any, props: any): IChannelInjectProps => {
settings: state.settings[0],
channelType: 0, /* TODO: state.channels[0].channel[props.channelIndex].channelType, */
channelTypeIndex: props.faderIndex ,/* TODO: state.channels[0].channel[props.channelIndex].channelTypeIndex, */
snapOn: state.faders[0].fader[props.faderIndex].snapOn.map((item: number) => {return item}),
}
}

Expand Down
64 changes: 0 additions & 64 deletions src/components/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ import * as ClassNames from 'classnames';
import Channel from './Channel';
import '../assets/css/Channels.css';
import { Store } from 'redux';
import {
SNAP_RECALL
} from '../../server/reducers/faderActions'
import {
TOGGLE_SHOW_SETTINGS,
TOGGLE_SHOW_SNAPS,
TOGGLE_SHOW_STORAGE
} from '../../server/reducers/settingsActions'
import ChannelRouteSettings from './ChannelRouteSettings';
Expand All @@ -31,7 +27,6 @@ interface IChannelsInjectProps {
class Channels extends React.Component<IChannelsInjectProps & Store> {
constructor(props: any) {
super(props);
this.props.settings.showChanStrip = -1
this.props.settings.showMonitorOptions = -1
}

Expand All @@ -43,7 +38,6 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
|| this.props.faders.length !== nextProps.faders.length;
}


handleMix() {
window.socketIoClient.emit(SOCKET_NEXT_MIX)
}
Expand All @@ -52,19 +46,6 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
window.socketIoClient.emit(SOCKET_CLEAR_PST)
}

handleSnapMix(snapIndex: number) {
this.props.dispatch({
type: SNAP_RECALL,
snapIndex: snapIndex
});
}

handleShowSnaps() {
this.props.dispatch({
type: TOGGLE_SHOW_SNAPS,
});
}

handleReconnect() {
if (window.confirm('Are you sure you will restart server?')) {
window.socketIoClient.emit(SOCKET_RESTART_SERVER)
Expand All @@ -84,20 +65,6 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
});
}

snapMixButton(snapIndex: number) {
return (
<div key={snapIndex} className="channels-snap-mix-line">
<button
className="channels-snap-mix-button"
onClick={event => {
this.handleSnapMix(snapIndex);
}}
>SNAP {snapIndex + 1 }</button>
<br/>
</div>
)
}

render() {
return (
<div className="channels-body">
Expand Down Expand Up @@ -150,20 +117,6 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
RESTART SERVER
</button>
}
{(this.props.settings.automationMode ||
this.props.settings.offtubeMode) ?
null
: <React.Fragment>
{<button
className="channels-show-snaps-button"
onClick={() => {
this.handleShowSnaps();
}}
>SNAPS
</button>}
<br />
</React.Fragment>
}

<button
className="channels-show-settings-button"
Expand Down Expand Up @@ -195,23 +148,6 @@ class Channels extends React.Component<IChannelsInjectProps & Store> {
>NEXT TAKE
</button>}
<br />

{(this.props.settings.automationMode ||
this.props.settings.offtubeMode) ?
null
: <React.Fragment>
<div className="channels-snap-mix-body">
{this.snapMixButton(0)}
{this.snapMixButton(1)}
{this.snapMixButton(2)}
{this.snapMixButton(3)}
{this.snapMixButton(4)}
{this.snapMixButton(5)}
{this.snapMixButton(6)}
{this.snapMixButton(7)}
</div>
</React.Fragment>
}
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion storage/default.shot
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"faderState":{"vuMeters":[{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0}],"fader":[{"faderLevel":0.5270000100135803,"label":"","pgmOn":true,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":1,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":2,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.92,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":3,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":4,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.62,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":5,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":6,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":7,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":8,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]}]},"channelState":{"channel":[{"channelType":0,"channelTypeIndex":0,"assignedFader":0,"fadeActive":false,"outputLevel":0.5270000100135803,"auxLevel":[]},{"channelType":0,"channelTypeIndex":1,"assignedFader":1,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":2,"assignedFader":2,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":3,"assignedFader":3,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":4,"assignedFader":4,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":5,"assignedFader":5,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":6,"assignedFader":6,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":7,"assignedFader":7,"fadeActive":false,"outputLevel":0,"auxLevel":[]}]}}
{"faderState":{"vuMeters":[{"vuVal":0.7691009640693665},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0},{"vuVal":0}],"fader":[{"faderLevel":0.68,"label":"","pgmOn":true,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":1,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":2,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":3,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":4,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.62,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":5,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":6,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":7,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]},{"faderLevel":0.75,"label":"","pgmOn":false,"voOn":false,"pstOn":false,"pstVoOn":false,"pflOn":false,"muteOn":false,"low":0.75,"mid":0.75,"high":0.75,"threshold":0.75,"ratio":0.75,"monitor":8,"showChannel":true,"snapOn":[false,false,false,false,false,false,false,false]}]},"channelState":{"channel":[{"channelType":0,"channelTypeIndex":0,"assignedFader":0,"fadeActive":false,"outputLevel":0.68,"auxLevel":[]},{"channelType":0,"channelTypeIndex":1,"assignedFader":1,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":2,"assignedFader":2,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":3,"assignedFader":3,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":4,"assignedFader":4,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":5,"assignedFader":5,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":6,"assignedFader":6,"fadeActive":false,"outputLevel":0,"auxLevel":[]},{"channelType":0,"channelTypeIndex":7,"assignedFader":7,"fadeActive":false,"outputLevel":0,"auxLevel":[]}]}}

0 comments on commit 7a14b5e

Please sign in to comment.