// @flow import React from 'react'; import * as THUMBNAIL_STATUSES from 'constants/thumbnail_upload_statuses'; import { isNameValid } from 'util/lbryURI'; 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')}
} {name && !isNameValid(name) && INVALID_NAME_ERROR} {!bid &&
{__('A deposit amount is required')}
} {bidError &&
{__('Please check your deposit amount.')}
} {isUploadingThumbnail &&
{__('Please wait for thumbnail to finish uploading')}
} {thumbnailError && !thumbnailUploaded &&
{__('Thumbnail is invalid.')}
} {editingURI && !isStillEditing && !filePath && (
{__('Please reselect a file after changing the LBRY URL')}
)}
); } export default PublishFormErrors;