diff --git a/web/src/actors/header.rs b/web/src/actors/header.rs index 180d17b..f23f655 100644 --- a/web/src/actors/header.rs +++ b/web/src/actors/header.rs @@ -126,7 +126,7 @@ pub fn ActorHeader() -> impl IntoView { "πŸ–‚ ""outbox" - + "⭐ ""likes" diff --git a/web/src/app.rs b/web/src/app.rs index 5dfed91..7ccffea 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -26,6 +26,7 @@ pub struct Feeds { pub server: Timeline, pub context: Timeline, pub replies: Timeline, + pub object_likes: Timeline, pub tag: Timeline, } @@ -41,6 +42,7 @@ impl Feeds { tag: Timeline::new(format!("{URL_BASE}/tags/upub/page")), context: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh replies: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh + object_likes: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh } } @@ -205,7 +207,7 @@ pub fn App() -> impl IntoView { - // + // @@ -230,7 +232,7 @@ pub fn App() -> impl IntoView { #[derive(Debug, Clone, Copy)] pub(crate) enum FeedRoute { - Home, Global, Server, Notifications, User, Following, Followers, Likes, Replies, Context + Home, Global, Server, Notifications, User, Following, Followers, ActorLikes, ObjectLikes, Replies, Context } #[component] @@ -268,7 +270,7 @@ fn Scrollable() -> impl IntoView { None }, Some("likes") => { - set_route.set(FeedRoute::Likes); + set_route.set(FeedRoute::ActorLikes); Some(feeds.user_likes) }, _ => { @@ -277,12 +279,19 @@ fn Scrollable() -> impl IntoView { }, } } else if path.starts_with("/web/objects") { - if matches!(path.split('/').nth(4), Some("replies")) { - set_route.set(FeedRoute::Replies); - Some(feeds.replies) - } else { - set_route.set(FeedRoute::Context); - Some(feeds.context) + match path.split('/').nth(4) { + Some("likes") => { + set_route.set(FeedRoute::ObjectLikes); + Some(feeds.object_likes) + }, + Some("replies") => { + set_route.set(FeedRoute::Replies); + Some(feeds.replies) + }, + _ => { + set_route.set(FeedRoute::Context); + Some(feeds.context) + }, } } else { None diff --git a/web/src/objects/replies.rs b/web/src/objects/replies.rs index 4cdb6bf..b963ae8 100644 --- a/web/src/objects/replies.rs +++ b/web/src/objects/replies.rs @@ -22,3 +22,23 @@ pub fn ObjectReplies() -> impl IntoView { } } + +#[component] +pub fn ObjectLikes() -> impl IntoView { + let feeds = use_context::().expect("missing feeds context"); + let params = use_params::(); + let id = Signal::derive(move || + params.with(|p| p.as_ref().ok().and_then(|x| x.id.as_ref()).cloned()).unwrap_or_default() + ); + create_effect(move |_| { + let tl_url = format!("{}/likes/page", Uri::api(U::Object, &id.get(), false)); + if !feeds.object_likes.next.get_untracked().starts_with(&tl_url) { + feeds.object_likes.reset(Some(tl_url)); + } + }); + view! { +
+ +
+ } +} diff --git a/web/src/objects/view.rs b/web/src/objects/view.rs index 8a9412a..195daa5 100644 --- a/web/src/objects/view.rs +++ b/web/src/objects/view.rs @@ -56,6 +56,7 @@ pub fn ObjectView() -> impl IntoView {

"πŸ•ΈοΈ ""context" "πŸ“« ""replies" + "⭐ ""likes" {move || if auth.present() { if loading.get() { Some(view! { diff --git a/web/src/prelude.rs b/web/src/prelude.rs index a481b55..eccfc4c 100644 --- a/web/src/prelude.rs +++ b/web/src/prelude.rs @@ -20,7 +20,7 @@ pub use crate::{ attachment::Attachment, item::{Object, Summary, LikeButton, RepostButton, ReplyButton}, context::ObjectContext, - replies::ObjectReplies, + replies::{ObjectReplies, ObjectLikes}, }, timeline::{ Timeline,