diff --git a/web/src/actors/header.rs b/web/src/actors/header.rs index 4708d24..b73c57f 100644 --- a/web/src/actors/header.rs +++ b/web/src/actors/header.rs @@ -124,6 +124,9 @@ pub fn ActorHeader() -> impl IntoView { "🖂 ""outbox" + + "⭐ ""likes" + "📢"" followers" diff --git a/web/src/actors/posts.rs b/web/src/actors/posts.rs index b60369e..f48322e 100644 --- a/web/src/actors/posts.rs +++ b/web/src/actors/posts.rs @@ -17,3 +17,19 @@ pub fn ActorPosts() -> impl IntoView { } } + +#[component] +pub fn ActorLikes() -> impl IntoView { + let feeds = use_context::().expect("missing feeds context"); + let params = use_params::(); + create_effect(move |_| { + let id = params.get().ok().and_then(|x| x.id).unwrap_or_default(); + let likes_url = format!("{}/likes/page", Uri::api(U::Actor, &id, false)); + if !feeds.user.next.get_untracked().starts_with(&likes_url) { + feeds.user_likes.reset(Some(likes_url)); + } + }); + view! { + + } +} diff --git a/web/src/app.rs b/web/src/app.rs index 28e4841..7b1be0a 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -23,6 +23,7 @@ pub struct Feeds { pub notifications: Timeline, // exploration feeds pub user: Timeline, + pub user_likes: Timeline, pub server: Timeline, pub context: Timeline, pub replies: Timeline, @@ -36,6 +37,7 @@ impl Feeds { notifications: Timeline::new(format!("{URL_BASE}/actors/{username}/notifications/page")), global: Timeline::new(format!("{URL_BASE}/inbox/page")), user: Timeline::new(format!("{URL_BASE}/actors/{username}/outbox/page")), + user_likes: Timeline::new(format!("{URL_BASE}/actors/{username}/likes")), server: Timeline::new(format!("{URL_BASE}/outbox/page")), tag: Timeline::new(format!("{URL_BASE}/tags/upub/page")), context: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh @@ -48,6 +50,7 @@ impl Feeds { self.notifications.reset(None); self.global.reset(None); self.user.reset(None); + self.user_likes.reset(None); self.server.reset(None); self.context.reset(None); self.replies.reset(None); @@ -177,6 +180,7 @@ pub fn App() -> impl IntoView { // TODO can we avoid this? + } /> } /> @@ -249,7 +253,7 @@ fn Scrollable() -> impl IntoView { }, Some("likes") => { set_route.set(FeedRoute::Likes); - None + Some(feeds.user_likes) }, _ => { set_route.set(FeedRoute::User); diff --git a/web/src/prelude.rs b/web/src/prelude.rs index e1ed2d1..a481b55 100644 --- a/web/src/prelude.rs +++ b/web/src/prelude.rs @@ -10,7 +10,7 @@ pub use crate::{ actors::{ header::ActorHeader, follow::FollowList, - posts::ActorPosts, + posts::{ActorPosts, ActorLikes}, }, activities::{ item::Item,