aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r--server/src/routes/ui/node.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 6e2f532..bcb7362 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -72,7 +72,7 @@ pub async fn r_library_node_filter<'a>(
filter_and_sort_nodes(&filter, &mut children);
Ok(Either::Left(LayoutPage {
- title: node.title.to_string(),
+ title: node.title.clone().unwrap_or_default(),
content: markup::new! {
@NodePage { node: &node, id: &id, udata: &udata, children: &children, filter: &filter }
},
@@ -82,14 +82,14 @@ pub async fn r_library_node_filter<'a>(
markup::define! {
NodeCard<'a>(id: &'a str, node: &'a NodePublic, udata: &'a NodeUserData) {
- @let cls = format!("node card poster {}", match node.kind {NodeKind::Channel => "aspect-square", NodeKind::Video => "aspect-thumb", NodeKind::Collection => "aspect-land", _ => "aspect-port"});
+ @let cls = format!("node card poster {}", match node.kind.unwrap_or_default() {NodeKind::Channel => "aspect-square", NodeKind::Video => "aspect-thumb", NodeKind::Collection => "aspect-land", _ => "aspect-port"});
div[class=cls] {
.poster {
a[href=uri!(r_library_node(id))] {
img[src=uri!(r_item_assets(id, AssetRole::Poster, Some(1024)))];
}
.cardhover.item {
- @if !(matches!(node.kind, NodeKind::Collection | NodeKind::Channel)) {
+ @if !(matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel)) {
a.play.icon[href=&uri!(r_player(id, PlayerConfig::default()))] { "play_arrow" }
}
@Props { node, udata }
@@ -103,17 +103,17 @@ markup::define! {
}
}
NodePage<'a>(id: &'a str, node: &'a NodePublic, udata: &'a NodeUserData, children: &'a Vec<(String, NodePublic, NodeUserData)>, filter: &'a NodeFilterSort) {
- @if !matches!(node.kind, NodeKind::Collection) {
+ @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection) {
img.backdrop[src=uri!(r_item_assets(id, AssetRole::Backdrop, Some(2048)))];
}
.page.node {
- @if !matches!(node.kind, NodeKind::Collection) {
+ @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection) {
div.bigposter { img[src=uri!(r_item_assets(id, AssetRole::Poster, Some(2048)))]; }
}
.title {
h1 { @node.title }
@if node.media.is_some() { a.play[href=&uri!(r_player(id, PlayerConfig::default()))] { "Watch now" }}
- @if !matches!(node.kind, NodeKind::Collection | NodeKind::Channel) {
+ @if !matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel) {
@match udata.watched {
WatchedState::None |
WatchedState::Progress(_) => {
@@ -152,15 +152,15 @@ markup::define! {
}
}
}
- @if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) {
- @if matches!(node.kind, NodeKind::Collection) {
+ @if matches!(node.kind.unwrap_or_default(), NodeKind::Collection | NodeKind::Channel) {
+ @if matches!(node.kind.unwrap_or_default(), NodeKind::Collection) {
@if let Some(parent) = &node.path.last().cloned() {
a.dirup[href=uri!(r_library_node(parent))] { "Go up" }
}
}
@NodeFilterSortForm { f: filter }
}
- @match node.kind {
+ @match node.kind.unwrap_or_default() {
NodeKind::Collection | NodeKind::Channel => {
ul.children {@for (id, node, udata) in children.iter() {
li { @NodeCard { id, node, udata } }
@@ -261,7 +261,9 @@ impl MediaInfoExt for MediaInfo {
let mut maxdim = 0;
for t in &self.tracks {
match &t.kind {
- SourceTrackKind::Video { width, height, .. } => maxdim = maxdim.max(*width.max(height)),
+ SourceTrackKind::Video { width, height, .. } => {
+ maxdim = maxdim.max(*width.max(height))
+ }
_ => (),
}
}