Voice Notes mini-player: Show with no conversation, fix spacing

This commit is contained in:
Scott Nonnenberg 2023-03-20 11:03:21 -07:00 committed by GitHub
parent 9015837b2e
commit 75d5e81013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 159 additions and 87 deletions

View file

@ -4,6 +4,7 @@
import React, { useCallback } from 'react';
import { useSelector } from 'react-redux';
import { MiniPlayer, PlayerState } from '../../components/MiniPlayer';
import type { Props as DumbProps } from '../../components/MiniPlayer';
import {
AudioPlayerContent,
useAudioPlayerActions,
@ -14,13 +15,15 @@ import {
} from '../selectors/audioPlayer';
import { getIntl } from '../selectors/user';
type Props = Pick<DumbProps, 'shouldFlow'>;
/**
* Wires the dispatch props and shows/hides the MiniPlayer
*
* It also triggers side-effecting actions (actual playback) in response to changes in
* the state
*/
export function SmartMiniPlayer(): JSX.Element | null {
export function SmartMiniPlayer({ shouldFlow }: Props): JSX.Element | null {
const i18n = useSelector(getIntl);
const active = useSelector(selectAudioPlayerActive);
const getVoiceNoteTitle = useSelector(selectVoiceNoteTitle);
@ -56,6 +59,7 @@ export function SmartMiniPlayer(): JSX.Element | null {
onPause={handlePause}
onPlaybackRate={setPlaybackRate}
onClose={unloadMessageAudio}
shouldFlow={shouldFlow}
state={state}
currentTime={active.currentTime}
duration={active.duration}