// @flow
import React, { useState } from 'react';
import { parseURI } from 'lbry-redux';
import classnames from 'classnames';
import Gerbil from './gerbil.png';
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
type Props = {
thumbnail: ?string,
uri: ?string,
className?: string,
thumbnailPreview: ?string,
obscure?: boolean,
small?: boolean,
allowGifs?: boolean,
};
function ChannelThumbnail(props: Props) {
const {
thumbnail: rawThumbnail,
uri,
className,
thumbnailPreview: rawThumbnailPreview,
obscure,
small = false,
allowGifs = false,
} = props;
const thumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
const thumbnailPreview = rawThumbnailPreview && rawThumbnailPreview.trim().replace(/^http:\/\//i, 'https://');
const channelThumbnail = thumbnail || thumbnailPreview;
const [thumbError, setThumbError] = useState(false);
if (channelThumbnail && channelThumbnail.endsWith('gif') && !allowGifs) {
return