Skip to content

Commit

Permalink
If a user is already a delegate, don't display the form
Browse files Browse the repository at this point in the history
Solves LiskArchive#946.

Initially I attempted a redirect to the root page here so the modal
wouldn’t load if the user is a delegate. Due to the way this dialog is
opened though, that caused the dialog to quickly animate onto the page,
then disappear after the redirect was triggered. This is a quick
compromise for the UX.
  • Loading branch information
joerodrig committed Nov 16, 2017
1 parent 6f7632c commit 5152e82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions i18n/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"You can vote for up to {{count}} delegates in total.": "Du kannst insgesamt für {{count}} Delegierte stimmen.",
"You can vote for up to {{count}} delegates in total._plural": "Bis zu {{count}} Delegierte können insgesamt von einem Konto gewählt werden.",
"You have not forged any blocks yet": "Du hast noch keine Blöcke geforged",
"You have already registered as a delegate.": "Du hast bereits als Delegierter registriert.",
"You need to become a delegate to start forging. If you already registered to become a delegate, your registration hasn't been processed, yet.": "Um Blöcke forgen (erstellen) zu können, musst du Delegierter werden. Wenn du dich schon als Delegierter registriert hast, wurde deine Registrierung noch nicht verarbeitet.",
"You've received {{value}} LSK.": "Du hast {{value}} LSK erhalten.",
"Your transaction of {{amount}} LSK to {{recipientAddress}} was accepted and will be processed in a few seconds.": "Deine Transaktion von {{amount}} LSK zu {{recipientAddress}} wurde akzeptiert und wird in wenigen Sekunden verarbeitet.",
Expand Down
1 change: 1 addition & 0 deletions i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"You can select up to {{count}} delegates in one voting turn._plural": "You can select up to {{count}} delegates in one voting turn.",
"You can vote for up to {{count}} delegates in total.": "You can vote for up to {{count}} delegates in total.",
"You can vote for up to {{count}} delegates in total._plural": "You can vote for up to {{count}} delegates in total.",
"You have already registered as a delegate.": "You have already registered as a delegate.",
"You have not forged any blocks yet": "You have not forged any blocks yet",
"You need to become a delegate to start forging. If you already registered to become a delegate, your registration hasn't been processed, yet.": "You need to become a delegate to start forging. If you already registered to become a delegate, your registration hasn't been processed, yet.",
"You've received {{value}} LSK.": "You've received {{value}} LSK.",
Expand Down
11 changes: 11 additions & 0 deletions src/components/registerDelegate/registerDelegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RegisterDelegate extends React.Component {
...authStatePrefill(),
};
}

componentDidMount() {
const newState = {
name: {
Expand All @@ -40,6 +41,16 @@ class RegisterDelegate extends React.Component {
}

render() {
if (this.props.account.isDelegate) {
return (
<div>
<InfoParagraph>
{this.props.t('You have already registered as a delegate.')}
</InfoParagraph>
</div>
);
}

return (
<div>
<form onSubmit={this.register.bind(this)}>
Expand Down

0 comments on commit 5152e82

Please sign in to comment.