diff --git a/web/src/app.rs b/web/src/app.rs index f6183718..9bc310ba 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -18,6 +18,7 @@ pub fn App() -> impl IntoView { let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", username.get().unwrap_or_default())); let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page")); let user_tl = Timeline::new(format!("{URL_BASE}/users/{}/outbox/page", username.get().unwrap_or_default())); + let context_tl = Timeline::new(format!("{URL_BASE}/outbox/page")); let screen_width = window().screen().map(|x| x.avail_width().unwrap_or_default()).unwrap_or_default(); @@ -95,8 +96,8 @@ pub fn App() -> impl IntoView { - } /> + } /> } /> diff --git a/web/src/page.rs b/web/src/page.rs index 05bf3982..96933c77 100644 --- a/web/src/page.rs +++ b/web/src/page.rs @@ -131,7 +131,7 @@ pub fn UserPage(tl: Timeline) -> impl IntoView { } #[component] -pub fn ObjectPage() -> impl IntoView { +pub fn ObjectPage(tl: Timeline) -> impl IntoView { let params = use_params_map(); let auth = use_context::().expect("missing auth context"); let object = create_local_resource(move || params.get().get("id").cloned().unwrap_or_default(), move |oid| { @@ -151,9 +151,20 @@ pub fn ObjectPage() -> impl IntoView { objects::view {move || match object.get() { - Some(Some(o)) => view!{ }.into_view(), - Some(None) => view! { loading failed }.into_view(), None => view! { loading ... }.into_view(), + Some(None) => view! { loading failed }.into_view(), + Some(Some(o)) => { + let tl_url = format!("{}/page", Uri::api("context", &o.context().id().unwrap_or_default(), false)); + if !tl.next.get().starts_with(&tl_url) { + tl.reset(tl_url); + } + view!{ + + + + + }.into_view() + }, }} diff --git a/web/src/timeline.rs b/web/src/timeline.rs index badc59b2..729213bf 100644 --- a/web/src/timeline.rs +++ b/web/src/timeline.rs @@ -1,5 +1,6 @@ use std::collections::BTreeSet; +use apb::Base; use leptos::*; use crate::prelude::*; @@ -52,11 +53,16 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView { key=|k| k.to_string() children=move |id: String| { match CACHE.get(&id) { - Some(object) => { - view! { - - - }.into_view() + Some(object) => match object.base_type() { + Some(apb::BaseType::Object(apb::ObjectType::Activity(_))) => view! { + + + }.into_view(), + Some(apb::BaseType::Object(apb::ObjectType::Note)) => view! { + + + }.into_view(), + _ => view! { type not implemented }.into_view(), }, None => view! { {id}" "[go] @@ -82,7 +88,7 @@ async fn process_activities( activities: Vec, auth: Signal>, ) -> Vec { - use apb::{Base, Activity, ActivityMut}; + use apb::{Activity, ActivityMut}; let mut sub_tasks = Vec::new(); let mut gonna_fetch = BTreeSet::new(); let mut out = Vec::new();
loading failed
loading ...
type not implemented
{id}" "[go]
{id}