From 1a2a8335976f04908760dff37db003f280a119ba Mon Sep 17 00:00:00 2001 From: neon_arch Date: Tue, 12 Dec 2023 15:04:44 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20pass=20the=20new=20animatio?= =?UTF-8?q?n=20config=20option=20(#424)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/router.rs | 16 ++++++++++++++-- src/server/routes/search.rs | 1 + src/templates/views/about.rs | 4 ++-- src/templates/views/index.rs | 4 ++-- src/templates/views/not_found.rs | 4 ++-- src/templates/views/search.rs | 3 ++- src/templates/views/settings.rs | 3 ++- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/server/router.rs b/src/server/router.rs index ea8387b..b9fe1d4 100644 --- a/src/server/router.rs +++ b/src/server/router.rs @@ -13,7 +13,12 @@ use std::fs::read_to_string; #[get("/")] pub async fn index(config: web::Data) -> Result> { Ok(HttpResponse::Ok().body( - crate::templates::views::index::index(&config.style.colorscheme, &config.style.theme).0, + crate::templates::views::index::index( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, )) } @@ -28,6 +33,7 @@ pub async fn not_found( crate::templates::views::not_found::not_found( &config.style.colorscheme, &config.style.theme, + &config.style.animation, ) .0, )) @@ -47,7 +53,12 @@ pub async fn robots_data(_req: HttpRequest) -> Result) -> Result> { Ok(HttpResponse::Ok().body( - crate::templates::views::about::about(&config.style.colorscheme, &config.style.theme).0, + crate::templates::views::about::about( + &config.style.colorscheme, + &config.style.theme, + &config.style.animation, + ) + .0, )) } @@ -60,6 +71,7 @@ pub async fn settings( crate::templates::views::settings::settings( &config.style.colorscheme, &config.style.theme, + &config.style.animation, &config .upstream_search_engines .keys() diff --git a/src/server/routes/search.rs b/src/server/routes/search.rs index 670ee60..84ba3de 100644 --- a/src/server/routes/search.rs +++ b/src/server/routes/search.rs @@ -72,6 +72,7 @@ pub async fn search( crate::templates::views::search::search( &config.style.colorscheme, &config.style.theme, + &config.style.animation, query, &results?, ) diff --git a/src/templates/views/about.rs b/src/templates/views/about.rs index 9ee2d6d..3f34819 100644 --- a/src/templates/views/about.rs +++ b/src/templates/views/about.rs @@ -14,9 +14,9 @@ use crate::templates::partials::{footer::footer, header::header}; /// # Returns /// /// It returns the compiled html markup code as a result. -pub fn about(colorscheme: &str, theme: &str) -> Markup { +pub fn about(colorscheme: &str, theme: &str, animation: &Option) -> Markup { html!( - (header(colorscheme, theme)) + (header(colorscheme, theme, animation)) main class="about-container"{ article { div{ diff --git a/src/templates/views/index.rs b/src/templates/views/index.rs index cfa1eb6..b2c8d2a 100644 --- a/src/templates/views/index.rs +++ b/src/templates/views/index.rs @@ -14,9 +14,9 @@ use crate::templates::partials::{bar::bar, footer::footer, header::header}; /// # Returns /// /// It returns the compiled html markup code as a result. -pub fn index(colorscheme: &str, theme: &str) -> Markup { +pub fn index(colorscheme: &str, theme: &str, animation: &Option) -> Markup { html!( - (header(colorscheme, theme)) + (header(colorscheme, theme, animation)) main class="search-container"{ img class="websurfx-logo" src="../images/websurfx_logo.svg" alt="Websurfx meta-search engine logo"; (bar(&String::default())) diff --git a/src/templates/views/not_found.rs b/src/templates/views/not_found.rs index 9e23da9..853f260 100644 --- a/src/templates/views/not_found.rs +++ b/src/templates/views/not_found.rs @@ -13,9 +13,9 @@ use maud::{html, Markup}; /// # Returns /// /// It returns the compiled html markup code as a result. -pub fn not_found(colorscheme: &str, theme: &str) -> Markup { +pub fn not_found(colorscheme: &str, theme: &str, animation: &Option) -> Markup { html!( - (header(colorscheme, theme)) + (header(colorscheme, theme, animation)) main class="error_container"{ img src="images/robot-404.svg" alt="Image of broken robot."; .error_content{ diff --git a/src/templates/views/search.rs b/src/templates/views/search.rs index 9fef7f0..07b8b42 100644 --- a/src/templates/views/search.rs +++ b/src/templates/views/search.rs @@ -22,11 +22,12 @@ use crate::{ pub fn search( colorscheme: &str, theme: &str, + animation: &Option, query: &str, search_results: &SearchResults, ) -> Markup { html!( - (header(colorscheme, theme)) + (header(colorscheme, theme, animation)) main class="results"{ (search_bar(&search_results.engine_errors_info, search_results.safe_search_level, query)) .results_aggregated{ diff --git a/src/templates/views/settings.rs b/src/templates/views/settings.rs index 7b69ac7..6da5202 100644 --- a/src/templates/views/settings.rs +++ b/src/templates/views/settings.rs @@ -25,10 +25,11 @@ use crate::templates::partials::{ pub fn settings( colorscheme: &str, theme: &str, + animation: &Option, engine_names: &[&String], ) -> Result> { Ok(html!( - (header(colorscheme, theme)) + (header(colorscheme, theme, animation)) main class="settings"{ h1{"Settings"} hr;