primitive not found page (better than nothing)

This commit is contained in:
2026-04-09 16:00:52 +02:00
parent a326d5f17d
commit 9fa19d6caf
2 changed files with 29 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ pub mod dashboard;
pub mod index; pub mod index;
pub mod login; pub mod login;
pub mod logs; pub mod logs;
pub mod notfound;
pub mod persons; pub mod persons;
pub mod quotes; pub mod quotes;
pub mod tags; pub mod tags;
@@ -35,6 +36,8 @@ pub fn pages() -> Router {
.route("/quotes", get(quotes::page)) .route("/quotes", get(quotes::page))
.route("/quotes/add", get(quotes::add::page)) .route("/quotes/add", get(quotes::add::page))
.route("/quotes/add-form", post(quotes::add::form)) .route("/quotes/add-form", post(quotes::add::form))
//
.fallback(notfound::page)
} }
pub fn base(title: &str, inner: Markup) -> Markup { pub fn base(title: &str, inner: Markup) -> Markup {

26
src/web/pages/notfound.rs Normal file
View File

@@ -0,0 +1,26 @@
use axum::extract::Request;
use maud::{Markup, html};
use crate::{
error::CompositeError,
users::{User, auth::UserAuthenticate},
web::{components::nav::nav, pages::base},
};
pub async fn page(req: Request) -> Result<Markup, CompositeError> {
let u = User::authenticate(req.headers()).ok().flatten();
Ok(base(
"Not Found | Mnemosyne",
html!(
(nav(u.as_ref(), req.uri().path()))
div class="mx-auto max-w-4xl px-2 mt-8 mb-2" {
h1 class="text-4xl font-lora font-semibold mb-1" { "Not Found" }
p class="text-neutral-400 font-light" {
"No page found under"
span class="font-mono mx-1 px-1 py-.5 border border-neutral-200/25 rounded bg-neutral-950/25" {(req.uri().path())}
}
}
),
))
}