aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/node.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-01-19 21:44:03 +0100
committermetamuffin <metamuffin@disroot.org>2023-01-19 21:44:03 +0100
commit146243df99605f04f708d3db0eab3c8f78bc61d6 (patch)
tree2ff2061eed7b7a2a408321e72de2d092abafd1f4 /server/src/routes/ui/node.rs
parentcadb3057d06a38abfac9067cbdc59ce3d926a658 (diff)
downloadjellything-146243df99605f04f708d3db0eab3c8f78bc61d6.tar
jellything-146243df99605f04f708d3db0eab3c8f78bc61d6.tar.bz2
jellything-146243df99605f04f708d3db0eab3c8f78bc61d6.tar.zst
smoooooth ui
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r--server/src/routes/ui/node.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 9162982..855da45 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -7,7 +7,7 @@ use crate::{
};
use anyhow::{anyhow, Context};
use log::info;
-use rocket::{get, uri, State};
+use rocket::{get, http::ContentType, uri, State};
use std::{ops::Deref, path::PathBuf, sync::Arc};
use tokio::fs::File;
@@ -54,8 +54,11 @@ markup::define! {
}
ItemCard(item: Arc<Item>) {
div.card.item {
- a[href=&uri!(r_library_node(&item.lib_path)).to_string()] {
- img[src=uri!(r_item_assets(&item.lib_path)).to_string()];
+ div.banner {
+ a[href=&uri!(r_library_node(&item.lib_path)).to_string()] {
+ img[src=uri!(r_item_assets(&item.lib_path)).to_string()];
+ }
+ div.hover { a[href=&player_uri(&item.lib_path)] { "▶" } }
}
a[href=&uri!(r_library_node(&item.lib_path)).to_string()] {
p.title { @item.info.title }
@@ -63,17 +66,15 @@ markup::define! {
}
}
ItemPage(item: Arc<Item>) {
+ // TODO different image here
+ img.backdrop[src=uri!(r_item_assets(&item.lib_path)).to_string()];
div.page.item {
- div.backdrop {
- // TODO different image here
- img[src=uri!(r_item_assets(&item.lib_path)).to_string()];
- }
div.banner {
img[src=uri!(r_item_assets(&item.lib_path)).to_string()];
}
div.title {
h1 { @item.info.title }
- a[href=&player_uri(&item.lib_path)] { "Watch now" }
+ a.play[href=&player_uri(&item.lib_path)] { "Watch now" }
}
div.details {
h3 { "Lorem Ipsum!" }
@@ -84,7 +85,10 @@ markup::define! {
}
#[get("/item_assets/<path..>")]
-pub async fn r_item_assets(path: PathBuf, state: &State<AppState>) -> Result<File, MyError> {
+pub async fn r_item_assets(
+ path: PathBuf,
+ state: &State<AppState>,
+) -> Result<(ContentType, File), MyError> {
let node = state
.library
.nested_path(&path)
@@ -98,5 +102,5 @@ pub async fn r_item_assets(path: PathBuf, state: &State<AppState>) -> Result<Fil
.ok_or(anyhow!("no banner available"))?,
);
info!("loading asset from {path:?}");
- Ok(File::open(path).await?)
+ Ok((ContentType::WEBP, File::open(path).await?))
}