fix reselect video on publish edits
This commit is contained in:
parent
222a388eed
commit
d8c2770ac1
2 changed files with 22 additions and 12 deletions
|
@ -6,6 +6,7 @@ import {
|
||||||
selectMyClaimForUri,
|
selectMyClaimForUri,
|
||||||
selectIsResolvingPublishUris,
|
selectIsResolvingPublishUris,
|
||||||
selectTakeOverAmount,
|
selectTakeOverAmount,
|
||||||
|
selectFileInfosByOutpoint,
|
||||||
doResetThumbnailStatus,
|
doResetThumbnailStatus,
|
||||||
doClearPublish,
|
doClearPublish,
|
||||||
doUpdatePublishForm,
|
doUpdatePublishForm,
|
||||||
|
@ -25,6 +26,7 @@ const select = state => ({
|
||||||
myClaimForUri: selectMyClaimForUri(state),
|
myClaimForUri: selectMyClaimForUri(state),
|
||||||
// If I clicked the "edit" button, have I changed the uri?
|
// If I clicked the "edit" button, have I changed the uri?
|
||||||
// Need this to make it easier to find the source on previously published content
|
// Need this to make it easier to find the source on previously published content
|
||||||
|
fileInfos: selectFileInfosByOutpoint(state),
|
||||||
isStillEditing: selectIsStillEditing(state),
|
isStillEditing: selectIsStillEditing(state),
|
||||||
isResolvingUri: selectIsResolvingPublishUris(state),
|
isResolvingUri: selectIsResolvingPublishUris(state),
|
||||||
totalRewardValue: selectUnclaimedRewardValue(state),
|
totalRewardValue: selectUnclaimedRewardValue(state),
|
||||||
|
|
|
@ -10,6 +10,8 @@ import ThumbnailBrokenImage from './thumbnail-broken.png';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
filePath: ?string,
|
filePath: ?string,
|
||||||
|
fileInfos: { [string]: FileListItem },
|
||||||
|
myClaimForUri: ?StreamClaim,
|
||||||
thumbnail: ?string,
|
thumbnail: ?string,
|
||||||
formDisabled: boolean,
|
formDisabled: boolean,
|
||||||
uploadThumbnailStatus: string,
|
uploadThumbnailStatus: string,
|
||||||
|
@ -52,6 +54,8 @@ class SelectThumbnail extends React.PureComponent<Props, State> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
filePath,
|
filePath,
|
||||||
|
fileInfos,
|
||||||
|
myClaimForUri,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
formDisabled,
|
formDisabled,
|
||||||
uploadThumbnailStatus: status,
|
uploadThumbnailStatus: status,
|
||||||
|
@ -63,7 +67,12 @@ class SelectThumbnail extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
const { thumbnailError } = this.state;
|
const { thumbnailError } = this.state;
|
||||||
|
|
||||||
const isSupportedVideo = Lbry.getMediaType(null, filePath) === 'video';
|
const outpoint = myClaimForUri ? `${myClaimForUri.txid}:${myClaimForUri.nout}` : undefined;
|
||||||
|
const fileInfo = outpoint ? fileInfos[outpoint] : undefined;
|
||||||
|
const downloadPath = fileInfo ? fileInfo.download_path : undefined;
|
||||||
|
|
||||||
|
const actualFilePath = filePath || downloadPath;
|
||||||
|
const isSupportedVideo = Lbry.getMediaType(null, actualFilePath) === 'video';
|
||||||
|
|
||||||
let thumbnailSrc;
|
let thumbnailSrc;
|
||||||
if (!thumbnail) {
|
if (!thumbnail) {
|
||||||
|
@ -153,7 +162,7 @@ class SelectThumbnail extends React.PureComponent<Props, State> {
|
||||||
<Button
|
<Button
|
||||||
button="link"
|
button="link"
|
||||||
label={__('Take a snapshot from your video')}
|
label={__('Take a snapshot from your video')}
|
||||||
onClick={() => openModal(MODALS.AUTO_GENERATE_THUMBNAIL, { filePath })}
|
onClick={() => openModal(MODALS.AUTO_GENERATE_THUMBNAIL, { filePath: actualFilePath })}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -161,16 +170,15 @@ class SelectThumbnail extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
{status === THUMBNAIL_STATUSES.IN_PROGRESS && <p>{__('Uploading thumbnail')}...</p>}
|
{status === THUMBNAIL_STATUSES.IN_PROGRESS && <p>{__('Uploading thumbnail')}...</p>}
|
||||||
<p className="help">
|
<p className="help">
|
||||||
{(status === undefined && __('You should reselect your file to choose a thumbnail')) ||
|
{status === THUMBNAIL_STATUSES.API_DOWN ? (
|
||||||
(status === THUMBNAIL_STATUSES.API_DOWN ? (
|
__('Enter a URL for your thumbnail.')
|
||||||
__('Enter a URL for your thumbnail.')
|
) : (
|
||||||
) : (
|
<React.Fragment>
|
||||||
<React.Fragment>
|
{__('Upload your thumbnail to')}{' '}
|
||||||
{__('Upload your thumbnail to')}{' '}
|
<Button button="link" label={__('spee.ch')} href="https://spee.ch/about" />.{' '}
|
||||||
<Button button="link" label={__('spee.ch')} href="https://spee.ch/about" />.{' '}
|
{__('Recommended size: 800x450 (16:9)')}
|
||||||
{__('Recommended size: 800x450 (16:9)')}
|
</React.Fragment>
|
||||||
</React.Fragment>
|
)}
|
||||||
))}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue