show channelName instead of full url introducing referrer channel

clear referrer modal error on close
This commit is contained in:
jessop 2020-01-16 22:38:16 -05:00 committed by Sean Yesmunt
parent 2a1144a633
commit b33695c295
2 changed files with 12 additions and 4 deletions

View file

@ -37,7 +37,7 @@ function Invited(props: Props) {
} = props; } = props;
const refUri = referrer && 'lbry://' + referrer.replace(':', '#'); const refUri = referrer && 'lbry://' + referrer.replace(':', '#');
const referrerIsChannel = parseURI(refUri).isChannel; const { isChannel: referrerIsChannel, claimName: referrerChannelName } = parseURI(refUri);
const rewardsApproved = user && user.is_reward_approved; const rewardsApproved = user && user.is_reward_approved;
const hasVerifiedEmail = user && user.has_verified_email; const hasVerifiedEmail = user && user.has_verified_email;
const referredRewardAvailable = rewards && rewards.some(reward => reward.reward_type === REWARDS.TYPE_REFEREE); const referredRewardAvailable = rewards && rewards.some(reward => reward.reward_type === REWARDS.TYPE_REFEREE);
@ -125,7 +125,7 @@ function Invited(props: Props) {
referrerIsChannel referrerIsChannel
? __( ? __(
`Content freedom and and a present from %channel_name% are waiting for you. Create an account to claim it.`, `Content freedom and and a present from %channel_name% are waiting for you. Create an account to claim it.`,
{ channel_name: referrer } { channel_name: referrerChannelName }
) )
: __(`Content freedom and a present are waiting for you. Create an account to claim it.`) : __(`Content freedom and a present are waiting for you. Create an account to claim it.`)
} }

View file

@ -29,6 +29,7 @@ class ModalSetReferrer extends React.PureComponent<Props, State> {
}; };
(this: any).handleSubmit = this.handleSubmit.bind(this); (this: any).handleSubmit = this.handleSubmit.bind(this);
(this: any).handleClose = this.handleClose.bind(this);
(this: any).handleTextChange = this.handleTextChange.bind(this); (this: any).handleTextChange = this.handleTextChange.bind(this);
} }
@ -38,6 +39,14 @@ class ModalSetReferrer extends React.PureComponent<Props, State> {
setReferrer(referrer, true); setReferrer(referrer, true);
} }
handleClose() {
const { referrerSetError, resetReferrerError, closeModal } = this.props;
if (referrerSetError) {
resetReferrerError();
}
closeModal();
}
handleTextChange(e: SyntheticInputEvent<*>) { handleTextChange(e: SyntheticInputEvent<*>) {
const { referrerSetError, resetReferrerError } = this.props; const { referrerSetError, resetReferrerError } = this.props;
@ -79,8 +88,7 @@ class ModalSetReferrer extends React.PureComponent<Props, State> {
/> />
</Form> </Form>
<div className="card__actions"> <div className="card__actions">
<Button button="primary" label={__('Done')} onClick={closeModal} /> <Button button="primary" label={__('Done')} onClick={this.handleClose} />
<Button button="link" label={__('Close')} onClick={closeModal} />
</div> </div>
</React.Fragment> </React.Fragment>
} }