From 12bb8d69c149adc6b62c306bc3dc7d2dc1636c9b Mon Sep 17 00:00:00 2001 From: Agahnim Date: Wed, 13 May 2026 14:44:57 +0200 Subject: [PATCH] about: add about page and I did smth else but I can't remember --- src/main.rs | 3 ++- src/templates/about.rs | 33 +++++++++++++++++++++++++++++++++ src/templates/mod.rs | 1 + static/style.css | 5 ++--- templates/about.html | 3 +++ templates/partials/about.html | 3 +++ templates/partials/music.html | 28 ++++++++++------------------ 7 files changed, 54 insertions(+), 22 deletions(-) create mode 100644 src/templates/about.rs create mode 100644 templates/about.html create mode 100644 templates/partials/about.html diff --git a/src/main.rs b/src/main.rs index f1b890e..5918143 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use agahnim_web_v2::{ domain::AppState, - templates::{home::home, music::music, notfound::notfound}, + templates::{about::about, home::home, music::music, notfound::notfound}, }; use axum::{Router, routing::get}; use tower_http::services::ServeDir; @@ -16,6 +16,7 @@ async fn main() { let app = Router::new() .route("/home", get(home)) .route("/music", get(music)) + .route("/about", get(about)) .nest_service("/static", ServeDir::new("static")) .fallback(notfound) .with_state(state); diff --git a/src/templates/about.rs b/src/templates/about.rs new file mode 100644 index 0000000..f85488d --- /dev/null +++ b/src/templates/about.rs @@ -0,0 +1,33 @@ +use askama::Template; +use axum::{ + extract::State, + http::HeaderMap, + response::{Html, IntoResponse}, +}; +use std::sync::Arc; + +use crate::domain::AppState; + +#[derive(Template)] +#[template(path = "about.html")] +struct AboutTemplate<'a> { + tracks: &'a Vec, +} + +#[derive(Template)] +#[template(path = "partials/about.html")] +struct AboutPartialTemplate {} + +pub async fn about(headers: HeaderMap, state: State>) -> impl IntoResponse { + if headers.contains_key("hx-request") { + Html(AboutPartialTemplate {}.render().unwrap()) + } else { + Html( + AboutTemplate { + tracks: &state.mp_tracks, + } + .render() + .unwrap(), + ) + } +} diff --git a/src/templates/mod.rs b/src/templates/mod.rs index d7a6e83..3827f9c 100644 --- a/src/templates/mod.rs +++ b/src/templates/mod.rs @@ -1,3 +1,4 @@ +pub mod about; pub mod home; pub mod music; pub mod notfound; diff --git a/static/style.css b/static/style.css index ed7dcee..5c7a236 100644 --- a/static/style.css +++ b/static/style.css @@ -217,8 +217,8 @@ table { } body { - background-size: cover; background-position: center; + background-size: auto; min-height: 100lvh; width: 100lvw; overflow: auto; @@ -231,7 +231,6 @@ body { &:has(#content music) { background-image: url(assets/gifs/hmmmbg.gif); - background-size: auto; } &:has(#content katcenkat) { @@ -687,7 +686,7 @@ music { z-index: -1; pointer-events: none; font-size: 10rem; - animation: fadeInNOut 10s infinite; + animation: fadeInNOut 5s infinite; vertical-marquee-inner { position: absolute; diff --git a/templates/about.html b/templates/about.html new file mode 100644 index 0000000..789c3cb --- /dev/null +++ b/templates/about.html @@ -0,0 +1,3 @@ +{% extends "base.html" %} {% block content %} {% include "partials/about.html" %} +{% endblock %} {% block miniplayer %} {% include "partials/miniplayer.html" %} +{% endblock %} \ No newline at end of file diff --git a/templates/partials/about.html b/templates/partials/about.html new file mode 100644 index 0000000..d7eb289 --- /dev/null +++ b/templates/partials/about.html @@ -0,0 +1,3 @@ + +

a

+
\ No newline at end of file diff --git a/templates/partials/music.html b/templates/partials/music.html index 76de1fe..7314a3f 100644 --- a/templates/partials/music.html +++ b/templates/partials/music.html @@ -1,9 +1,10 @@ - + Animated text 'Music' + + }); build(); + })(); \ No newline at end of file