404: make page responsive and make partial system for it
This commit is contained in:
parent
401c2b738d
commit
6e0e250a7c
4 changed files with 40 additions and 9 deletions
|
|
@ -1,10 +1,34 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use askama::Template;
|
||||
use axum::response::{Html, IntoResponse};
|
||||
use axum::{
|
||||
extract::State,
|
||||
http::HeaderMap,
|
||||
response::{Html, IntoResponse},
|
||||
};
|
||||
|
||||
use crate::domain::AppState;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "notfound.html")]
|
||||
struct NotfoundTemplate;
|
||||
|
||||
pub async fn notfound() -> impl IntoResponse {
|
||||
Html(NotfoundTemplate.render().unwrap())
|
||||
struct NotfoundTemplate {
|
||||
tracks: Vec<crate::domain::Track>,
|
||||
}
|
||||
|
||||
#[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;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100svh;
|
||||
padding: 1rem;
|
||||
gap: 1rem;
|
||||
|
||||
img {
|
||||
max-width: 100svw;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
transition: opacity 5s ease, transform 5s ease-out;
|
||||
opacity: 1;
|
||||
transform: translateY(0px);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,5 @@
|
|||
|
||||
|
||||
{% block content %}
|
||||
<katcenkat>
|
||||
<img src="/static/assets/images/notfound.webp" />
|
||||
<img src="/static/assets/images/leuf.webp" />
|
||||
</katcenkat>
|
||||
{% include "partials/notfound.html" %}
|
||||
{% 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