Use constants rather than strings in a few more places

This commit is contained in:
Jordan Eldredge 2017-01-09 21:21:25 -08:00
parent 6b76e4b433
commit d0faa63cf8
6 changed files with 22 additions and 12 deletions

View file

@ -11,7 +11,8 @@ import {
SET_VOLUME,
START_LOADING,
TOGGLE_REPEAT,
TOGGLE_SHUFFLE
TOGGLE_SHUFFLE,
STOP
} from './actionTypes';
export function play() {
@ -29,12 +30,12 @@ export function pause() {
}
export function stop() {
return {type: 'STOP'};
return {type: STOP};
}
export function close() {
return (dispatch) => {
dispatch({type: 'STOP'});
dispatch({type: STOP});
dispatch({type: CLOSE_WINAMP});
};
}

View file

@ -2,6 +2,8 @@ import React from 'react';
import {connect} from 'react-redux';
import classnames from 'classnames';
import {SET_FOCUS, TOGGLE_DOUBLESIZE_MODE, UNSET_FOCUS} from '../actionTypes';
const ClutterBar = (props) => (
<div id='clutter-bar'>
@ -23,10 +25,10 @@ const mapStateToProps = (state) => ({
});
const mapDispatchToProps = (dispatch) => ({
handleMouseDown: () => dispatch({type: 'SET_FOCUS', input: 'double'}),
handleMouseDown: () => dispatch({type: SET_FOCUS, input: 'double'}),
handleMouseUp: () => {
dispatch({type: 'TOGGLE_DOUBLESIZE_MODE'});
dispatch({type: 'UNSET_FOCUS'});
dispatch({type: TOGGLE_DOUBLESIZE_MODE});
dispatch({type: UNSET_FOCUS});
}
});

View file

@ -4,6 +4,8 @@ import classnames from 'classnames';
import {close, setSkinFromFilename, openFileDialog} from '../actionCreators';
import {CLOSE_CONTEXT_MENU, TOGGLE_CONTEXT_MENU} from '../actionTypes';
import '../../css/context-menu.css';
const SKINS = [
@ -55,10 +57,10 @@ class ContextMenu extends React.Component {
const mapStateToProps = (state) => state.contextMenu;
const mapDispatchToProps = (dispatch, ownProps) => ({
close: () => dispatch(close(ownProps.mediaPlayer)),
closeMenu: () => dispatch({type: 'CLOSE_CONTEXT_MENU'}),
close: () => dispatch(close()),
closeMenu: () => dispatch({type: CLOSE_CONTEXT_MENU}),
toggleMenu: (e) => {
dispatch({type: 'TOGGLE_CONTEXT_MENU'});
dispatch({type: TOGGLE_CONTEXT_MENU});
e.stopPropagation();
},
openFileDialog: () => openFileDialog(ownProps.winamp),

View file

@ -2,6 +2,8 @@ import React from 'react';
import {connect} from 'react-redux';
import classnames from 'classnames';
import {TOGGLE_EQ_AUTO} from '../actionTypes';
class EqAuto extends React.Component {
constructor(props) {
super(props);
@ -9,7 +11,7 @@ class EqAuto extends React.Component {
}
handleClick() {
this.props.dispatch({type: 'TOGGLE_EQ_AUTO'});
this.props.dispatch({type: TOGGLE_EQ_AUTO});
}
render() {

View file

@ -2,6 +2,8 @@ import React from 'react';
import {connect} from 'react-redux';
import classnames from 'classnames';
import {TOGGLE_EQ_ON} from '../actionTypes';
class EqOn extends React.Component {
constructor(props) {
super(props);
@ -9,7 +11,7 @@ class EqOn extends React.Component {
}
handleClick() {
this.props.dispatch({type: 'TOGGLE_EQ_ON'});
this.props.dispatch({type: TOGGLE_EQ_ON});
}
render() {

View file

@ -2,6 +2,7 @@ import React from 'react';
import {connect} from 'react-redux';
import classnames from 'classnames';
import {TOGGLE_EQUALIZER_WINDOW} from '../actionTypes';
const EqToggleButton = (props) => (
<div
@ -16,7 +17,7 @@ const mapStateToProps = (state) => ({
});
const mapDispatchToProps = (dispatch) => ({
handleClick: () => dispatch({type: 'TOGGLE_EQUALIZER_WINDOW'})
handleClick: () => dispatch({type: TOGGLE_EQUALIZER_WINDOW})
});