Merge pull request #736 from lbryio/unsupported-filetypes

remove unsupported file types from channel pages
This commit is contained in:
Shawn K 2018-11-13 16:19:06 -06:00 committed by GitHub
commit d2699fa537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,18 +3,16 @@ import { Link } from 'react-router-dom';
import createCanonicalLink from '../../../../utils/createCanonicalLink';
const AssetPreview = ({ defaultThumbnail, claimData }) => {
const { name, fileExt, contentType, thumbnail, title } = claimData;
const showUrl = createCanonicalLink({ asset: { ...claimData }});
const {name, fileExt, contentType, thumbnail, title} = claimData;
const showUrl = createCanonicalLink({asset: {...claimData}});
const embedUrl = `${showUrl}.${fileExt}`;
return (
<Link to={showUrl} className='asset-preview'>
{(() => {
switch (contentType) {
case 'image/jpeg':
case 'image/jpg':
case 'image/png':
case 'image/gif':
return (
<Link to={showUrl} className='asset-preview'>
<div>
<img
className={'asset-preview-image'}
@ -23,9 +21,11 @@ const AssetPreview = ({ defaultThumbnail, claimData }) => {
/>
<h3 className='list-title'>{title}</h3>
</div>
</Link>
);
case 'video/mp4':
return (
<Link to={showUrl} className='asset-preview'>
<div>
<img
className={'asset-preview-video'}
@ -34,15 +34,11 @@ const AssetPreview = ({ defaultThumbnail, claimData }) => {
/>
<h3 className='list-title'>{title}</h3>
</div>
);
default:
return (
<p>unsupported file type</p>
);
}
})()}
</Link>
);
default:
return null;
}
};
export default AssetPreview;