diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-21 04:48:52 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-21 04:48:52 +0200 |
| commit | d41070c7b00fafc974a1a6e7b6d1b42391fa57ed (patch) | |
| tree | 4178eba89627e8581cdc5eea65bf7f11591f6b45 /client/containers/fileLink.js | |
| parent | d02cbad01f3abfa8a1aad0b55b8bd9cf544090cf (diff) | |
all async paths working
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 } } |
