mirror of
https://github.com/Lissy93/dashy.git
synced 2026-01-02 14:03:55 +01:00
working category filter on widgets
This commit is contained in:
parent
1a42d766f8
commit
600f00ea5e
4 changed files with 14 additions and 6 deletions
|
|
@ -105,9 +105,8 @@ const HomeMixin = {
|
|||
const visibleTiles = allTiles.filter((tile) => checkItemVisibility(tile));
|
||||
return searchTiles(visibleTiles, this.searchValue);
|
||||
},
|
||||
|
||||
filterWidgets(allWidgets) {
|
||||
return searchWidgets(allWidgets);
|
||||
return searchWidgets(allWidgets, this.searchValue);
|
||||
},
|
||||
|
||||
/* Checks if any sections or items use icons from a given CDN */
|
||||
|
|
|
|||
|
|
@ -53,7 +53,13 @@ export const searchTiles = (allTiles, searchTerm) => {
|
|||
|
||||
export const searchWidgets = (allWidgets, searchTerm) => {
|
||||
if (!searchTerm) return allWidgets;
|
||||
return allWidgets;
|
||||
if (!allWidgets) return [];
|
||||
return allWidgets.filter((tile) => {
|
||||
const {
|
||||
options,
|
||||
} = tile;
|
||||
return filterHelper(options.category, searchTerm);
|
||||
});
|
||||
};
|
||||
|
||||
/* From a list of search bangs, return the URL associated with it */
|
||||
|
|
|
|||
|
|
@ -35,7 +35,9 @@
|
|||
@itemClicked="finishedSearching()"
|
||||
@change-modal-visibility="updateModalVisibility"
|
||||
:isWide="!!singleSectionView || layoutOrientation === 'horizontal'"
|
||||
:class="(searchValue && section.filteredItems.length === 0) ? 'no-results' : ''"
|
||||
:class="(searchValue &&
|
||||
section.filteredItems.length === 0 &&
|
||||
(!section.widgets || section.widgets.length === 0)) ? 'no-results' : ''"
|
||||
/>
|
||||
</template>
|
||||
<!-- Show add new section button, in edit mode -->
|
||||
|
|
|
|||
|
|
@ -66,11 +66,12 @@ sections:
|
|||
timeZone: Pacific/Auckland
|
||||
format: en-NZ
|
||||
hideDate: false
|
||||
label: "Test Label"
|
||||
label: Test Label
|
||||
- type: clock
|
||||
options:
|
||||
timeZone: Pacific/Auckland
|
||||
format: en-NZ
|
||||
hideDate: false
|
||||
label: "Test Label 2"
|
||||
label: Test Label 2
|
||||
category: timer
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue