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:
parent
6e22481b4d
commit
5a46bef7ca
4 changed files with 53 additions and 14 deletions
|
@ -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 }) => {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
align-items: center;
|
||||
justify-content: stretch;
|
||||
flex: 1;
|
||||
user-select: none;
|
||||
|
||||
&:global(.playing) {
|
||||
.progress {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue