diff --git a/web/src/components/timeline.rs b/web/src/components/timeline.rs index 40d551d..a934cc8 100644 --- a/web/src/components/timeline.rs +++ b/web/src/components/timeline.rs @@ -9,6 +9,7 @@ pub struct Timeline { pub feed: RwSignal>, pub next: RwSignal, pub over: RwSignal, + pub loading: RwSignal, } impl Timeline { @@ -16,7 +17,8 @@ impl Timeline { let feed = create_rw_signal(vec![]); let next = create_rw_signal(url); let over = create_rw_signal(false); - Timeline { feed, next, over } + let loading = create_rw_signal(false); + Timeline { feed, next, over, loading } } pub fn reset(&self, url: String) { @@ -26,6 +28,13 @@ impl Timeline { } pub async fn more(&self, auth: Signal>) -> reqwest::Result<()> { + self.loading.set(true); + let res = self.more_inner(auth).await; + self.loading.set(false); + res + } + + async fn more_inner(&self, auth: Signal>) -> reqwest::Result<()> { use apb::{Collection, CollectionPage}; let feed_url = self.next.get(); @@ -121,6 +130,7 @@ pub fn TimelineReplies(tl: Timeline, root: String) -> impl IntoView {
+ >{move || if tl.loading.get() { "loading" } else { "more" }}
} } @@ -177,8 +187,9 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView { } } / > -
+
+ >{move || if tl.loading.get() { "loading" } else { "more" }}
} }