use std::sync::Arc; use askama::Template; use axum::{ extract::State, http::HeaderMap, response::{Html, IntoResponse}, }; use crate::domain::AppState; #[derive(Template)] #[template(path = "notfound.html")] struct NotfoundTemplate<'a> { tracks: &'a Vec, } #[derive(Template)] #[template(path = "partials/notfound.html")] struct NotfoundPartialTemplate; pub async fn notfound(headers: HeaderMap, state: State>) -> impl IntoResponse { if headers.contains_key("hx-request") { Html(NotfoundPartialTemplate.render().unwrap()) } else { Html( NotfoundTemplate { tracks: &state.mp_tracks, } .render() .unwrap(), ) } }