0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-22 05:58:21 -05:00

feat: pass the new animation config option (#424)

This commit is contained in:
neon_arch 2023-12-12 15:04:44 +03:00
parent 7206e7d6a1
commit 1a2a833597
7 changed files with 25 additions and 10 deletions

View File

@ -13,7 +13,12 @@ use std::fs::read_to_string;
#[get("/")] #[get("/")]
pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> { pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
Ok(HttpResponse::Ok().body( 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( crate::templates::views::not_found::not_found(
&config.style.colorscheme, &config.style.colorscheme,
&config.style.theme, &config.style.theme,
&config.style.animation,
) )
.0, .0,
)) ))
@ -47,7 +53,12 @@ pub async fn robots_data(_req: HttpRequest) -> Result<HttpResponse, Box<dyn std:
#[get("/about")] #[get("/about")]
pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> { pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
Ok(HttpResponse::Ok().body( 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( crate::templates::views::settings::settings(
&config.style.colorscheme, &config.style.colorscheme,
&config.style.theme, &config.style.theme,
&config.style.animation,
&config &config
.upstream_search_engines .upstream_search_engines
.keys() .keys()

View File

@ -72,6 +72,7 @@ pub async fn search(
crate::templates::views::search::search( crate::templates::views::search::search(
&config.style.colorscheme, &config.style.colorscheme,
&config.style.theme, &config.style.theme,
&config.style.animation,
query, query,
&results?, &results?,
) )

View File

@ -14,9 +14,9 @@ use crate::templates::partials::{footer::footer, header::header};
/// # Returns /// # Returns
/// ///
/// It returns the compiled html markup code as a result. /// 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<String>) -> Markup {
html!( html!(
(header(colorscheme, theme)) (header(colorscheme, theme, animation))
main class="about-container"{ main class="about-container"{
article { article {
div{ div{

View File

@ -14,9 +14,9 @@ use crate::templates::partials::{bar::bar, footer::footer, header::header};
/// # Returns /// # Returns
/// ///
/// It returns the compiled html markup code as a result. /// 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<String>) -> Markup {
html!( html!(
(header(colorscheme, theme)) (header(colorscheme, theme, animation))
main class="search-container"{ main class="search-container"{
img class="websurfx-logo" src="../images/websurfx_logo.svg" alt="Websurfx meta-search engine logo"; img class="websurfx-logo" src="../images/websurfx_logo.svg" alt="Websurfx meta-search engine logo";
(bar(&String::default())) (bar(&String::default()))

View File

@ -13,9 +13,9 @@ use maud::{html, Markup};
/// # Returns /// # Returns
/// ///
/// It returns the compiled html markup code as a result. /// 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<String>) -> Markup {
html!( html!(
(header(colorscheme, theme)) (header(colorscheme, theme, animation))
main class="error_container"{ main class="error_container"{
img src="images/robot-404.svg" alt="Image of broken robot."; img src="images/robot-404.svg" alt="Image of broken robot.";
.error_content{ .error_content{

View File

@ -22,11 +22,12 @@ use crate::{
pub fn search( pub fn search(
colorscheme: &str, colorscheme: &str,
theme: &str, theme: &str,
animation: &Option<String>,
query: &str, query: &str,
search_results: &SearchResults, search_results: &SearchResults,
) -> Markup { ) -> Markup {
html!( html!(
(header(colorscheme, theme)) (header(colorscheme, theme, animation))
main class="results"{ main class="results"{
(search_bar(&search_results.engine_errors_info, search_results.safe_search_level, query)) (search_bar(&search_results.engine_errors_info, search_results.safe_search_level, query))
.results_aggregated{ .results_aggregated{

View File

@ -25,10 +25,11 @@ use crate::templates::partials::{
pub fn settings( pub fn settings(
colorscheme: &str, colorscheme: &str,
theme: &str, theme: &str,
animation: &Option<String>,
engine_names: &[&String], engine_names: &[&String],
) -> Result<Markup, Box<dyn std::error::Error>> { ) -> Result<Markup, Box<dyn std::error::Error>> {
Ok(html!( Ok(html!(
(header(colorscheme, theme)) (header(colorscheme, theme, animation))
main class="settings"{ main class="settings"{
h1{"Settings"} h1{"Settings"}
hr; hr;