// @flow import React from 'react'; import { THUMBNAIL_STATUSES, isNameValid } from 'lbry-redux'; import { INVALID_NAME_ERROR } from 'constants/claim'; type Props = { title: ?string, name: ?string, bid: ?string, bidError: ?string, editingURI: ?string, filePath: ?string, isStillEditing: boolean, uploadThumbnailStatus: string, thumbnail: string, thumbnailError: boolean, waitForFile: boolean, }; function PublishFormErrors(props: Props) { const { name, title, bid, bidError, editingURI, filePath, isStillEditing, uploadThumbnailStatus, thumbnail, thumbnailError, waitForFile, } = props; // These are extra help // If there is an error it will be presented as an inline error as well const isUploadingThumbnail = uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS; const thumbnailUploaded = uploadThumbnailStatus === THUMBNAIL_STATUSES.COMPLETE && thumbnail; return (
{waitForFile &&
{__('Choose a replay file, or select None')}
} {!title &&
{__('A title is required')}
} {!name &&
{__('A URL is required')}
} {!isNameValid(name, false) && INVALID_NAME_ERROR} {!bid &&
{__('A deposit amount is required')}
} {bidError &&
{__('Please check your deposit amount.')}
} {isUploadingThumbnail &&
{__('Please wait for thumbnail to finish uploading')}
} {!isUploadingThumbnail && !thumbnail && (
{__('A thumbnail is required. Please upload or provide an image URL above.')}
)} {thumbnailError && !thumbnailUploaded &&
{__('Thumbnail is invalid.')}
} {editingURI && !isStillEditing && !filePath && (
{__('Please reselect a file after changing the LBRY URL')}
)}
); } export default PublishFormErrors;