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