Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #959 from LiskHQ/950-show-delegates-addresses-info…
…-when-saving-to-localstorage Use search value for saving into recent searches - Closes #950
- Loading branch information
Showing
6 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
pointer-events: none; | ||
opacity: 0.5; | ||
padding: 0; | ||
width: 100%; | ||
} | ||
|
||
.input { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import localJSONStorage from './../../utils/localJSONStorage'; | ||
/* eslint-disable import/prefer-default-export */ | ||
export const saveSearch = (search) => { | ||
if (search.length === 0) return; | ||
const validSearch = search.trim(); | ||
export const saveSearch = (searchTerm, id) => { | ||
if (searchTerm.length === 0) return; | ||
const validSearch = searchTerm.trim(); | ||
|
||
const recent = localJSONStorage.get('searches', []); | ||
const updated = [validSearch].concat(recent.filter(term => term !== validSearch)).slice(0, 3); | ||
|
||
const searchObj = { | ||
searchTerm: validSearch, | ||
id, | ||
}; | ||
const updated = [searchObj].concat(recent.filter(term => typeof term === 'object' && term.searchTerm !== validSearch)).slice(0, 3); | ||
localJSONStorage.set('searches', updated); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters