diff options
Diffstat (limited to 'app/client/common')
| -rw-r--r-- | app/client/common/audioPlayer.component.js | 38 | ||||
| -rw-r--r-- | app/client/common/fileList.component.js | 19 |
2 files changed, 52 insertions, 5 deletions
diff --git a/app/client/common/audioPlayer.component.js b/app/client/common/audioPlayer.component.js new file mode 100644 index 0000000..f10a505 --- /dev/null +++ b/app/client/common/audioPlayer.component.js @@ -0,0 +1,38 @@ +import { h, Component } from 'preact' +import { connect } from 'react-redux' +import { bindActionCreators } from 'redux' +import * as liveActions from '../live/live.actions' + +const audio = document.createElement('audio') + +class AudioPlayer extends Component { + constructor(props){ + super(props) + this.handleClick = this.handleClick.bind(this) + } + handleClick(e){ + this.props.onClick && this.props.onClick() + } + render() { + const { player={} } = this.props + return ( + <div className='audioPlayer'> + <span>{this.props.title}</span> + <button + onClick={this.handleClick} + > + {player.playing ? '>' : 'pause'} + </button> + </div> + ) + } +} + +const mapStateToProps = state => ({ + player: state.audioPlayer, +}) + +const mapDispatchToProps = (dispatch, ownProps) => ({ +}) + +export default connect(mapStateToProps, mapDispatchToProps)(AudioPlayer) diff --git a/app/client/common/fileList.component.js b/app/client/common/fileList.component.js index c16928f..f596c8d 100644 --- a/app/client/common/fileList.component.js +++ b/app/client/common/fileList.component.js @@ -30,13 +30,22 @@ export const FileList = props => { onClick /> }) + if (! (files && files.length)) { + return ( + <div className={'rows ' + className}> + <div class='row heading'> + <h4 class='noFiles'>No files</h4> + </div> + </div> + ) + } return ( <div className={'rows ' + className}> - <div class='row heading'> - {(files && files.length) - ? (title && <h3>{title}</h3>) - : <h4>No files</h4>} - </div> + {title && + <div class='row heading'> + <h3>{title}</h3>} + </div> + } <div className={'rows ' + fileListClassName}> {fileList} |
