From 2ae37af572c5e57bbf93e7674129da043df85d86 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 27 Feb 2019 20:59:16 -0700 Subject: [PATCH] Update Timeline component --- resources/assets/js/components/Timeline.vue | 137 +++++++++++++++++++- 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 0d60705be..baf0f6528 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -183,11 +183,11 @@

{{profile.statuses_count}}

Posts

- +

{{profile.followers_count}}

Followers

- +

{{profile.following_count}}

Following

@@ -297,6 +297,64 @@ + +
+
+
+ + + +
+

+ + {{user.username}} + +

+

+ {{user.display_name}} +

+
+
+
+
+

Load more

+
+
+
+ +
+
+
+ + + +
+

+ + {{user.username}} + +

+

+ {{user.display_name}} +

+
+
+
+
+

Load more

+
+
+
@@ -337,7 +395,13 @@ 'dark': false, 'notify': true, 'infinite': true - } + }, + followers: [], + followerCursor: 1, + followerMore: true, + following: [], + followingCursor: 1, + followingMore: true } }, @@ -812,6 +876,73 @@ modeInfiniteToggle() { this.modes.infinite = !this.modes.infinite window.ls.set('pixelfed-classicui-settings', this.modes); + }, + + followingModal() { + if(this.following.length > 0) { + this.$refs.followingModal.show(); + return; + } + axios.get('/api/v1/accounts/'+this.profile.id+'/following', { + params: { + page: this.followingCursor + } + }) + .then(res => { + this.following = res.data; + this.followingCursor++; + }); + this.$refs.followingModal.show(); + }, + + followersModal() { + if(this.followers.length > 0) { + this.$refs.followerModal.show(); + return; + } + axios.get('/api/v1/accounts/'+this.profile.id+'/followers', { + params: { + page: this.followerCursor + } + }) + .then(res => { + this.followers = res.data; + this.followerCursor++; + }) + this.$refs.followerModal.show(); + }, + + followingLoadMore() { + axios.get('/api/v1/accounts/'+this.profile.id+'/following', { + params: { + page: this.followingCursor + } + }) + .then(res => { + if(res.data.length > 0) { + this.following.push(...res.data); + this.followingCursor++; + } else { + this.followingMore = false; + } + }); + }, + + + followersLoadMore() { + axios.get('/api/v1/accounts/'+this.profile.id+'/followers', { + params: { + page: this.followerCursor + } + }) + .then(res => { + if(res.data.length > 0) { + this.followers.push(...res.data); + this.followerCursor++; + } else { + this.followerMore = false; + } + }); } } }