primitive not found page (better than nothing)
This commit is contained in:
@@ -8,6 +8,7 @@ pub mod dashboard;
|
||||
pub mod index;
|
||||
pub mod login;
|
||||
pub mod logs;
|
||||
pub mod notfound;
|
||||
pub mod persons;
|
||||
pub mod quotes;
|
||||
pub mod tags;
|
||||
@@ -35,6 +36,8 @@ pub fn pages() -> Router {
|
||||
.route("/quotes", get(quotes::page))
|
||||
.route("/quotes/add", get(quotes::add::page))
|
||||
.route("/quotes/add-form", post(quotes::add::form))
|
||||
//
|
||||
.fallback(notfound::page)
|
||||
}
|
||||
|
||||
pub fn base(title: &str, inner: Markup) -> Markup {
|
||||
|
||||
26
src/web/pages/notfound.rs
Normal file
26
src/web/pages/notfound.rs
Normal 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())}
|
||||
}
|
||||
}
|
||||
),
|
||||
))
|
||||
}
|
||||
Reference in New Issue
Block a user