From 7d14bccdeeb77d69eb572dcab10c17a58ce9fe7a Mon Sep 17 00:00:00 2001 From: alemi Date: Sun, 10 Nov 2024 21:38:39 +0100 Subject: [PATCH] feat(web): object replies and context tabs --- web/src/app.rs | 19 +++++++++++++++++-- web/src/components/post.rs | 2 ++ web/src/objects/mod.rs | 4 +++- web/src/objects/view.rs | 12 +++++++----- web/src/prelude.rs | 2 ++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/web/src/app.rs b/web/src/app.rs index 19ab0e5..00a86d9 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -10,6 +10,12 @@ use leptos_use::{ UseCookieOptions, UseElementSizeReturn }; +// TODO this is getting out of hand +// when we will add lists there will have to potentially be multiple timelines (one per list) +// per user, which doesn't scale with this model. we should either take the "go back to where +// you were" into our own hands (maybe with timeline "segments"? would also solve slow load, +// but infinite-scroll upwards too may be hard to do) or understand how it works (with page +// stacks?) and keep timelines local to views. #[derive(Clone, Copy)] pub struct Feeds { pub home: Timeline, @@ -19,6 +25,7 @@ pub struct Feeds { pub user: Timeline, pub server: Timeline, pub context: Timeline, + pub replies: Timeline, pub tag: Timeline, } @@ -32,6 +39,7 @@ impl Feeds { 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 + replies: Timeline::new(format!("{URL_BASE}/outbox/page")), // TODO ehhh } } @@ -42,6 +50,7 @@ impl Feeds { self.user.reset(None); self.server.reset(None); self.context.reset(None); + self.replies.reset(None); self.tag.reset(None); } } @@ -155,6 +164,7 @@ pub fn App() -> impl IntoView { } /> } /> } /> + } /> } /> @@ -166,9 +176,14 @@ pub fn App() -> impl IntoView { } /> - } /> - + + + + // + // + + // } /> diff --git a/web/src/components/post.rs b/web/src/components/post.rs index 55ee18b..b56b72e 100644 --- a/web/src/components/post.rs +++ b/web/src/components/post.rs @@ -109,6 +109,8 @@ pub fn PostBox(advanced: WriteSignal) -> impl IntoView { on:input=move |ev| set_content.set(event_target_value(&ev)) > + + diff --git a/web/src/objects/mod.rs b/web/src/objects/mod.rs index b6f2211..4d7a9e9 100644 --- a/web/src/objects/mod.rs +++ b/web/src/objects/mod.rs @@ -1,4 +1,6 @@ pub mod view; -pub mod item; +pub mod context; +pub mod replies; +pub mod item; pub mod attachment; diff --git a/web/src/objects/view.rs b/web/src/objects/view.rs index ee646fb..7546132 100644 --- a/web/src/objects/view.rs +++ b/web/src/objects/view.rs @@ -2,7 +2,7 @@ use leptos::*; use leptos_router::*; use crate::prelude::*; -use apb::{Object}; +use apb::{Base, Object}; #[component] pub fn ObjectView() -> impl IntoView { @@ -13,7 +13,7 @@ pub fn ObjectView() -> impl IntoView { move |oid| async move { let obj = cache::OBJECTS.resolve(&oid, U::Object, auth).await?; if let Ok(author) = obj.attributed_to().id() { - cache::OBJECTS.resolve(&author, U::Actor, auth).await; + cache::OBJECTS.resolve(author, U::Actor, auth).await; } Some(obj) @@ -35,12 +35,14 @@ pub fn ObjectView() -> impl IntoView { }, Some(Some(o)) => { let object = o.clone(); + let base = Uri::web(U::Object, o.id().unwrap_or_default()); view!{
-
- -
+ + context | replies + + }.into_view() }, }} diff --git a/web/src/prelude.rs b/web/src/prelude.rs index a452fd8..e1ed2d1 100644 --- a/web/src/prelude.rs +++ b/web/src/prelude.rs @@ -19,6 +19,8 @@ pub use crate::{ view::ObjectView, attachment::Attachment, item::{Object, Summary, LikeButton, RepostButton, ReplyButton}, + context::ObjectContext, + replies::ObjectReplies, }, timeline::{ Timeline,