diff --git a/public/images/info.svg b/public/images/info.svg new file mode 100644 index 0000000..0007caf --- /dev/null +++ b/public/images/info.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/no_results.gif b/public/images/no_results.gif new file mode 100644 index 0000000..1336f4c Binary files /dev/null and b/public/images/no_results.gif differ diff --git a/public/images/warning.svg b/public/images/warning.svg new file mode 100644 index 0000000..4139fb2 --- /dev/null +++ b/public/images/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/static/error_box.js b/public/static/error_box.js new file mode 100644 index 0000000..1e2e874 --- /dev/null +++ b/public/static/error_box.js @@ -0,0 +1,7 @@ +/** + * This function provides the ability for the button to toggle the dropdown error-box + * in the search page. + */ +function toggleErrorBox() { + document.querySelector('.dropdown_error_box').classList.toggle('show') +} diff --git a/public/static/themes/simple.css b/public/static/themes/simple.css index 0144e34..37e3c21 100644 --- a/public/static/themes/simple.css +++ b/public/static/themes/simple.css @@ -70,15 +70,90 @@ body { filter: brightness(1.2); } +.result_not_found { + display: flex; + flex-direction: column; + font-size: 1.5rem; + color: var(--foreground-color); +} + +.result_not_found p { + margin: 1rem 0; +} + +.result_not_found ul { + margin: 1rem 0; +} + +.result_not_found img { + width: 40rem; +} + +/* styles for the error box */ +.error_box .error_box_toggle_button { + background: var(--foreground-color); +} + +.error_box .dropdown_error_box { + position: absolute; + display: none; + flex-direction: column; + background: var(--background-color); + border-radius: 0; + margin-left: 2rem; + min-height: 20rem; + min-width: 22rem; +} +.error_box .dropdown_error_box.show { + display: flex; +} +.error_box .dropdown_error_box .error_item, +.error_box .dropdown_error_box .no_errors { + display: flex; + align-items: center; + color: var(--foreground-color); + letter-spacing: 0.1rem; + padding: 1rem; + font-size: 1.2rem; +} +.error_box .dropdown_error_box .error_item { + justify-content: space-between; +} +.error_box .dropdown_error_box .no_errors { + min-height: 18rem; + justify-content: center; +} + +.error_box .dropdown_error_box .error_item:hover { + box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.1); +} + +.error_box .error_item .severity_color { + width: 1.2rem; + height: 1.2rem; +} + /* styles for the footer and header */ -header { - background: var(--background-color); +header, +footer { width: 100%; + background: var(--background-color); display: flex; - justify-content: right; - align-items: center; padding: 1rem; + align-items: center; +} + +header { + justify-content: space-between; +} + +header h1 a { + text-transform: capitalize; + text-decoration: none; + color: var(--foreground-color); + letter-spacing: 0.1rem; + margin-left: 1rem; } header ul, @@ -121,13 +196,8 @@ footer div { } footer { - background: var(--background-color); - width: 100%; - padding: 1rem; - display: flex; flex-direction: column; justify-content: center; - align-items: center; } /* Styles for the search page */ diff --git a/public/templates/bar.html b/public/templates/bar.html new file mode 100644 index 0000000..489b075 --- /dev/null +++ b/public/templates/bar.html @@ -0,0 +1,3 @@ + {{>footer}} diff --git a/public/templates/search.html b/public/templates/search.html index ff771f1..e6fd4e8 100644 --- a/public/templates/search.html +++ b/public/templates/search.html @@ -1,8 +1,8 @@ {{>header this.style}}
- {{>search_bar}} + {{>search_bar this}}
- {{#each results}} + {{#if results}} {{#each results}}

{{{this.title}}}

{{{this.url}}} @@ -13,13 +13,27 @@ {{/each}}
- {{/each}} + {{/each}} {{else}} +
+

Your search - {{{this.pageQuery}}} - did not match any documents.

+

Suggestions:

+ + Man fishing gif +
+ {{/if}}
+ {{>footer}} diff --git a/public/templates/search_bar.html b/public/templates/search_bar.html index 32cc8ff..8bb6bd9 100644 --- a/public/templates/search_bar.html +++ b/public/templates/search_bar.html @@ -1,9 +1,27 @@ - diff --git a/src/results/aggregation_models.rs b/src/results/aggregation_models.rs index b4a780c..e985765 100644 --- a/src/results/aggregation_models.rs +++ b/src/results/aggregation_models.rs @@ -63,10 +63,12 @@ impl SearchResult { } } +/// #[derive(Serialize, Deserialize)] pub struct EngineErrorInfo { pub error: String, pub engine: String, + pub severity_color: String, } impl EngineErrorInfo { @@ -78,6 +80,11 @@ impl EngineErrorInfo { EngineError::UnexpectedError => String::from("UnexpectedError"), }, engine, + severity_color: match error { + EngineError::RequestError => String::from("green"), + EngineError::EmptyResultSet => String::from("blue"), + EngineError::UnexpectedError => String::from("red"), + }, } } }