diff options
Diffstat (limited to 'ui/src/node_page.rs')
-rw-r--r-- | ui/src/node_page.rs | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/ui/src/node_page.rs b/ui/src/node_page.rs index b48fca2..7fb299f 100644 --- a/ui/src/node_page.rs +++ b/ui/src/node_page.rs @@ -15,7 +15,12 @@ use crate::{ use jellycommon::{ Chapter, Node, NodeKind, PeopleGroup, api::NodeFilterSort, - user::{NodeUserData, WatchedState}, + routes::{ + u_node_slug, u_node_slug_backdrop, u_node_slug_person_asset, u_node_slug_player, + u_node_slug_player_time, u_node_slug_poster, u_node_slug_thumbnail, + u_node_slug_update_rating, u_node_slug_watched, + }, + user::{ApiWatchedState, NodeUserData, WatchedState}, }; use std::sync::Arc; @@ -23,6 +28,9 @@ impl Page for NodePage<'_> { fn title(&self) -> String { self.node.title.clone().unwrap_or_default() } + fn to_render(&self) -> markup::DynRender { + markup::new!(@self) + } } markup::define! { @@ -37,43 +45,43 @@ markup::define! { player: bool, ) { @if !matches!(node.kind, NodeKind::Collection) && !player { - img.backdrop[src=uri!(r_item_backdrop(&node.slug, Some(2048))), loading="lazy"]; + img.backdrop[src=u_node_slug_backdrop(&node.slug, 2048), loading="lazy"]; } .page.node { @if !matches!(node.kind, NodeKind::Collection) && !player { @let cls = format!("bigposter {}", aspect_class(node.kind)); - div[class=cls] { img[src=uri!(r_item_poster(&node.slug, Some(2048))), loading="lazy"]; } + div[class=cls] { img[src=u_node_slug_poster(&node.slug, 2048), loading="lazy"]; } } .title { h1 { @node.title } ul.parents { @for (node, _) in *parents { li { - a.component[href=uri!(r_library_node(&node.slug))] { @node.title } + a.component[href=u_node_slug(&node.slug)] { @node.title } }}} @if node.media.is_some() { - a.play[href=&uri!(r_player(&node.slug, PlayerConfig::default()))] { @trs(lang, "node.player_link") } + a.play[href=u_node_slug_player(&node.slug)] { @trs(lang, "node.player_link") } } @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(&node.slug, UrlWatchedState::Watched))] { + form.mark_watched[method="POST", action=u_node_slug_watched(&node.slug, ApiWatchedState::Watched)] { input[type="submit", value=trs(lang, "node.watched.set")]; } } @if matches!(udata.watched, WatchedState::Watched) { - form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(&node.slug, UrlWatchedState::None))] { + form.mark_unwatched[method="POST", action=u_node_slug_watched(&node.slug, ApiWatchedState::None)] { input[type="submit", value=trs(lang, "node.watched.unset")]; } } @if matches!(udata.watched, WatchedState::None) { - form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(&node.slug, UrlWatchedState::Pending))] { + form.mark_unwatched[method="POST", action=u_node_slug_watched(&node.slug, ApiWatchedState::Pending)] { input[type="submit", value=trs(lang, "node.watchlist.set")]; } } @if matches!(udata.watched, WatchedState::Pending) { - form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(&node.slug, UrlWatchedState::None))] { + form.mark_unwatched[method="POST", action=u_node_slug_watched(&node.slug, ApiWatchedState::None)] { input[type="submit", value=trs(lang, "node.watchlist.unset")]; } } - form.rating[method="POST", action=uri!(r_node_userdata_rating(&node.slug))] { + form.rating[method="POST", action=u_node_slug_update_rating(&node.slug)] { input[type="range", name="rating", min=-10, max=10, step=1, value=udata.rating]; input[type="submit", value=trs(lang, "node.update_rating")]; } @@ -92,8 +100,8 @@ markup::define! { @let (inl, sub) = format_chapter(chap); li { .card."aspect-thumb" { .poster { - a[href=&uri!(r_player(&node.slug, PlayerConfig::seek(chap.time_start.unwrap_or(0.))))] { - img[src=&uri!(r_node_thumbnail(&node.slug, chapter_key_time(chap, media.duration), Some(1024))), loading="lazy"]; + a[href=u_node_slug_player_time(&node.slug, chap.time_start.unwrap_or(0.))] { + img[src=u_node_slug_thumbnail(&node.slug, chapter_key_time(chap, media.duration), 1024), loading="lazy"]; } .cardhover { .props { p { @inl } } } } @@ -110,7 +118,7 @@ markup::define! { li { .card."aspect-port" { .poster { a[href="#"] { - img[src=&uri!(r_person_asset(&node.slug, i, group.to_string(), Some(1024))), loading="lazy"]; + img[src=u_node_slug_person_asset(&node.slug, *group, i, 1024), loading="lazy"]; } } .title { |