2019-06-28 03:27:55 -04:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
2019-07-24 14:21:34 -04:00
|
|
|
import { THUMBNAIL_STATUSES, isNameValid } from 'lbry-redux';
|
2019-10-03 17:40:54 -04:00
|
|
|
import { INVALID_NAME_ERROR } from 'constants/claim';
|
2019-06-28 03:27:55 -04:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
title: ?string,
|
|
|
|
name: ?string,
|
|
|
|
bid: ?string,
|
2020-03-02 12:11:14 -05:00
|
|
|
bidError: ?string,
|
2019-06-28 03:27:55 -04:00
|
|
|
editingURI: ?string,
|
|
|
|
filePath: ?string,
|
|
|
|
isStillEditing: boolean,
|
|
|
|
uploadThumbnailStatus: string,
|
2021-04-15 22:52:41 -04:00
|
|
|
thumbnail: string,
|
2021-04-21 11:31:54 +08:00
|
|
|
thumbnailError: boolean,
|
2021-04-14 00:06:11 -04:00
|
|
|
waitForFile: boolean,
|
2019-06-28 03:27:55 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
function PublishFormErrors(props: Props) {
|
2021-04-14 00:06:11 -04:00
|
|
|
const {
|
|
|
|
name,
|
|
|
|
title,
|
|
|
|
bid,
|
|
|
|
bidError,
|
|
|
|
editingURI,
|
|
|
|
filePath,
|
|
|
|
isStillEditing,
|
|
|
|
uploadThumbnailStatus,
|
2021-04-15 22:52:41 -04:00
|
|
|
thumbnail,
|
2021-04-21 11:31:54 +08:00
|
|
|
thumbnailError,
|
2021-04-14 00:06:11 -04:00
|
|
|
waitForFile,
|
|
|
|
} = props;
|
2019-06-28 03:27:55 -04:00
|
|
|
// These are extra help
|
|
|
|
// If there is an error it will be presented as an inline error as well
|
2021-04-21 11:30:21 +08:00
|
|
|
|
|
|
|
const isUploadingThumbnail = uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS;
|
|
|
|
|
2019-06-28 03:27:55 -04:00
|
|
|
return (
|
2020-04-13 15:16:07 -04:00
|
|
|
<div className="error__text">
|
2021-04-14 00:06:11 -04:00
|
|
|
{waitForFile && <div>{__('Choose a replay file, or select None')}</div>}
|
2019-06-28 03:27:55 -04:00
|
|
|
{!title && <div>{__('A title is required')}</div>}
|
|
|
|
{!name && <div>{__('A URL is required')}</div>}
|
2019-10-03 17:40:54 -04:00
|
|
|
{!isNameValid(name, false) && INVALID_NAME_ERROR}
|
2019-06-28 03:27:55 -04:00
|
|
|
{!bid && <div>{__('A deposit amount is required')}</div>}
|
2020-03-02 12:11:14 -05:00
|
|
|
{bidError && <div>{__('Please check your deposit amount.')}</div>}
|
2021-04-21 11:30:21 +08:00
|
|
|
{isUploadingThumbnail && <div>{__('Please wait for thumbnail to finish uploading')}</div>}
|
|
|
|
{!isUploadingThumbnail && !thumbnail && (
|
|
|
|
<div>{__('A thumbnail is required. Please upload or provide an image URL above.')}</div>
|
2019-06-28 03:27:55 -04:00
|
|
|
)}
|
2021-04-21 11:31:54 +08:00
|
|
|
{thumbnailError && <div>{__('Thumbnail is invalid.')}</div>}
|
2020-07-30 01:46:56 -05:00
|
|
|
{editingURI && !isStillEditing && !filePath && (
|
2019-06-28 03:27:55 -04:00
|
|
|
<div>{__('Please reselect a file after changing the LBRY URL')}</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PublishFormErrors;
|