mini-player: finished implementation, now need to keep trakc of state
This commit is contained in:
parent
ca25a97263
commit
4b4044d689
9 changed files with 320 additions and 48 deletions
|
|
@ -2,7 +2,7 @@ use std::sync::Arc;
|
|||
|
||||
use agahnim_web_v2::{
|
||||
domain::AppState,
|
||||
templates::{index::home, miniplayer::miniplayer, music::music, notfound::notfound},
|
||||
templates::{home::home, miniplayer::miniplayer, music::music, notfound::notfound},
|
||||
};
|
||||
use axum::{Router, routing::get};
|
||||
use tower_http::services::ServeDir;
|
||||
|
|
|
|||
|
|
@ -5,17 +5,17 @@ use axum::{
|
|||
};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "index.html")]
|
||||
struct IndexTemplate;
|
||||
#[template(path = "home.html")]
|
||||
struct HomeTemplate;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "partials/index.html")]
|
||||
struct IndexPartialTemplate;
|
||||
#[template(path = "partials/home.html")]
|
||||
struct HomePartialTemplate;
|
||||
|
||||
pub async fn home(headers: HeaderMap) -> impl IntoResponse {
|
||||
if headers.contains_key("hx-request") {
|
||||
Html(IndexPartialTemplate.render().unwrap())
|
||||
Html(HomePartialTemplate.render().unwrap())
|
||||
} else {
|
||||
Html(IndexTemplate.render().unwrap())
|
||||
Html(HomeTemplate.render().unwrap())
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
pub mod index;
|
||||
pub mod home;
|
||||
pub mod miniplayer;
|
||||
pub mod music;
|
||||
pub mod notfound;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue