signal-desktop/ts/state/smart/renderAudioAttachment.tsx

27 lines
772 B
TypeScript
Raw Normal View History

// Copyright 2021-2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ReactElement } from 'react';
import React from 'react';
import { GlobalAudioContext } from '../../components/GlobalAudioContext';
import type { Props as MessageAudioProps } from './MessageAudio';
import { SmartMessageAudio } from './MessageAudio';
2022-11-04 13:22:07 +00:00
type AudioAttachmentProps = Omit<MessageAudioProps, 'computePeaks'>;
export function renderAudioAttachment(
props: AudioAttachmentProps
): ReactElement {
return (
<GlobalAudioContext.Consumer>
{globalAudioProps => {
return (
globalAudioProps && (
<SmartMessageAudio {...props} {...globalAudioProps} />
)
);
}}
</GlobalAudioContext.Consumer>
);
}