forked from alemi/upub
feat(web): refresh button for context and user
i really dont like this tho it shifts the breadcrumb a lot and its weird that it appears also implemented kinda jankily idkkkk
This commit is contained in:
parent
9e42d4b460
commit
f8473a5ce1
2 changed files with 40 additions and 2 deletions
|
@ -21,6 +21,14 @@ impl Timeline {
|
||||||
Timeline { feed, next, over, loading }
|
Timeline { feed, next, over, loading }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn len(&self) -> usize {
|
||||||
|
self.feed.get().len()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.feed.get().is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn reset(&self, url: String) {
|
pub fn reset(&self, url: String) {
|
||||||
self.feed.set(vec![]);
|
self.feed.set(vec![]);
|
||||||
self.next.set(url);
|
self.next.set(url);
|
||||||
|
|
|
@ -75,7 +75,22 @@ pub fn UserPage(tl: Timeline) -> impl IntoView {
|
||||||
});
|
});
|
||||||
view! {
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<Breadcrumb back=true >users::view</Breadcrumb>
|
<Breadcrumb back=true >
|
||||||
|
users::view
|
||||||
|
<a
|
||||||
|
class="clean ml-1" href="#"
|
||||||
|
class:hidden=move || tl.is_empty()
|
||||||
|
on:click=move |_| {
|
||||||
|
tl.reset(tl.next.get().split('?').next().unwrap_or_default().to_string());
|
||||||
|
spawn_local(async move {
|
||||||
|
if let Err(e) = tl.more(auth).await {
|
||||||
|
tracing::error!("error fetching more items for timeline: {e}");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}><span class="emoji">
|
||||||
|
"\u{1f5d8}"
|
||||||
|
</span></a>
|
||||||
|
</Breadcrumb>
|
||||||
<div>
|
<div>
|
||||||
{move || {
|
{move || {
|
||||||
let uid = uid.clone();
|
let uid = uid.clone();
|
||||||
|
@ -194,7 +209,22 @@ pub fn ObjectPage(tl: Timeline) -> impl IntoView {
|
||||||
});
|
});
|
||||||
view! {
|
view! {
|
||||||
<div>
|
<div>
|
||||||
<Breadcrumb back=true >objects::view</Breadcrumb>
|
<Breadcrumb back=true >
|
||||||
|
objects::view
|
||||||
|
<a
|
||||||
|
class="clean ml-1" href="#"
|
||||||
|
class:hidden=move || tl.is_empty()
|
||||||
|
on:click=move |_| {
|
||||||
|
tl.reset(tl.next.get().split('?').next().unwrap_or_default().to_string());
|
||||||
|
spawn_local(async move {
|
||||||
|
if let Err(e) = tl.more(auth).await {
|
||||||
|
tracing::error!("error fetching more items for timeline: {e}");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}><span class="emoji">
|
||||||
|
"\u{1f5d8}"
|
||||||
|
</span></a>
|
||||||
|
</Breadcrumb>
|
||||||
<div class="ma-2" >
|
<div class="ma-2" >
|
||||||
{move || match object.get() {
|
{move || match object.get() {
|
||||||
None => view! { <p class="center"> loading ... </p> }.into_view(),
|
None => view! { <p class="center"> loading ... </p> }.into_view(),
|
||||||
|
|
Loading…
Reference in a new issue