Skip to content

Commit

Permalink
👀🔍 showing search queries
Browse files Browse the repository at this point in the history
  • Loading branch information
undergroundwires committed Jan 11, 2020
1 parent 92f1a36 commit 97a7747
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
## Unreleased

- Fixed search bug
- Hiding grouping while searching
- Hiding grouping while searching
- Showing search queries when searching

## [0.4.0] - 2020-01-11

Expand Down
28 changes: 23 additions & 5 deletions src/presentation/Scripts/TheScripts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
</div>
<div class="scripts">
<div v-if="!isSearching || searchHasMatches">
<CardList v-if="showCards" />
<div v-else-if="showList" class="tree">
<CardList v-if="this.showCards" />
<div v-else-if="this.showList" class="tree">
<div v-if="this.isSearching" class="search-query">
Searching for "{{this.searchQuery | threeDotsTrim}}"</div>
<ScriptsTree />
</div>
</div>
<div v-else class="search-no-matches">
Search has no matches 😞
Sorry, no matches for "{{this.searchQuery | threeDotsTrim}}" 😞
Feel free to extend the scripts <a :href="repositoryUrl" target="_blank" class="child github" >here</a>.
</div>
</div>
Expand All @@ -41,11 +43,21 @@
ScriptsTree,
CardList,
},
filters: {
threeDotsTrim(query: string) {
const threshold = 30;
if (query.length <= threshold - 3) {
return query;
}
return `${query.substr(0, threshold)}...`;
},
},
})
export default class TheScripts extends StatefulVue {
public showCards = false;
public showList = false;
public repositoryUrl = '';
private searchQuery = '';
private isSearching = false;
private searchHasMatches = false;
Expand All @@ -59,6 +71,7 @@
this.updateGroups();
});
state.filter.filtered.on((result: IFilterResult) => {
this.searchQuery = result.query;
this.isSearching = true;
this.searchHasMatches = result.hasAnyMatches();
this.updateGroups();
Expand Down Expand Up @@ -97,8 +110,13 @@
}
.tree {
padding-left: 3%;
margin-top: 15px; // Card margin
margin-bottom: 15px; // Card margin
padding-top: 15px;
padding-bottom: 15px;
.search-query {
display: flex;
justify-content: center;
color: $gray;
}
}
}
.help-container {
Expand Down

0 comments on commit 97a7747

Please sign in to comment.