diff options
Diffstat (limited to 'client/containers/fileLink.js')
| -rw-r--r-- | client/containers/fileLink.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/client/containers/fileLink.js b/client/containers/fileLink.js index 92933cf..22834d8 100644 --- a/client/containers/fileLink.js +++ b/client/containers/fileLink.js @@ -1,17 +1,27 @@ import { connect } from 'react-redux' import { audioPlayFile } from '../actions' +import { filepath } from '../vendor/paths' import Link from '../components/UI/Link.jsx' const mapStateToProps = (state, ownProps) => ({ - children: ownProps.children || ownProps.file ? ownProps.file.name : "(~)", - disabled: ownProps.disabled || ! ownProps.file + href: ownProps.file ? filepath(ownProps.file) : '#', + children: ownProps.children || (ownProps.file ? ownProps.file.name : "(~)"), + disabled: ownProps.disabled || ! ownProps.file, + selected: ownProps.file && state.audioPlayer.file && state.audioPlayer.file.id == ownProps.file.id }) const mapDispatchToProps = (dispatch, ownProps) => ({ onClick: () => { switch (ownProps.file.type) { case 'audio': - dispatch(audioPlayFile(ownProps.file)) + let file = ownProps.file + dispatch(audioPlayFile(null)) + setTimeout(() => { + dispatch(audioPlayFile(ownProps.file)) + }, 10) + break + case 'image': + // document.body.style.backgroundImage = break } } |
