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.rs77
1 files changed, 21 insertions, 56 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index aa99121..c87e56b 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -56,7 +56,7 @@ pub async fn r_library_node(
Ok(Either::Left(LayoutPage {
title: node.title.to_string(),
- show_back: matches!(node.kind, NodeKind::Movie | NodeKind::Episode),
+ show_back: true, //- !matches!(node.kind, NodeKind::Collection),
content: markup::new! {
@NodePage { node: &node, id: &id, children: &children }
},
@@ -65,41 +65,14 @@ pub async fn r_library_node(
}
markup::define! {
- NodePage<'a>(id: &'a str, node: &'a NodePublic, children: &'a Vec<(String, NodePublic)>) {
- @match node.kind {
- NodeKind::Collection | NodeKind::Show | NodeKind::Season => { @DirectoryPage { node, _id: id, children } }
- NodeKind::Series => { @SeriesPage { node, children, id } }
- NodeKind::Movie | NodeKind::Episode | NodeKind::Video => { @ItemPage { node, id } }
- }
- }
NodeCard<'a>(id: &'a str, node: &'a NodePublic) {
- @PosterCard {
- wide: matches!(node.kind, NodeKind::Collection | NodeKind::Video),
- dir: !matches!(node.kind, NodeKind::Movie | NodeKind::Video | NodeKind::Episode),
- id,
- title: &node.title
- }
- }
- DirectoryPage<'a>(_id: &'a str, node: &'a NodePublic, children: &'a Vec<(String, NodePublic)>) {
- div.page.dir {
- h1 { @node.title }
- @if let Some(parent) = &node.parent {
- a.dirup[href=uri!(r_library_node(parent))] { "Go up" }
- }
- ul.directorylisting {
- @for (id, node) in children.iter() {
- li { @NodeCard { id, node } }
- }
- }
- }
- }
- PosterCard<'a>(id: &'a str, title: &'a str, wide: bool, dir: bool) {
- div[class=if *wide {"card wide poster"} else {"card poster"}] {
+ @let cls = format!("card poster {}", match node.kind {NodeKind::Channel => "poster-square", NodeKind::Video => "thumb-land", NodeKind::Collection => "poster-land", _ => "poster-port"});
+ div[class=cls] {
div.banner {
a[href=uri!(r_library_node(id))] {
img[src=uri!(r_item_assets(id, AssetRole::Poster))];
}
- @if *dir {
+ @if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) {
div.hoverdir { a[href=&uri!(r_library_node(id))] { "Open" } }
} else {
div.hoveritem { a[href=&player_uri(id)] { "▶" } }
@@ -107,21 +80,18 @@ markup::define! {
}
p.title {
a[href=uri!(r_library_node(id))] {
- @title
+ @node.title
}
}
}
}
- ItemPage<'a>(id: &'a str, node: &'a NodePublic) {
- // TODO different image here
+ NodePage<'a>(id: &'a str, node: &'a NodePublic, children: &'a Vec<(String, NodePublic)>) {
img.backdrop[src=uri!(r_item_assets(id, AssetRole::Backdrop))];
div.page.item {
- div.banner {
- img[src=uri!(r_item_assets(id, AssetRole::Poster))];
- }
+ div.banner { img[src=uri!(r_item_assets(id, AssetRole::Poster))]; }
div.title {
h1 { @node.title }
- a.play[href=&player_uri(id)] { "Watch now" }
+ @if node.media.is_some() { a.play[href=&player_uri(id)] { "Watch now" }}
}
div.details {
div.props {
@@ -133,6 +103,7 @@ markup::define! {
p { @match r {
Rating::YoutubeLikes(n) => { @format_count(*n) " Likes" }
Rating::YoutubeViews(n) => { @format_count(*n) " Views" }
+ Rating::YoutubeFollowers(n) => { @format_count(*n) " Subscribers" }
_ => { "Unknown Rating" }
} }
}
@@ -140,25 +111,19 @@ markup::define! {
h3 { @node.tagline }
p { @node.description }
}
- }
- }
- SeriesPage<'a>(id: &'a str, node: &'a NodePublic, children: &'a Vec<(String, NodePublic)>) {
- // TODO different image here
- img.backdrop[src=uri!(r_item_assets(id, AssetRole::Backdrop))];
- div.page.item {
- div.banner {
- img[src=uri!(r_item_assets(id, AssetRole::Poster))];
- }
- div.title {
- h1 { @node.title }
- }
- div.details {
- h3 { @node.tagline }
- p { @node.description }
+ @match node.kind {
+ NodeKind::Collection | NodeKind::Channel => {
+ ul.children {@for (id, node) in children.iter() {
+ li { @NodeCard { id, node } }
+ }}
+ }
+ NodeKind::Series => {
+ ol { @for (id, c) in children.iter() {
+ li { a[href=uri!(r_library_node(id))] { @c.title } }
+ }}
+ }
+ _ => {}
}
- ol { @for (id, c) in children.iter() {
- li { a[href=uri!(r_library_node(id))] { @c.title } }
- } }
}
}
}