diff --git a/web/src/objects/context.rs b/web/src/objects/context.rs new file mode 100644 index 0000000..cfecbb1 --- /dev/null +++ b/web/src/objects/context.rs @@ -0,0 +1,22 @@ +use leptos::*; +use leptos_router::*; +use crate::prelude::*; + + +#[component] +pub fn ObjectContext() -> 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 tl_url = format!("{}/context/page", Uri::api(U::Object, &id, false)); + if !feeds.context.next.get_untracked().starts_with(&tl_url) { + feeds.context.reset(Some(tl_url)); + } + }); + view! { +
+ +
+ } +} diff --git a/web/src/objects/replies.rs b/web/src/objects/replies.rs new file mode 100644 index 0000000..1769ade --- /dev/null +++ b/web/src/objects/replies.rs @@ -0,0 +1,22 @@ +use leptos::*; +use leptos_router::*; +use crate::prelude::*; + + +#[component] +pub fn ObjectReplies() -> 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 tl_url = format!("{}/replies/page", Uri::api(U::Object, &id, false)); + if !feeds.replies.next.get_untracked().starts_with(&tl_url) { + feeds.replies.reset(Some(tl_url)); + } + }); + view! { +
+ +
+ } +}