import React from 'react'; import {connect} from 'react-redux'; import classnames from 'classnames'; import ActionButtons from './ActionButtons.jsx'; import Balance from './Balance.jsx'; import Close from './Close.jsx'; import ClutterBar from './ClutterBar.jsx'; import ContextMenu from './ContextMenu.jsx'; import DragTarget from './DragTarget.jsx'; import DraggableWindow from './DraggableWindow.jsx'; import Eject from './Eject.jsx'; import Kbps from './Kbps.jsx'; import Khz from './Khz.jsx'; import Marquee from './Marquee.jsx'; import MonoStereo from './MonoStereo.jsx'; import Position from './Position.jsx'; import Repeat from './Repeat.jsx'; import Shade from './Shade.jsx'; import ShadeTime from './ShadeTime.jsx'; import Shuffle from './Shuffle.jsx'; import Time from './Time.jsx'; import Visualizer from './Visualizer.jsx'; import Volume from './Volume.jsx'; import '../../css/main-window.css'; class MainWindow extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick() { this.props.dispatch({type: 'SET_FOCUSED_WINDOW', window: 'MAIN'}); } render() { const {status} = this.props.media; const {loading, doubled, shade, closed, llama} = this.props.display; const className = classnames({ window: true, // TODO: Handle these status changes in the individual components play: status === 'PLAYING', stop: status === 'STOPPED', pause: status === 'PAUSED', selected: this.props.windows.focused === 'MAIN', loading, doubled, llama, shade, closed }); // TODO: Move this to an actionCreator const handleDrop = (files) => { this.props.winamp.loadFromFileReference(files[0]); }; // NOTE: DragTarget but be outside Draggable Window, since currently // DragTarget creates a wrapper DOM element which, since main-window is // absolutely positioned, exists at a different location than the main // window. Drag/Drop still work, because events propogate up to parent // elements. return