Merge pull request #736 from lbryio/unsupported-filetypes
remove unsupported file types from channel pages
This commit is contained in:
commit
d2699fa537
1 changed files with 35 additions and 39 deletions
|
@ -3,46 +3,42 @@ 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 (
|
||||
<div>
|
||||
<img
|
||||
className={'asset-preview-image'}
|
||||
src={embedUrl}
|
||||
alt={name}
|
||||
/>
|
||||
<h3 className='list-title'>{title}</h3>
|
||||
</div>
|
||||
);
|
||||
case 'video/mp4':
|
||||
return (
|
||||
<div>
|
||||
<img
|
||||
className={'asset-preview-video'}
|
||||
src={thumbnail || defaultThumbnail}
|
||||
alt={name}
|
||||
/>
|
||||
<h3 className='list-title'>{title}</h3>
|
||||
</div>
|
||||
);
|
||||
default:
|
||||
return (
|
||||
<p>unsupported file type</p>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</Link>
|
||||
);
|
||||
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'}
|
||||
src={embedUrl}
|
||||
alt={name}
|
||||
/>
|
||||
<h3 className='list-title'>{title}</h3>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
case 'video/mp4':
|
||||
return (
|
||||
<Link to={showUrl} className='asset-preview'>
|
||||
<div>
|
||||
<img
|
||||
className={'asset-preview-video'}
|
||||
src={thumbnail || defaultThumbnail}
|
||||
alt={name}
|
||||
/>
|
||||
<h3 className='list-title'>{title}</h3>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export default AssetPreview;
|
||||
|
|
Loading…
Reference in a new issue