Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class AddWebLink extends React.Component {
super(props);
this.state = {
webLink: '',
webLinkEmpty: false,
};

this.onUpdateWebLink = this.onUpdateWebLink.bind(this);
Expand All @@ -32,6 +33,11 @@ export default class AddWebLink extends React.Component {
// Set web link
onUpdateWebLink(e) {
e.preventDefault();
if (e.target.value) {
this.setState({
webLinkEmpty: false,
});
}
this.setState({ webLink: e.target.value });
}

Expand Down Expand Up @@ -62,6 +68,11 @@ export default class AddWebLink extends React.Component {
tokenV3,
} = this.props;
const { webLink } = this.state;
if (!webLink) {
this.setState({
webLinkEmpty: true,
});
}
if (webLink && this.isWebLinkValid() && !this.webLinkExist()) {
addWebLink(handle, tokenV3, webLink);
}
Expand All @@ -82,7 +93,7 @@ export default class AddWebLink extends React.Component {
}

render() {
const { webLink } = this.state;
const { webLink, webLinkEmpty } = this.state;

const webLinkValid = this.isWebLinkValid();
const webLinkExist = this.webLinkExist();
Expand Down Expand Up @@ -172,6 +183,15 @@ export default class AddWebLink extends React.Component {
onKeyDown={this.onAddWebLink}
required
/>
{
webLinkEmpty && (
<div styleName="form-input-error">
<p>
Please Enter External Link
</p>
</div>
)
}
{
!webLinkValid && !webLinkExist
&& (
Expand Down