diff options
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r-- | server/src/routes/ui/node.rs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index 2df78b4..9882e9f 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -32,7 +32,7 @@ use anyhow::{anyhow, Result}; use chrono::DateTime; use jellycommon::{ user::{NodeUserData, WatchedState}, - Chapter, MediaInfo, Node, NodeID, NodeKind, PeopleGroup, Rating, SourceTrackKind, + Chapter, MediaInfo, Node, NodeID, NodeKind, PeopleGroup, Rating, SourceTrackKind, Visibility, }; use rocket::{get, serde::json::Json, Either, State}; use std::sync::Arc; @@ -72,7 +72,7 @@ pub async fn r_library_node_filter<'a>( filter_and_sort_nodes( &filter, - match node.kind.unwrap_or(NodeKind::Collection) { + match node.kind { NodeKind::Channel => (SortProperty::ReleaseDate, SortOrder::Descending), _ => (SortProperty::Title, SortOrder::Ascending), }, @@ -91,7 +91,7 @@ pub async fn r_library_node_filter<'a>( markup::define! { NodeCard<'a>(node: &'a Node, udata: &'a NodeUserData) { - @let cls = format!("node card poster {}", aspect_class(node.kind.unwrap_or_default())); + @let cls = format!("node card poster {}", aspect_class(node.kind)); div[class=cls] { .poster { a[href=uri!(r_library_node(&node.slug))] { @@ -117,12 +117,12 @@ markup::define! { } } NodePage<'a>(id: &'a str, node: &'a Node, udata: &'a NodeUserData, children: &'a [(Arc<Node>, NodeUserData)], parents: &'a [Arc<Node>], filter: &'a NodeFilterSort) { - @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection) { + @if !matches!(node.kind, NodeKind::Collection) { img.backdrop[src=uri!(r_item_backdrop(id, Some(2048))), loading="lazy"]; } .page.node { - @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection) { - @let cls = format!("bigposter {}", aspect_class(node.kind.unwrap_or_default())); + @if !matches!(node.kind, NodeKind::Collection) { + @let cls = format!("bigposter {}", aspect_class(node.kind)); div[class=cls] { img[src=uri!(r_item_poster(id, Some(2048))), loading="lazy"]; } } .title { @@ -131,7 +131,7 @@ markup::define! { a.component[href=uri!(r_library_node(&node.slug))] { @node.title } }}} @if node.media.is_some() { a.play[href=&uri!(r_player(id, PlayerConfig::default()))] { "Watch now" }} - @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel) { + @if !matches!(node.kind, NodeKind::Collection | NodeKind::Channel) { @if matches!(udata.watched, WatchedState::None | WatchedState::Pending | WatchedState::Progress(_)) { form.mark_watched[method="POST", action=uri!(r_node_userdata_watched(id, UrlWatchedState::Watched))] { input[type="submit", value="Mark Watched"]; @@ -214,10 +214,10 @@ markup::define! { } } } - @if matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel) { + @if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) { @NodeFilterSortForm { f: filter } } - @match node.kind.unwrap_or_default() { + @match node.kind { NodeKind::Show | NodeKind::Series | NodeKind::Season => { ol { @for (c, _) in children.iter() { li { a[href=uri!(r_library_node(&c.slug))] { @c.title } } @@ -225,7 +225,9 @@ markup::define! { } NodeKind::Collection | NodeKind::Channel | _ => { ul.children {@for (node, udata) in children.iter() { - li { @NodeCard { node, udata } } + @if node.visibility != Visibility::Hidden { + li { @NodeCard { node, udata } } + } }} } } @@ -245,6 +247,11 @@ markup::define! { @DateTime::from_timestamp_millis(*d).unwrap().date_naive().to_string() }} } + @match node.visibility { + Visibility::Visible => {} + Visibility::Reduced => {p{"Reduced visibility"}} + Visibility::Hidden => {p{"Hidden"}} + } // TODO // @if !node.children.is_empty() { // p { @format!("{} items", node.children.len()) } |