Compare commits

...

3 Commits

Author SHA1 Message Date
a3f5ccfcb7 merge upstream
All checks were successful
mnemo-build-and-publish / gractwo-mnemo-build (push) Successful in 43s
2026-04-09 14:08:36 +00:00
9fa19d6caf primitive not found page (better than nothing) 2026-04-09 16:00:52 +02:00
a326d5f17d don't dead link 2026-04-09 15:31:21 +02:00
3 changed files with 30 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ use crate::{
const LINKS: &[(&str, &str, &str)] = &[ const LINKS: &[(&str, &str, &str)] = &[
("Add Quote", "/quotes/add", icons::QUOTE), ("Add Quote", "/quotes/add", icons::QUOTE),
("Add Person", "/persons/add", icons::CONTACT), ("Add Person", "/persons", icons::CONTACT),
]; ];
pub async fn page(req: Request) -> Result<Markup, CompositeError> { pub async fn page(req: Request) -> Result<Markup, CompositeError> {

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())}
}
}
),
))
}