Add filter for shared state (#531)

* Add shared filter to bookmark search model

* Add shared filter UI

* Implement shared filter

* Add API test

* Use radio buttons

* Rename shared parameter

* Improve radio button CSS
This commit is contained in:
Sascha Ißbrücker
2023-09-10 23:14:07 +03:00
committed by GitHub
parent b7ddee2d93
commit ffcc40b227
14 changed files with 168 additions and 24 deletions

View File

@@ -103,7 +103,7 @@
}
// Recent search suggestions
const search = searchHistory.getRecentSearches(value, 5).map(value => ({
const recentSearches = searchHistory.getRecentSearches(value, 5).map(value => ({
type: 'search',
index: nextIndex(),
label: value,
@@ -132,7 +132,7 @@
})
}
updateSuggestions(search, bookmarks, tagSuggestions)
updateSuggestions(recentSearches, bookmarks, tagSuggestions)
if (hasSuggestions()) {
open()
@@ -143,17 +143,17 @@
const debouncedLoadSuggestions = debounce(loadSuggestions)
function updateSuggestions(search, bookmarks, tagSuggestions) {
search = search || []
function updateSuggestions(recentSearches, bookmarks, tagSuggestions) {
recentSearches = recentSearches || []
bookmarks = bookmarks || []
tagSuggestions = tagSuggestions || []
suggestions = {
search,
recentSearches,
bookmarks,
tags: tagSuggestions,
total: [
...tagSuggestions,
...search,
...recentSearches,
...bookmarks,
]
}
@@ -215,10 +215,10 @@
</li>
{/each}
{#if suggestions.search.length > 0}
{#if suggestions.recentSearches.length > 0}
<li class="menu-item group-item">Recent Searches</li>
{/if}
{#each suggestions.search as suggestion}
{#each suggestions.recentSearches as suggestion}
<li class="menu-item" class:selected={selectedIndex === suggestion.index}>
<a href="#" on:mousedown|preventDefault={() => completeSuggestion(suggestion)}>
{suggestion.label}