404: make page responsive and make partial system for it
This commit is contained in:
parent
44a6d0b2d0
commit
16489fab33
4 changed files with 40 additions and 9 deletions
|
|
@ -1,10 +1,34 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
use axum::response::{Html, IntoResponse};
|
use axum::{
|
||||||
|
extract::State,
|
||||||
|
http::HeaderMap,
|
||||||
|
response::{Html, IntoResponse},
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::domain::AppState;
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "notfound.html")]
|
#[template(path = "notfound.html")]
|
||||||
struct NotfoundTemplate;
|
struct NotfoundTemplate {
|
||||||
|
tracks: Vec<crate::domain::Track>,
|
||||||
pub async fn notfound() -> impl IntoResponse {
|
}
|
||||||
Html(NotfoundTemplate.render().unwrap())
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "partials/notfound.html")]
|
||||||
|
struct NotfoundPartialTemplate;
|
||||||
|
|
||||||
|
pub async fn notfound(headers: HeaderMap, state: State<Arc<AppState>>) -> impl IntoResponse {
|
||||||
|
if headers.contains_key("hx-request") {
|
||||||
|
Html(NotfoundPartialTemplate.render().unwrap())
|
||||||
|
} else {
|
||||||
|
Html(
|
||||||
|
NotfoundTemplate {
|
||||||
|
tracks: state.mp_tracks.clone(),
|
||||||
|
}
|
||||||
|
.render()
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,8 +175,14 @@ katcenkat {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
min-height: 100svh;
|
||||||
|
padding: 1rem;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
max-width: 100svw;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
transition: opacity 5s ease, transform 5s ease-out;
|
transition: opacity 5s ease, transform 5s ease-out;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0px);
|
transform: translateY(0px);
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,5 @@
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<katcenkat>
|
{% include "partials/notfound.html" %}
|
||||||
<img src="/static/assets/images/notfound.webp" />
|
|
||||||
<img src="/static/assets/images/leuf.webp" />
|
|
||||||
</katcenkat>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
4
templates/partials/notfound.html
Normal file
4
templates/partials/notfound.html
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<katcenkat>
|
||||||
|
<img src="/static/assets/images/notfound.webp" />
|
||||||
|
<img src="/static/assets/images/leuf.webp" />
|
||||||
|
</katcenkat>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue