Skip to content

Commit

Permalink
Merge pull request #4027 from LiskHQ/4023-point-delegate-search-to-de…
Browse files Browse the repository at this point in the history
…legate-profile
  • Loading branch information
reyraa authored Dec 30, 2021
2 parents 332c3f2 + 8853657 commit 650d5bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@
"Min": "Min",
"Minimize": "Minimize",
"Missed slot": "Missed slot",
"Modify recovery phrase derivation path": "Modify recovery phrase derivation path",
"More filters": "More filters",
"Multisignature account details": "Multisignature account details",
"Multisignatures": "Multisignatures",
Expand Down
7 changes: 5 additions & 2 deletions src/components/shared/searchBar/searchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SearchBar extends React.Component {

this.onChangeSearchTextValue = this.onChangeSearchTextValue.bind(this);
this.onSelectAccount = this.onSelectedRow.bind(this, 'account');
this.onSelectDelegateAccount = this.onSelectedRow.bind(this, 'delegate-account');
this.onSelectTransaction = this.onSelectedRow.bind(this, 'transactions');
this.onSelectBlock = this.onSelectedRow.bind(this, 'block');
this.onHandleKeyPress = this.onHandleKeyPress.bind(this);
Expand Down Expand Up @@ -52,6 +53,8 @@ class SearchBar extends React.Component {
onSelectedRow(type, value) {
if (type === 'transactions') {
addSearchParamsToUrl(this.props.history, { modal: 'transactionDetails', transactionId: value });
} else if (type === 'delegate-account') {
this.props.history.push(`${routes.account.path}?${routes.account.searchParam}=${value}&tab=delegateProfile`);
} else {
this.props.history.push(`${routes[type].path}?${routes[type].searchParam}=${value}`);
}
Expand Down Expand Up @@ -81,7 +84,7 @@ class SearchBar extends React.Component {
const { rowItemIndex } = this.state;

if (addresses.length) this.onSelectAccount(addresses[rowItemIndex].address);
if (delegates.length) this.onSelectAccount(delegates[rowItemIndex].summary?.address);
if (delegates.length) this.onSelectDelegateAccount(delegates[rowItemIndex].summary?.address);
if (transactions.length) this.onSelectTransaction(transactions[rowItemIndex].id);
if (blocks.length) this.onSelectTransaction(blocks[rowItemIndex].id);
}
Expand Down Expand Up @@ -168,7 +171,7 @@ class SearchBar extends React.Component {
<Delegates
searchTextValue={searchTextValue}
delegates={suggestions.data.delegates}
onSelectedRow={this.onSelectAccount}
onSelectedRow={this.onSelectDelegateAccount}
rowItemIndex={rowItemIndex}
updateRowItemIndex={this.updateRowItemIndex}
t={t}
Expand Down

0 comments on commit 650d5bb

Please sign in to comment.