From e9863707d8d95b121e818c17978dc2fb4f67b27d Mon Sep 17 00:00:00 2001 From: rm-dr <96270320+rm-dr@users.noreply.github.com> Date: Tue, 4 Nov 2025 20:06:19 -0800 Subject: [PATCH] Minor tweaks --- .../service/service-webpage/css/special.scss | 44 ++++++++++--------- .../service/service-webpage/src/page/mod.rs | 12 +++-- .../service-webpage/src/pages/handouts.rs | 3 +- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/crates/service/service-webpage/css/special.scss b/crates/service/service-webpage/css/special.scss index b45d0a7..6aa3fa0 100644 --- a/crates/service/service-webpage/css/special.scss +++ b/crates/service/service-webpage/css/special.scss @@ -10,31 +10,33 @@ padding-right: 1ex; } -.handout-ul li:hover { - margin-left: 1ex; - transition: 50ms; -} +// Only do hover magic on mouse devices +@media(hover: hover) and (pointer: fine) { + .handout-ul li:hover { + margin-left: 1ex; + transition: 50ms; + } -.handout-ul li { - transition: 50ms; - transition-delay: 50ms; + .handout-ul li { + transition: 50ms; + transition-delay: 50ms; + } + + .handout-ul li:hover .handout-li-links { + display: inline-block; + opacity: 1; + transition: 100ms; + } + + .handout-ul li .handout-li-links { + transition-delay: 50ms; + transition: 100ms; + opacity: 0; + display: none; + } } -.handout-ul li:hover .handout-li-links, -.handout-ul .handout-li-desc { - display: inline-block; - opacity: 1; - transition: 100ms; -} - -.handout-ul li:hover .handout-li-desc, -.handout-ul li .handout-li-links { - transition-delay: 50ms; - transition: 100ms; - opacity: 0; - display: none; -} // Email obfuscation // Works with "{{ email_*() }}" shortcodes. diff --git a/crates/service/service-webpage/src/page/mod.rs b/crates/service/service-webpage/src/page/mod.rs index 650143a..3b0aedd 100644 --- a/crates/service/service-webpage/src/page/mod.rs +++ b/crates/service/service-webpage/src/page/mod.rs @@ -5,7 +5,7 @@ use axum::{ Router, extract::{ConnectInfo, Path, State}, - http::{HeaderValue, StatusCode, header}, + http::{HeaderMap, HeaderValue, StatusCode, header}, response::{IntoResponse, Response}, routing::get, }; @@ -83,7 +83,8 @@ impl PageMetadata { root_node: &Node, ) -> Result, serde_yaml::Error> { root_node - .children.first() + .children + .first() .and_then(|x| x.cast::()) .map(|x| serde_yaml::from_str::(&x.content)) .map_or(Ok(None), |v| v.map(Some)) @@ -298,8 +299,9 @@ impl PageServer { Path(route): Path, State(state): State>, ConnectInfo(addr): ConnectInfo, + headers: HeaderMap, ) -> Response { - trace!("Serving {route} to {}", addr.addr); + trace!(message = "Serving route", route, addr = ?addr.addr, user_agent = ?headers["user-agent"]); let now = Utc::now(); let headers = [( @@ -326,7 +328,9 @@ impl PageServer { Router::new() .route( "/", - get(|state, conn| async { Self::handler(Path(String::new()), state, conn).await }), + get(|state, conn, headers| async { + Self::handler(Path(String::new()), state, conn, headers).await + }), ) .route("/{*path}", get(Self::handler)) .with_state(self) diff --git a/crates/service/service-webpage/src/pages/handouts.rs b/crates/service/service-webpage/src/pages/handouts.rs index 0d6d595..52f382d 100644 --- a/crates/service/service-webpage/src/pages/handouts.rs +++ b/crates/service/service-webpage/src/pages/handouts.rs @@ -59,6 +59,7 @@ fn build_list_for_group(handouts: &[HandoutEntry], group: &str) -> Markup { span class="handdout-li-title" { strong { (h.title) } } + " " span class="handout-li-links" { "[ " @@ -69,7 +70,7 @@ fn build_list_for_group(handouts: &[HandoutEntry], group: &str) -> Markup { } @else { a href=(h.handout) {"handout"} } - "] " + " ]" } } }