feat(web): botched object likes
This commit is contained in:
parent
314496b4f3
commit
0fba4d6838
5 changed files with 41 additions and 11 deletions
|
@ -126,7 +126,7 @@ pub fn ActorHeader() -> impl IntoView {
|
||||||
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::User)>
|
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::User)>
|
||||||
<a class="clean" href=web_path.clone()><span class="emoji">"🖂 "</span>"outbox"</a>
|
<a class="clean" href=web_path.clone()><span class="emoji">"🖂 "</span>"outbox"</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="ml-1" class:tab-active=move || matches!(matched_route.get(), FeedRoute::Likes)>
|
<span class="ml-1" class:tab-active=move || matches!(matched_route.get(), FeedRoute::ActorLikes)>
|
||||||
<a class="clean" href=format!("{web_path}/likes")><span class="emoji">"⭐ "</span>"likes"</a>
|
<a class="clean" href=format!("{web_path}/likes")><span class="emoji">"⭐ "</span>"likes"</a>
|
||||||
</span>
|
</span>
|
||||||
<span class="ml-1" style="float: right" class:tab-active=move || matches!(matched_route.get(), FeedRoute::Followers)>
|
<span class="ml-1" style="float: right" class:tab-active=move || matches!(matched_route.get(), FeedRoute::Followers)>
|
||||||
|
|
|
@ -26,6 +26,7 @@ pub struct Feeds {
|
||||||
pub server: Timeline,
|
pub server: Timeline,
|
||||||
pub context: Timeline,
|
pub context: Timeline,
|
||||||
pub replies: Timeline,
|
pub replies: Timeline,
|
||||||
|
pub object_likes: Timeline,
|
||||||
pub tag: Timeline,
|
pub tag: Timeline,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ impl Feeds {
|
||||||
tag: Timeline::new(format!("{URL_BASE}/tags/upub/page")),
|
tag: Timeline::new(format!("{URL_BASE}/tags/upub/page")),
|
||||||
context: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh
|
context: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh
|
||||||
replies: 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 {
|
||||||
<Route path="objects/:id" view=ObjectView >
|
<Route path="objects/:id" view=ObjectView >
|
||||||
<Route path="" view=ObjectContext />
|
<Route path="" view=ObjectContext />
|
||||||
<Route path="replies" view=ObjectReplies />
|
<Route path="replies" view=ObjectReplies />
|
||||||
// <Route path="liked" view=ObjectLiked />
|
<Route path="likes" view=ObjectLikes />
|
||||||
// <Route path="announced" view=ObjectAnnounced />
|
// <Route path="announced" view=ObjectAnnounced />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
@ -230,7 +232,7 @@ pub fn App() -> impl IntoView {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub(crate) enum FeedRoute {
|
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]
|
#[component]
|
||||||
|
@ -268,7 +270,7 @@ fn Scrollable() -> impl IntoView {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
Some("likes") => {
|
Some("likes") => {
|
||||||
set_route.set(FeedRoute::Likes);
|
set_route.set(FeedRoute::ActorLikes);
|
||||||
Some(feeds.user_likes)
|
Some(feeds.user_likes)
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -277,12 +279,19 @@ fn Scrollable() -> impl IntoView {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else if path.starts_with("/web/objects") {
|
} else if path.starts_with("/web/objects") {
|
||||||
if matches!(path.split('/').nth(4), Some("replies")) {
|
match path.split('/').nth(4) {
|
||||||
set_route.set(FeedRoute::Replies);
|
Some("likes") => {
|
||||||
Some(feeds.replies)
|
set_route.set(FeedRoute::ObjectLikes);
|
||||||
} else {
|
Some(feeds.object_likes)
|
||||||
set_route.set(FeedRoute::Context);
|
},
|
||||||
Some(feeds.context)
|
Some("replies") => {
|
||||||
|
set_route.set(FeedRoute::Replies);
|
||||||
|
Some(feeds.replies)
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
set_route.set(FeedRoute::Context);
|
||||||
|
Some(feeds.context)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
@ -22,3 +22,23 @@ pub fn ObjectReplies() -> impl IntoView {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn ObjectLikes() -> impl IntoView {
|
||||||
|
let feeds = use_context::<Feeds>().expect("missing feeds context");
|
||||||
|
let params = use_params::<IdParam>();
|
||||||
|
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! {
|
||||||
|
<div class="mr-1-r ml-1-r">
|
||||||
|
<Feed tl=feeds.object_likes />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ pub fn ObjectView() -> impl IntoView {
|
||||||
<p>
|
<p>
|
||||||
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::Context)><a class="clean" href=move || format!("/web/objects/{}", id.get())><span class="emoji ml-2">"🕸️ "</span>"context"</a></span>
|
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::Context)><a class="clean" href=move || format!("/web/objects/{}", id.get())><span class="emoji ml-2">"🕸️ "</span>"context"</a></span>
|
||||||
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::Replies)><a class="clean" href=move || format!("/web/objects/{}/replies", id.get())><span class="emoji ml-2">"📫 "</span>"replies"</a></span>
|
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::Replies)><a class="clean" href=move || format!("/web/objects/{}/replies", id.get())><span class="emoji ml-2">"📫 "</span>"replies"</a></span>
|
||||||
|
<span class:tab-active=move || matches!(matched_route.get(), FeedRoute::ObjectLikes)><a class="clean" href=move || format!("/web/objects/{}/likes", id.get())><span class="emoji ml-2">"⭐ "</span>"likes"</a></span>
|
||||||
{move || if auth.present() {
|
{move || if auth.present() {
|
||||||
if loading.get() {
|
if loading.get() {
|
||||||
Some(view! {
|
Some(view! {
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub use crate::{
|
||||||
attachment::Attachment,
|
attachment::Attachment,
|
||||||
item::{Object, Summary, LikeButton, RepostButton, ReplyButton},
|
item::{Object, Summary, LikeButton, RepostButton, ReplyButton},
|
||||||
context::ObjectContext,
|
context::ObjectContext,
|
||||||
replies::ObjectReplies,
|
replies::{ObjectReplies, ObjectLikes},
|
||||||
},
|
},
|
||||||
timeline::{
|
timeline::{
|
||||||
Timeline,
|
Timeline,
|
||||||
|
|
Loading…
Reference in a new issue