Compare commits
3 Commits
e35da127aa
...
a3f5ccfcb7
| Author | SHA1 | Date | |
|---|---|---|---|
| a3f5ccfcb7 | |||
|
9fa19d6caf
|
|||
|
a326d5f17d
|
@@ -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> {
|
||||||
|
|||||||
@@ -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
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