Reuse BidHelpText for reposts

This commit is contained in:
Franco Montenegro 2021-08-06 18:01:04 -03:00 committed by infinite-persistence
parent cd4c1efd70
commit c2b51127ac

View file

@ -15,6 +15,7 @@ import ClaimPreview from 'component/claimPreview';
import { URL as SITE_URL, URL_LOCAL, URL_DEV } from 'config'; import { URL as SITE_URL, URL_LOCAL, URL_DEV } from 'config';
import HelpLink from 'component/common/help-link'; import HelpLink from 'component/common/help-link';
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp'; import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
import BidHelpText from 'component/publishBid/bid-help-text';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
type Props = { type Props = {
@ -77,7 +78,6 @@ function RepostCreate(props: Props) {
const [repostBid, setRepostBid] = React.useState(0.01); const [repostBid, setRepostBid] = React.useState(0.01);
const [repostBidError, setRepostBidError] = React.useState(undefined); const [repostBidError, setRepostBidError] = React.useState(undefined);
const [takeoverAmount, setTakeoverAmount] = React.useState(0);
const [enteredRepostName, setEnteredRepostName] = React.useState(defaultName); const [enteredRepostName, setEnteredRepostName] = React.useState(defaultName);
const [available, setAvailable] = React.useState(true); const [available, setAvailable] = React.useState(true);
const [enteredContent, setEnteredContentUri] = React.useState(undefined); const [enteredContent, setEnteredContentUri] = React.useState(undefined);
@ -189,10 +189,9 @@ function RepostCreate(props: Props) {
: Number(passedRepostAmount) + 0.01; : Number(passedRepostAmount) + 0.01;
if (repostTakeoverAmount) { if (repostTakeoverAmount) {
setTakeoverAmount(Number(repostTakeoverAmount.toFixed(2)));
setAutoRepostBid(repostTakeoverAmount); setAutoRepostBid(repostTakeoverAmount);
} }
}, [setTakeoverAmount, enteredRepostAmount, passedRepostAmount]); }, [enteredRepostAmount, passedRepostAmount]);
// repost bid error // repost bid error
React.useEffect(() => { React.useEffect(() => {
@ -381,9 +380,11 @@ function RepostCreate(props: Props) {
error={repostBidError} error={repostBidError}
helper={ helper={
<> <>
{__('Winning amount: %amount%', { <BidHelpText
amount: Number(takeoverAmount).toFixed(2), uri={'lbry://' + enteredRepostName}
})} amountNeededForTakeover={enteredRepostAmount}
isResolvingUri={isResolvingEnteredRepost}
/>
<WalletSpendableBalanceHelp inline /> <WalletSpendableBalanceHelp inline />
</> </>
} }