Skip to content

Commit

Permalink
Merge pull request #301 from headwaymaps/mkirk/no-search-results
Browse files Browse the repository at this point in the history
"No search results" instead of blank text
  • Loading branch information
michaelkirk authored Jan 12, 2024
2 parents 403ed4e + ac4b1c2 commit 03b363f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions services/frontend/www-app/src/i18n/en-US/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ export default {
opening_hours_is_closed_until_tomorrow_$time: 'Closed until {time} tomorrow',
opening_hours_show_more_times: 'Show hours',
opening_hours_hide_more_times: 'Hide hours',
search_results_not_found_header: 'No results found. 😢',
search_results_not_found_subheader:
'Something missing? Consider adding it to {osmLink} so it can eventually appear here.',
};
23 changes: 22 additions & 1 deletion services/frontend/www-app/src/pages/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@
v-on:mouseleave="didHoverSearchListItem(undefined)"
v-on:click="didClickSearchListItem(place)"
/>
<q-item
class="list-item"
v-if="searchResults?.places.length === 0 && !isLoading"
>
<q-item-section>
<q-item-label>
{{ $t('search_results_not_found_header') }}
</q-item-label>
<q-item-label
class="text-weight-light"
v-html="
$t('search_results_not_found_subheader', {
osmLink:
'<a href=https://www.openstreetmap.org>OpenStreetMap</a>',
})
"
/>
</q-item-section>
</q-item>
</q-list>
</div>
</template>
Expand Down Expand Up @@ -197,7 +216,9 @@ export default defineComponent({
this.isLoading = false;
});
if (!results.bbox) {
if (results.features.length == 0) {
// no results
} else if (!results.bbox) {
console.error('search results missing bounding box');
} else if (results.bbox.length != 4) {
console.error('unexpected bbox dimensions');
Expand Down

0 comments on commit 03b363f

Please sign in to comment.