fix advanced section collapsing after changing claim name
This commit is contained in:
parent
3ad923b4f8
commit
f351c9eedf
1 changed files with 30 additions and 21 deletions
|
@ -74,6 +74,12 @@ function ModalRepost(props: Props) {
|
||||||
repostNameError = __('You already have a claim with this name.');
|
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(',');
|
const channelStrings = channels && channels.map(channel => channel.permanent_url).join(',');
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!repostChannel && channelStrings) {
|
if (!repostChannel && channelStrings) {
|
||||||
|
@ -111,7 +117,6 @@ function ModalRepost(props: Props) {
|
||||||
doHideModal();
|
doHideModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
const showAdvancedSection = showAdvanced || repostNameError || repostBidError;
|
|
||||||
return (
|
return (
|
||||||
<Modal isOpen type="card" onAborted={handleCloseModal} onConfirmed={handleCloseModal}>
|
<Modal isOpen type="card" onAborted={handleCloseModal} onConfirmed={handleCloseModal}>
|
||||||
<Card
|
<Card
|
||||||
|
@ -137,28 +142,32 @@ function ModalRepost(props: Props) {
|
||||||
channel={repostChannel}
|
channel={repostChannel}
|
||||||
onChannelChange={newChannel => setRepostChannel(newChannel)}
|
onChannelChange={newChannel => setRepostChannel(newChannel)}
|
||||||
/>
|
/>
|
||||||
<div className="section__actions">
|
{!showAdvanced && (
|
||||||
{!showAdvancedSection && (
|
<div className="section__actions">
|
||||||
<Button button="link" label={__('Advanced')} onClick={() => setShowAdvanced(true)} />
|
<Button button="link" label={__('Advanced')} onClick={() => setShowAdvanced(true)} />
|
||||||
)}
|
</div>
|
||||||
</div>
|
)}
|
||||||
{showAdvancedSection && (
|
|
||||||
|
{showAdvanced && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
<fieldset-section>
|
||||||
<fieldset-section>
|
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||||
<label>{__('Name')}</label>
|
<fieldset-section>
|
||||||
<div className="form-field__prefix">{`lbry://${
|
<label>{__('Name')}</label>
|
||||||
!repostChannel || repostChannel === CHANNEL_NEW ? '' : `${repostChannel}/`
|
<div className="form-field__prefix">{`lbry://${
|
||||||
}`}</div>
|
!repostChannel || repostChannel === CHANNEL_NEW ? '' : `${repostChannel}/`
|
||||||
</fieldset-section>
|
}`}</div>
|
||||||
<FormField
|
</fieldset-section>
|
||||||
type="text"
|
<FormField
|
||||||
name="repost_name"
|
type="text"
|
||||||
value={repostName}
|
name="repost_name"
|
||||||
error={repostNameError}
|
value={repostName}
|
||||||
onChange={event => setRepostName(event.target.value)}
|
error={repostNameError}
|
||||||
/>
|
onChange={event => setRepostName(event.target.value)}
|
||||||
</fieldset-group>
|
/>
|
||||||
|
</fieldset-group>
|
||||||
|
</fieldset-section>
|
||||||
|
|
||||||
<div className="form-field__help">
|
<div className="form-field__help">
|
||||||
<I18nMessage
|
<I18nMessage
|
||||||
tokens={{
|
tokens={{
|
||||||
|
|
Loading…
Add table
Reference in a new issue