Voice notes drafts

This commit is contained in:
Alvaro 2023-03-02 13:55:40 -07:00 committed by GitHub
parent 356fb301e1
commit 99015d7b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 2113 additions and 909 deletions

View file

@ -4,7 +4,10 @@
import React, { useCallback } from 'react';
import { useSelector } from 'react-redux';
import { MiniPlayer, PlayerState } from '../../components/MiniPlayer';
import { useAudioPlayerActions } from '../ducks/audioPlayer';
import {
AudioPlayerContent,
useAudioPlayerActions,
} from '../ducks/audioPlayer';
import {
selectAudioPlayerActive,
selectVoiceNoteTitle,
@ -30,15 +33,25 @@ export function SmartMiniPlayer(): JSX.Element | null {
return null;
}
const { content } = active;
const url = AudioPlayerContent.isVoiceNote(content)
? content.current.url
: content.url;
let state = PlayerState.loading;
if (active.content.current.url) {
if (url) {
state = active.playing ? PlayerState.playing : PlayerState.paused;
}
return (
<MiniPlayer
i18n={i18n}
title={getVoiceNoteTitle(active.content.current)}
title={
AudioPlayerContent.isDraft(content)
? i18n('you')
: getVoiceNoteTitle(content.current)
}
onPlay={handlePlay}
onPause={handlePause}
onPlaybackRate={setPlaybackRate}