1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

sorting audios on comment attach

This commit is contained in:
Fedor Katurov 2019-11-01 16:38:16 +07:00
parent 6e22481b4d
commit 5a46bef7ca
4 changed files with 53 additions and 14 deletions

View file

@ -23,11 +23,13 @@ const mapDispatchToProps = {
type Props = ReturnType<typeof mapStateToProps> &
typeof mapDispatchToProps & {
file: IFile;
nonInteractive?: boolean;
};
const AudioPlayerUnconnected = memo(
({
file,
nonInteractive,
player: { file: current, status },
playerSetFileAndPlay,
playerPlay,
@ -42,13 +44,15 @@ const AudioPlayerUnconnected = memo(
});
const onPlay = useCallback(() => {
if (nonInteractive) return;
if (current && current.id === file.id) {
if (status === PLAYER_STATES.PLAYING) return playerPause();
return playerPlay();
}
playerSetFileAndPlay(file);
}, [file, current, status, playerPlay, playerPause, playerSetFileAndPlay]);
}, [file, current, status, playerPlay, playerPause, playerSetFileAndPlay, nonInteractive]);
const onProgress = useCallback(
({ detail }: { detail: IPlayerProgress }) => {

View file

@ -6,6 +6,7 @@
align-items: center;
justify-content: stretch;
flex: 1;
user-select: none;
&:global(.playing) {
.progress {