Merge branch 'master' of github.com:lbryio/spee.ch into 282-thumbnail-selector

This commit is contained in:
bill bittner 2018-03-04 11:59:27 -08:00
commit 5b9e7c04af
2 changed files with 13 additions and 12 deletions

View file

@ -1,7 +1,8 @@
import React from 'react'; import React from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
const { claim: { defaultThumbnail } } = require('../../../config/speechConfig.js');
const AssetPreview = ({ name, claimId, fileExt, contentType }) => { const AssetPreview = ({ claimData: { name, claimId, fileExt, contentType, thumbnail } }) => {
const directSourceLink = `${claimId}/${name}.${fileExt}`; const directSourceLink = `${claimId}/${name}.${fileExt}`;
const showUrlLink = `/${claimId}/${name}`; const showUrlLink = `/${claimId}/${name}`;
return ( return (
@ -12,18 +13,21 @@ const AssetPreview = ({ name, claimId, fileExt, contentType }) => {
case 'image/jpeg': case 'image/jpeg':
case 'image/jpg': case 'image/jpg':
case 'image/png': case 'image/png':
return (
<img className={'asset-preview'} src={directSourceLink} alt={name} />
);
case 'image/gif': case 'image/gif':
return ( return (
<img className={'asset-preview'} src={directSourceLink} alt={name} /> <img
className={'asset-preview'}
src={directSourceLink}
alt={name}
/>
); );
case 'video/mp4': case 'video/mp4':
return ( return (
<video className={'asset-preview'}> <img
<source src={directSourceLink} type={contentType} /> className={'asset-preview'}
</video> src={thumbnail || defaultThumbnail}
alt={name}
/>
); );
default: default:
return ( return (

View file

@ -28,10 +28,7 @@ class ChannelClaimsDisplay extends React.Component {
{(claims.length > 0) ? ( {(claims.length > 0) ? (
<div> <div>
{claims.map((claim, index) => <AssetPreview {claims.map((claim, index) => <AssetPreview
name={claim.name} claimData={claim}
claimId={claim.claimId}
fileExt={claim.fileExt}
contentType={claim.contentType}
key={`${claim.name}-${index}`} key={`${claim.name}-${index}`}
/>)} />)}
<div> <div>