diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-11 12:43:16 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-11 12:43:16 +0200 |
commit | 29eb56f03ac122bda1b12909592e76d34d79b542 (patch) | |
tree | 1c7d5b87182942e3dc272c207bb976e779d4b7c3 /server/src/routes/ui | |
parent | bb6ef9611b51c716635297da913008f787293856 (diff) | |
download | jellything-29eb56f03ac122bda1b12909592e76d34d79b542.tar jellything-29eb56f03ac122bda1b12909592e76d34d79b542.tar.bz2 jellything-29eb56f03ac122bda1b12909592e76d34d79b542.tar.zst |
node user ratingings
Diffstat (limited to 'server/src/routes/ui')
-rw-r--r-- | server/src/routes/ui/node.rs | 17 | ||||
-rw-r--r-- | server/src/routes/ui/sort.rs | 3 |
2 files changed, 15 insertions, 5 deletions
diff --git a/server/src/routes/ui/node.rs b/server/src/routes/ui/node.rs index d99ddb7..40faf5a 100644 --- a/server/src/routes/ui/node.rs +++ b/server/src/routes/ui/node.rs @@ -18,7 +18,10 @@ use crate::{ layout::{DynLayoutPage, LayoutPage}, player::{rocket_uri_macro_r_player, PlayerConfig}, }, - userdata::{rocket_uri_macro_r_player_watched, UrlWatchedState}, + userdata::{ + rocket_uri_macro_r_node_userdata_rating, rocket_uri_macro_r_node_userdata_watched, + UrlWatchedState, + }, }, uri, }; @@ -163,25 +166,29 @@ markup::define! { @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!(udata.watched, WatchedState::None | WatchedState::Pending | WatchedState::Progress(_)) { - form.mark_watched[method="POST", action=uri!(r_player_watched(id, UrlWatchedState::Watched))] { + form.mark_watched[method="POST", action=uri!(r_node_userdata_watched(id, UrlWatchedState::Watched))] { input[type="submit", value="Mark Watched"]; } } @if matches!(udata.watched, WatchedState::Watched) { - form.mark_unwatched[method="POST", action=uri!(r_player_watched(id, UrlWatchedState::None))] { + form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(id, UrlWatchedState::None))] { input[type="submit", value="Mark Unwatched"]; } } @if matches!(udata.watched, WatchedState::None) { - form.mark_unwatched[method="POST", action=uri!(r_player_watched(id, UrlWatchedState::Pending))] { + form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(id, UrlWatchedState::Pending))] { input[type="submit", value="Add to Watchlist"]; } } @if matches!(udata.watched, WatchedState::Pending) { - form.mark_unwatched[method="POST", action=uri!(r_player_watched(id, UrlWatchedState::None))] { + form.mark_unwatched[method="POST", action=uri!(r_node_userdata_watched(id, UrlWatchedState::None))] { input[type="submit", value="Remove from Watchlist"]; } } + form.rating[method="POST", action=uri!(r_node_userdata_rating(id))] { + input[type="range", name="rating", min=-10, max=10, step=1, value=udata.rating]; + input[type="submit", value="Update Rating"]; + } } } .details { diff --git a/server/src/routes/ui/sort.rs b/server/src/routes/ui/sort.rs index 88f262b..bcd9fe3 100644 --- a/server/src/routes/ui/sort.rs +++ b/server/src/routes/ui/sort.rs @@ -55,6 +55,7 @@ form_enum!( RatingYoutubeViews = "rating_yt_views", RatingYoutubeLikes = "rating_yt_likes", RatingYoutubeFollowers = "rating_yt_followers", + RatingUser = "rating_user", } ); @@ -77,6 +78,7 @@ impl SortProperty { (RatingYoutubeFollowers, "Youtube Subscribers"), (RatingYoutubeLikes, "Youtube Likes"), (RatingYoutubeViews, "Youtube Views"), + (RatingUser, "Your Rating"), ], ), ] @@ -200,6 +202,7 @@ pub fn filter_and_sort_nodes( SortProperty::RatingYoutubeFollowers => nodes.sort_by_cached_key(|(_, n, _)| { SortAnyway(*n.ratings.get(&Rating::YoutubeFollowers).unwrap_or(&0.)) }), + SortProperty::RatingUser => nodes.sort_by_cached_key(|(_, _, u)| u.rating), } match f.sort_order.unwrap_or(default_sort.1) { |