0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-21 21:48: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("/")]
pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
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<HttpResponse, Box<dyn std:
#[get("/about")]
pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
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()

View File

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

View File

@ -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<String>) -> Markup {
html!(
(header(colorscheme, theme))
(header(colorscheme, theme, animation))
main class="about-container"{
article {
div{

View File

@ -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<String>) -> 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()))

View File

@ -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<String>) -> 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{

View File

@ -22,11 +22,12 @@ use crate::{
pub fn search(
colorscheme: &str,
theme: &str,
animation: &Option<String>,
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{

View File

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