aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/node.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-06 21:58:22 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-06 21:58:22 +0200
commit8f894039cc6db9f024517f973f8835cadbdb8864 (patch)
treefcac84d7a83b44fa6eff3aba63f6bc2c9b9c5b86 /server/src/routes/ui/node.rs
parent177e0c5ab18d191c626613d9f20fde4ae9fcad2b (diff)
downloadjellything-8f894039cc6db9f024517f973f8835cadbdb8864.tar
jellything-8f894039cc6db9f024517f973f8835cadbdb8864.tar.bz2
jellything-8f894039cc6db9f024517f973f8835cadbdb8864.tar.zst
s
Diffstat (limited to 'server/src/routes/ui/node.rs')
-rw-r--r--server/src/routes/ui/node.rs51
1 files changed, 29 insertions, 22 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs
index 4574709..97d0516 100644
--- a/server/src/routes/ui/node.rs
+++ b/server/src/routes/ui/node.rs
@@ -68,14 +68,17 @@ markup::define! {
NodeCard<'a>(id: &'a str, node: &'a NodePublic) {
@let cls = format!("node card poster {}", match node.kind {NodeKind::Channel => "poster-square", NodeKind::Video => "thumb-land", NodeKind::Collection => "poster-land", _ => "poster-port"});
div[class=cls] {
- div.poster {
+ .poster {
a[href=uri!(r_library_node(id))] {
img[src=uri!(r_item_assets(id, AssetRole::Poster, Some(1024)))];
}
@if matches!(node.kind, NodeKind::Collection | NodeKind::Channel) {
- div.hoverdir { a[href=&uri!(r_library_node(id))] { "Open" } }
+ .cardhover.open { a[href=&uri!(r_library_node(id))] { "Open" } }
} else {
- div.hoveritem { a[href=&player_uri(id)] { "▶" } }
+ .cardhover.item {
+ a.play[href=&player_uri(id)] { "▶" }
+ @Props { node }
+ }
}
}
p.title {
@@ -89,31 +92,16 @@ markup::define! {
@if !matches!(node.kind, NodeKind::Collection) {
img.backdrop[src=uri!(r_item_assets(id, AssetRole::Backdrop, Some(2048)))];
}
- div.page.node {
+ .page.node {
@if !matches!(node.kind, NodeKind::Collection) {
div.bigposter { img[src=uri!(r_item_assets(id, AssetRole::Poster, Some(2048)))]; }
}
- div.title {
+ .title {
h1 { @node.title }
@if node.media.is_some() { a.play[href=&player_uri(id)] { "Watch now" }}
}
- div.details {
- div.props {
- @if let Some(m) = &node.media {
- p { @format_duration(m.duration) }
- p { @m.resolution_name() }
- }
- @for r in &node.ratings {
- p { @match r {
- Rating::YoutubeLikes(n) => { @format_count(*n) " Likes" }
- Rating::YoutubeViews(n) => { @format_count(*n) " Views" }
- Rating::YoutubeFollowers(n) => { @format_count(*n) " Subscribers" }
- Rating::RottenTomatoes(n) => { @n " Tomatoes" }
- Rating::Metacritic(n) => { "Metacritic Score: " @n }
- Rating::Imdb(n) => { "IMDb Rating: " @n }
- } }
- }
- }
+ .details {
+ @Props { node }
h3 { @node.tagline }
p { @if matches!(node.kind, NodeKind::Video | NodeKind::Channel) { pre { @node.description } } else { @node.description } }
}
@@ -137,6 +125,25 @@ markup::define! {
}
}
}
+
+ Props<'a>(node: &'a NodePublic) {
+ .props {
+ @if let Some(m) = &node.media {
+ p { @format_duration(m.duration) }
+ p { @m.resolution_name() }
+ }
+ @for r in &node.ratings {
+ p { @match r {
+ Rating::YoutubeLikes(n) => { @format_count(*n) " Likes" }
+ Rating::YoutubeViews(n) => { @format_count(*n) " Views" }
+ Rating::YoutubeFollowers(n) => { @format_count(*n) " Subscribers" }
+ Rating::RottenTomatoes(n) => { @n " Tomatoes" }
+ Rating::Metacritic(n) => { "Metacritic Score: " @n }
+ Rating::Imdb(n) => { "IMDb Rating: " @n }
+ } }
+ }
+ }
+ }
}
pub fn format_duration(mut d: f64) -> String {