From 4a5dbd4091befbce3d7237244616cf906287a26c Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Mon, 16 Sep 2019 13:09:40 -0600 Subject: [PATCH] Only return books in searches; Add CTA if no search results --- app/i18n/locales/en.json | 2 ++ app/views/search/index.js | 61 ++++++--------------------------------- 2 files changed, 11 insertions(+), 52 deletions(-) diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 6f45b28..403b3f2 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -33,6 +33,8 @@ "header": "Search", "loading": "Loading...", "results_header": "Results for:", + "no_results": "None Found", + "no_results_suggestion": "If you're expecting book data, go and help fill out the Inventaire database!", "people_header": "People", "series_header": "Series", "books_header": "Books", diff --git a/app/views/search/index.js b/app/views/search/index.js index 10908e5..55184f2 100644 --- a/app/views/search/index.js +++ b/app/views/search/index.js @@ -19,7 +19,6 @@ export const searchView = (state, emit, i18n) => { return [ html`

${__('search.header')}

-

@@ -30,10 +29,13 @@ export const searchView = (state, emit, i18n) => {

${!controller.doneSearching || controller.results.works < 1 - ? null - : [ - html`

${__('search.books_header')}

`, - controller.results.works.map(result => { + ? [ + html`

${__('search.no_results')}

`, + html` + ${__('search.no_results_suggestion')} + ` + ] + : controller.results.works.map(result => { return html`

${result.name}

@@ -43,53 +45,8 @@ export const searchView = (state, emit, i18n) => { ${resultDetails(controller, result, emit)}
`; - }), - ]} - - ${controller.results.series.length < 1 - ? null - : [ - html`

${__('search.series_header')}

`, - controller.results.series.map(result => { - return html`
-
-

${result.name}

- ${result.description ? html`

${result.description}

` : null} -
- -
`; - }), - ]} - - ${controller.results.humans.length < 1 - ? null - : [ - html`

${__('search.people_header')}

`, - controller.results.humans.map(result => { - return html`
-
- ${result.image ? html`` : null} -
-
-

${result.name}

- ${result.description ? html`

${result.description}

` : null} -
- -
`; - }), - ]} + }) + }
`, ];