From 8f255fbad4ee80718da6b2154c410995561729de Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 17 Dec 2018 19:14:38 +0300 Subject: [PATCH 1/6] Refactor follower/friends out of statuses/timeline into user_profile where it belongs. Changed display of profile to single panel with tabs. --- src/components/timeline/timeline.js | 36 +++-------- src/components/timeline/timeline.vue | 33 ++-------- src/components/user_profile/user_profile.js | 24 +++++++ src/components/user_profile/user_profile.vue | 66 ++++++++++++++++---- src/modules/statuses.js | 17 ----- src/modules/users.js | 17 +++++ 6 files changed, 110 insertions(+), 83 deletions(-) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index f28b85bddc..98da86607b 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -10,7 +10,8 @@ const Timeline = { 'timelineName', 'title', 'userId', - 'tag' + 'tag', + 'embedded' ], data () { return { @@ -20,15 +21,6 @@ const Timeline = { }, computed: { timelineError () { return this.$store.state.statuses.error }, - followers () { - return this.timeline.followers - }, - friends () { - return this.timeline.friends - }, - viewing () { - return this.timeline.viewing - }, newStatusCount () { return this.timeline.newStatusCount }, @@ -38,6 +30,14 @@ const Timeline = { } else { return ` (${this.newStatusCount})` } + }, + classes () { + return { + root: ['timeline'].concat(!this.embedded ? ['panel', 'panel-default'] : []), + header: ['timeline-heading'].concat(!this.embedded ? ['panel-heading'] : []), + body: ['timeline-body'].concat(!this.embedded ? ['panel-body'] : []), + footer: ['timeline-footer'].concat(!this.embedded ? ['panel-footer'] : []) + } } }, components: { @@ -60,12 +60,6 @@ const Timeline = { userId: this.userId, tag: this.tag }) - - // don't fetch followers for public, friend, twkn - if (this.timelineName === 'user') { - this.fetchFriends() - this.fetchFollowers() - } }, mounted () { if (typeof document.hidden !== 'undefined') { @@ -103,16 +97,6 @@ const Timeline = { tag: this.tag }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false })) }, 1000, this), - fetchFollowers () { - const id = this.userId - this.$store.state.api.backendInteractor.fetchFollowers({ id }) - .then((followers) => this.$store.dispatch('addFollowers', { followers })) - }, - fetchFriends () { - const id = this.userId - this.$store.state.api.backendInteractor.fetchFriends({ id }) - .then((friends) => this.$store.dispatch('addFriends', { friends })) - }, scrollLoad (e) { const bodyBRect = document.body.getBoundingClientRect() const height = Math.max(bodyBRect.height, -(bodyBRect.y)) diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index bc7f74c215..6ba598c5d2 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -1,6 +1,6 @@ +