From 146243df99605f04f708d3db0eab3c8f78bc61d6 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 19 Jan 2023 21:44:03 +0100 Subject: smoooooth ui --- server/src/routes/ui/node.rs | 24 ++++--- server/src/routes/ui/style/layout.css | 132 ++++++++++++++++++++++++++++------ 2 files changed, 126 insertions(+), 30 deletions(-) (limited to 'server/src') 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) { 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) { + // 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/")] -pub async fn r_item_assets(path: PathBuf, state: &State) -> Result { +pub async fn r_item_assets( + path: PathBuf, + state: &State, +) -> 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) -> Result