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
This commit is contained in:
parent
01d0e4df85
commit
fc2a62239b
2 changed files with 8 additions and 3 deletions
|
@ -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 {
|
|||
<Route path="/web/config" view=ConfigPage />
|
||||
<Route path="/web/about" view=AboutPage />
|
||||
|
||||
<Route path="/web/users/:id" view=UserPage />
|
||||
<Route path="/web/objects/:id" view=ObjectPage />
|
||||
<Route path="/web/users/:id" view=move || view! { <UserPage tl=user_tl /> } />
|
||||
|
||||
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
|
||||
</Routes>
|
||||
|
|
|
@ -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::<Auth>().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! {
|
||||
<div class="ml-3 mr-3">
|
||||
<div
|
||||
|
@ -117,7 +121,7 @@ pub fn UserPage() -> impl IntoView {
|
|||
}</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<TimelineFeed tl=Timeline::new(format!("{}/outbox/page", Uri::api("users", &id.clone(), false))) />
|
||||
<TimelineFeed tl=tl />
|
||||
}.into_view()
|
||||
},
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue