From fc2a62239b193b5741e3ec9e10baeb33cad190c7 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 19 Apr 2024 06:58:54 +0200 Subject: [PATCH] feat(web): user timeline persists too it will reset every time you view another user, but at least won't reset if you go into a thread and then back to your user --- web/src/app.rs | 3 ++- web/src/page.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/app.rs b/web/src/app.rs index 6bd0b9e6..f6183718 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -17,6 +17,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 screen_width = window().screen().map(|x| x.avail_width().unwrap_or_default()).unwrap_or_default(); @@ -94,8 +95,8 @@ pub fn App() -> impl IntoView { - + } /> } /> diff --git a/web/src/page.rs b/web/src/page.rs index c3b6558a..05bf3982 100644 --- a/web/src/page.rs +++ b/web/src/page.rs @@ -31,7 +31,7 @@ pub fn ConfigPage() -> impl IntoView { } #[component] -pub fn UserPage() -> impl IntoView { +pub fn UserPage(tl: Timeline) -> impl IntoView { let params = use_params_map(); let auth = use_context::().expect("missing auth context"); let id = params.get().get("id").cloned().unwrap_or_default(); @@ -71,6 +71,10 @@ pub fn UserPage() -> impl IntoView { let following = object.following().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0); let followers = object.followers().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0); let statuses = object.outbox().get().map(|x| x.total_items().unwrap_or(0)).unwrap_or(0); + let tl_url = format!("{}/outbox/page", Uri::api("users", &id.clone(), false)); + if !tl.next.get().starts_with(&tl_url) { + tl.reset(tl_url); + } view! {
impl IntoView { }
- + }.into_view() }, }}