From 3ee25f8251c1d7756db7a63e469f50ecb4f6e5aa Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Mon, 2 Mar 2020 12:11:14 -0500 Subject: [PATCH] fixes: default channel bid and publish form (#3781) Changes channel default bid and fixes publish form errors around bid amount. --- ui/component/publishForm/view.jsx | 9 ++++++++- ui/component/publishFormErrors/index.js | 1 + ui/component/publishFormErrors/view.jsx | 4 +++- ui/component/publishName/view.jsx | 9 +++++---- ui/component/userFirstChannel/view.jsx | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ui/component/publishForm/view.jsx b/ui/component/publishForm/view.jsx index b767a40be..7c8a3c8d1 100644 --- a/ui/component/publishForm/view.jsx +++ b/ui/component/publishForm/view.jsx @@ -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; diff --git a/ui/component/publishFormErrors/index.js b/ui/component/publishFormErrors/index.js index 54ddef686..b551fd140 100644 --- a/ui/component/publishFormErrors/index.js +++ b/ui/component/publishFormErrors/index.js @@ -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), diff --git a/ui/component/publishFormErrors/view.jsx b/ui/component/publishFormErrors/view.jsx index fa7792591..4845f3971 100644 --- a/ui/component/publishFormErrors/view.jsx +++ b/ui/component/publishFormErrors/view.jsx @@ -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 &&
{__('A URL is required')}
} {!isNameValid(name, false) && INVALID_NAME_ERROR} {!bid &&
{__('A deposit amount is required')}
} + {bidError &&
{__('Please check your deposit amount.')}
} {uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS && (
{__('Please wait for thumbnail to finish uploading')}
)} diff --git a/ui/component/publishName/view.jsx b/ui/component/publishName/view.jsx index 4aa7836ee..41d9bf858 100644 --- a/ui/component/publishName/view.jsx +++ b/ui/component/publishName/view.jsx @@ -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 ( diff --git a/ui/component/userFirstChannel/view.jsx b/ui/component/userFirstChannel/view.jsx index 76f2b31f4..cdd2c96eb 100644 --- a/ui/component/userFirstChannel/view.jsx +++ b/ui/component/userFirstChannel/view.jsx @@ -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,