From f351c9eedf98f717b51bc27334c368d56c92827d Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 11 Feb 2020 18:00:29 -0500 Subject: [PATCH] fix advanced section collapsing after changing claim name --- ui/modal/modalRepost/view.jsx | 51 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/ui/modal/modalRepost/view.jsx b/ui/modal/modalRepost/view.jsx index 0fac91d08..5aaed7e30 100644 --- a/ui/modal/modalRepost/view.jsx +++ b/ui/modal/modalRepost/view.jsx @@ -74,6 +74,12 @@ function ModalRepost(props: Props) { repostNameError = __('You already have a claim with this name.'); } + React.useEffect(() => { + if ((repostNameError || repostNameError) && !showAdvanced) { + setShowAdvanced(true); + } + }, [repostBidError, repostNameError, showAdvanced, setShowAdvanced]); + const channelStrings = channels && channels.map(channel => channel.permanent_url).join(','); React.useEffect(() => { if (!repostChannel && channelStrings) { @@ -111,7 +117,6 @@ function ModalRepost(props: Props) { doHideModal(); } - const showAdvancedSection = showAdvanced || repostNameError || repostBidError; return ( setRepostChannel(newChannel)} /> -
- {!showAdvancedSection && ( + {!showAdvanced && ( +
- {showAdvancedSection && ( +
+ )} + + {showAdvanced && ( - - - -
{`lbry://${ - !repostChannel || repostChannel === CHANNEL_NEW ? '' : `${repostChannel}/` - }`}
-
- setRepostName(event.target.value)} - /> -
+ + + + +
{`lbry://${ + !repostChannel || repostChannel === CHANNEL_NEW ? '' : `${repostChannel}/` + }`}
+
+ setRepostName(event.target.value)} + /> +
+
+