FIX: Stop displaying empty topics message on empty search term

When no topics found with a search term and the search term was cleared,
the no topics error would show. This commit fixes that behavior by
putting the error inside the loading component.
This commit is contained in:
Justin DiRose 2020-02-06 09:41:29 -06:00
parent cf0d3d62c1
commit 2084327a2f
1 changed files with 68 additions and 68 deletions

View File

@ -3,76 +3,76 @@
searchTerm=(readonly searchTerm)
onSearch=(action "performSearch")
}}
{{#if emptyTopics}}
<span class="no-topics-found">{{i18n 'knowledge_explorer.no_topics'}}</span>
{{else}}
{{#conditional-loading-spinner condition=isLoading}}
<div class="knowledge-explorer-browse">
{{#if site.mobileView}}
{{#unless selectedTopic}}
{{d-button class="knowledge-explorer-expander" icon=(if expandedFilters "angle-up" "angle-down") action=(action "toggleFilters") label="knowledge_explorer.filter_button"}}
{{/unless}}
{{/if}}
<div class="knowledge-explorer-filters">
{{#if expandedFilters}}
{{#if categories}}
<div class="knowledge-explorer-items knowledge-explorer-categories">
<h3>{{i18n 'knowledge_explorer.categories'}}</h3>
{{#each categories as |category|}}
{{knowledge-explorer-category
category=category
selectCategory=(action "updateSelectedCategories"
tagName="")
}}
{{/each}}
</div>
{{/if}}
{{#if tags}}
<div class="knowledge-explorer-items knowledge-explorer-tags">
<h3>{{i18n 'knowledge_explorer.tags'}}</h3>
{{#each tags as |tag|}}
{{knowledge-explorer-tag
tag=tag
selectTag=(action "updateSelectedTags")
}}
{{/each}}
</div>
{{/if}}
{{/if}}
</div>
{{#if selectedTopic}}
{{#conditional-loading-spinner condition=isTopicLoading}}
{{knowledge-explorer-topic topic=topic}}
{{/conditional-loading-spinner}}
{{else}}
<div class="knowledge-explorer-results">
{{#if isSearching}}
{{#if emptySearchResults}}
<div class="result-count no-result">
{{i18n 'search.no_results'}}
</div>
{{else}}
<div class="result-count">
{{i18n 'knowledge_explorer.search.results'
count=searchCount
{{#conditional-loading-spinner condition=isLoading}}
{{#if emptyTopics}}
<span class="no-topics-found">{{i18n 'knowledge_explorer.no_topics'}}</span>
{{else}}
<div class="knowledge-explorer-browse">
{{#if site.mobileView}}
{{#unless selectedTopic}}
{{d-button class="knowledge-explorer-expander" icon=(if expandedFilters "angle-up" "angle-down") action=(action "toggleFilters") label="knowledge_explorer.filter_button"}}
{{/unless}}
{{/if}}
<div class="knowledge-explorer-filters">
{{#if expandedFilters}}
{{#if categories}}
<div class="knowledge-explorer-items knowledge-explorer-categories">
<h3>{{i18n 'knowledge_explorer.categories'}}</h3>
{{#each categories as |category|}}
{{knowledge-explorer-category
category=category
selectCategory=(action "updateSelectedCategories"
tagName="")
}}
</div>
{{/if}}
{{/each}}
</div>
{{/if}}
{{#if tags}}
<div class="knowledge-explorer-items knowledge-explorer-tags">
<h3>{{i18n 'knowledge_explorer.tags'}}</h3>
{{#each tags as |tag|}}
{{knowledge-explorer-tag
tag=tag
selectTag=(action "updateSelectedTags")
}}
{{/each}}
</div>
{{/if}}
{{#unless emptySearchResults}}
{{knowledge-explorer-topic-list
topics=topics
ascending=ascending
order=orderColumn
sortBy=(action "sortBy")
selectTopic=(action "setSelectedTopic")
loadMore=(action "loadMore")
loading=isLoadingMore
}}
{{/unless}}
</div>
{{/if}}
</div>
{{/conditional-loading-spinner}}
{{/if}}
{{#if selectedTopic}}
{{#conditional-loading-spinner condition=isTopicLoading}}
{{knowledge-explorer-topic topic=topic}}
{{/conditional-loading-spinner}}
{{else}}
<div class="knowledge-explorer-results">
{{#if isSearching}}
{{#if emptySearchResults}}
<div class="result-count no-result">
{{i18n 'search.no_results'}}
</div>
{{else}}
<div class="result-count">
{{i18n 'knowledge_explorer.search.results'
count=searchCount
}}
</div>
{{/if}}
{{/if}}
{{#unless emptySearchResults}}
{{knowledge-explorer-topic-list
topics=topics
ascending=ascending
order=orderColumn
sortBy=(action "sortBy")
selectTopic=(action "setSelectedTopic")
loadMore=(action "loadMore")
loading=isLoadingMore
}}
{{/unless}}
</div>
{{/if}}
</div>
{{/if}}
{{/conditional-loading-spinner}}
</div>