mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-26 03:24:18 +00:00
Use constants for window names
This commit is contained in:
parent
be03593bf3
commit
ab76645153
4 changed files with 15 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import {connect} from 'react-redux';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import {BANDS} from '../constants';
|
||||
import {BANDS, WINDOWS} from '../constants';
|
||||
import {setEqBand, setPreamp} from '../actionCreators';
|
||||
|
||||
import DraggableWindow from './DraggableWindow.jsx';
|
||||
|
|
@ -26,7 +26,7 @@ class EqualizerWindow extends React.Component {
|
|||
}
|
||||
|
||||
handleClick() {
|
||||
this.props.dispatch({type: 'SET_FOCUSED_WINDOW', window: 'EQUALIZER'});
|
||||
this.props.dispatch({type: 'SET_FOCUSED_WINDOW', window: WINDOWS.EQUALIZER});
|
||||
}
|
||||
|
||||
setHertzValue(hertz) {
|
||||
|
|
@ -48,7 +48,7 @@ class EqualizerWindow extends React.Component {
|
|||
|
||||
const className = classnames({
|
||||
window: true,
|
||||
selected: this.props.windows.focused === 'EQUALIZER',
|
||||
selected: this.props.windows.focused === WINDOWS.EQUALIZER,
|
||||
doubled
|
||||
});
|
||||
return <DraggableWindow handleClass='title-bar'>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ import React from 'react';
|
|||
import {connect} from 'react-redux';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import {WINDOWS} from '../constants';
|
||||
|
||||
import ActionButtons from './ActionButtons.jsx';
|
||||
import Balance from './Balance.jsx';
|
||||
import Close from './Close.jsx';
|
||||
|
|
@ -32,7 +34,7 @@ class MainWindow extends React.Component {
|
|||
}
|
||||
|
||||
handleClick() {
|
||||
this.props.dispatch({type: 'SET_FOCUSED_WINDOW', window: 'MAIN'});
|
||||
this.props.dispatch({type: 'SET_FOCUSED_WINDOW', window: WINDOWS.MAIN});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -45,7 +47,7 @@ class MainWindow extends React.Component {
|
|||
play: status === 'PLAYING',
|
||||
stop: status === 'STOPPED',
|
||||
pause: status === 'PAUSED',
|
||||
selected: this.props.windows.focused === 'MAIN',
|
||||
selected: this.props.windows.focused === WINDOWS.MAIN,
|
||||
loading,
|
||||
doubled,
|
||||
llama,
|
||||
|
|
|
|||
|
|
@ -10,3 +10,9 @@ export const BANDS = [
|
|||
14000,
|
||||
16000
|
||||
];
|
||||
|
||||
export const WINDOWS = {
|
||||
MAIN: 'MAIN',
|
||||
PLAYLIST: 'PLAYLIST',
|
||||
EQUALIZER: 'EQUALIZER'
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {combineReducers} from 'redux';
|
||||
|
||||
import {BANDS} from './constants';
|
||||
import {BANDS, WINDOWS} from './constants';
|
||||
|
||||
const userInput = (state, action) => {
|
||||
if (!state) {
|
||||
|
|
@ -24,7 +24,7 @@ const userInput = (state, action) => {
|
|||
const windows = (state, action) => {
|
||||
if (!state) {
|
||||
return {
|
||||
focused: 'MAIN'
|
||||
focused: WINDOWS.MAIN
|
||||
};
|
||||
}
|
||||
switch (action.type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue