fix(music player): cannot preview audio in single file shares (https://github.com/cloudreve/Cloudreve/issues/1541)

This commit is contained in:
HFO4 2022-12-16 17:18:17 +08:00
parent f87530a95e
commit df3e4bfb82
2 changed files with 11 additions and 9 deletions

View File

@ -103,6 +103,9 @@ class MusicPlayerComponent extends Component {
//isOpen: true,
});
this.props.audioPreviewSetIsOpen(true);
this.props.showAudioPreview(
explorer.initState.audioPreview.first
);
return;
}
// eslint-disable-next-line

View File

@ -13,6 +13,7 @@ import {
openMusicDialog,
openResaveDialog,
setSelectedTarget,
showAudioPreview,
showImgPreivew,
toggleSnackbar,
} from "../../redux/explorer";
@ -105,8 +106,8 @@ const mapDispatchToProps = (dispatch) => {
toggleSnackbar: (vertical, horizontal, msg, color) => {
dispatch(toggleSnackbar(vertical, horizontal, msg, color));
},
openMusicDialog: () => {
dispatch(openMusicDialog());
openMusicDialog: (first) => {
dispatch(showAudioPreview(first));
},
setSelectedTarget: (targets) => {
dispatch(setSelectedTarget(targets));
@ -166,13 +167,11 @@ class SharedFileCompoment extends Component {
);
return;
case "audio":
this.props.setSelectedTarget([
{
key: this.props.share.key,
type: "share",
},
]);
this.props.openMusicDialog();
this.props.openMusicDialog({
key: this.props.share.key,
name: this.props.share.source.name,
type: "share",
});
return;
case "video":
this.props.history.push(