import React from 'react'; import { Attachment, QuotePropsWithoutListener } from './Quote'; import { GoogleChrome } from '../../../../../util'; import { MIME } from '../../../../../types'; import { noop } from 'lodash'; import { QuoteImage } from './QuoteImage'; import { QuoteIcon } from './QuoteIcon'; function getObjectUrl(thumbnail: Attachment | undefined): string | undefined { if (thumbnail && thumbnail.objectUrl) { return thumbnail.objectUrl; } return; } export const QuoteIconContainer = ( props: Pick & { handleImageErrorBound: () => void; imageBroken: boolean; } ) => { const { attachment, imageBroken, handleImageErrorBound } = props; if (!attachment) { return null; } const { contentType, thumbnail } = attachment; const objectUrl = getObjectUrl(thumbnail); if (GoogleChrome.isVideoTypeSupported(contentType)) { return objectUrl && !imageBroken ? ( ) : ( ); } if (GoogleChrome.isImageTypeSupported(contentType)) { return objectUrl && !imageBroken ? ( ) : ( ); } if (MIME.isAudio(contentType)) { return ; } return null; };