From d41070c7b00fafc974a1a6e7b6d1b42391fa57ed Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 21 Jul 2017 04:48:52 +0200 Subject: all async paths working --- client/containers/fileLink.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'client/containers/fileLink.js') 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 } } -- cgit v1.2.3-70-g09d2