fixes: default channel bid and publish form (#3781)
Changes channel default bid and fixes publish form errors around bid amount.
This commit is contained in:
parent
f23729dad6
commit
3ee25f8251
5 changed files with 18 additions and 7 deletions
|
@ -29,6 +29,7 @@ type Props = {
|
|||
publish: (?string) => void,
|
||||
filePath: ?string,
|
||||
bid: ?number,
|
||||
bidError: ?string,
|
||||
editingURI: ?string,
|
||||
title: ?string,
|
||||
thumbnail: ?string,
|
||||
|
@ -74,6 +75,7 @@ function PublishForm(props: Props) {
|
|||
resolveUri,
|
||||
title,
|
||||
bid,
|
||||
bidError,
|
||||
uploadThumbnailStatus,
|
||||
resetThumbnailStatus,
|
||||
updatePublishForm,
|
||||
|
@ -90,7 +92,12 @@ function PublishForm(props: Props) {
|
|||
|
||||
// If they are editing, they don't need a new file chosen
|
||||
const formValidLessFile =
|
||||
name && isNameValid(name, false) && title && bid && !(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
||||
name &&
|
||||
isNameValid(name, false) &&
|
||||
title &&
|
||||
bid &&
|
||||
!bidError &&
|
||||
!(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
||||
const formValid = editingURI && !filePath ? isStillEditing && formValidLessFile : formValidLessFile;
|
||||
|
||||
let submitLabel;
|
||||
|
|
|
@ -6,6 +6,7 @@ const select = state => ({
|
|||
name: makeSelectPublishFormValue('name')(state),
|
||||
title: makeSelectPublishFormValue('title')(state),
|
||||
bid: makeSelectPublishFormValue('bid')(state),
|
||||
bidError: makeSelectPublishFormValue('bidError')(state),
|
||||
editingUri: makeSelectPublishFormValue('editingUri')(state),
|
||||
uploadThumbnailStatus: makeSelectPublishFormValue('uploadThumbnailStatus')(state),
|
||||
isStillEditing: selectIsStillEditing(state),
|
||||
|
|
|
@ -7,6 +7,7 @@ type Props = {
|
|||
title: ?string,
|
||||
name: ?string,
|
||||
bid: ?string,
|
||||
bidError: ?string,
|
||||
editingURI: ?string,
|
||||
filePath: ?string,
|
||||
isStillEditing: boolean,
|
||||
|
@ -14,7 +15,7 @@ type Props = {
|
|||
};
|
||||
|
||||
function PublishFormErrors(props: Props) {
|
||||
const { name, title, bid, editingURI, filePath, isStillEditing, uploadThumbnailStatus } = props;
|
||||
const { name, title, bid, bidError, editingURI, filePath, isStillEditing, uploadThumbnailStatus } = props;
|
||||
|
||||
// These are extra help
|
||||
// If there is an error it will be presented as an inline error as well
|
||||
|
@ -24,6 +25,7 @@ function PublishFormErrors(props: Props) {
|
|||
{!name && <div>{__('A URL is required')}</div>}
|
||||
{!isNameValid(name, false) && INVALID_NAME_ERROR}
|
||||
{!bid && <div>{__('A deposit amount is required')}</div>}
|
||||
{bidError && <div>{__('Please check your deposit amount.')}</div>}
|
||||
{uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS && (
|
||||
<div>{__('Please wait for thumbnail to finish uploading')}</div>
|
||||
)}
|
||||
|
|
|
@ -62,15 +62,16 @@ function PublishName(props: Props) {
|
|||
let bidError;
|
||||
if (bid === 0) {
|
||||
bidError = __('Deposit cannot be 0');
|
||||
} else if (totalAvailableBidAmount === bid) {
|
||||
bidError = __('Please decrease your deposit to account for transaction fees');
|
||||
} else if (totalAvailableBidAmount < bid) {
|
||||
bidError = __('Deposit cannot be higher than your balance');
|
||||
} else if (bid < MINIMUM_PUBLISH_BID) {
|
||||
bidError = __('Your deposit must be higher');
|
||||
} else if (totalAvailableBidAmount < bid) {
|
||||
bidError = __('Deposit cannot be higher than your balance');
|
||||
} else if (totalAvailableBidAmount <= bid + 0.05) {
|
||||
bidError = __('Please decrease your deposit to account for transaction fees or acquire more LBC.');
|
||||
}
|
||||
|
||||
setBidError(bidError);
|
||||
updatePublishForm({ bidError: bidError });
|
||||
}, [bid, previousBidAmount, balance]);
|
||||
|
||||
return (
|
||||
|
|
|
@ -4,7 +4,7 @@ import { isNameValid } from 'lbry-redux';
|
|||
import Button from 'component/button';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
import { INVALID_NAME_ERROR } from 'constants/claim';
|
||||
export const DEFAULT_BID_FOR_FIRST_CHANNEL = 0.5;
|
||||
export const DEFAULT_BID_FOR_FIRST_CHANNEL = 0.01;
|
||||
|
||||
type Props = {
|
||||
createChannel: (string, number) => void,
|
||||
|
|
Loading…
Reference in a new issue