Merge branch 'feature/follow' into 'develop'
Feature/follow See merge request !11
This commit is contained in:
commit
eac8fe0c33
5 changed files with 84 additions and 1 deletions
|
@ -6,6 +6,24 @@
|
|||
<span class="glyphicon glyphicon-user"></span>
|
||||
<div class='user-name'>{{user.name}}</div>
|
||||
<div class='user-screen-name'>@{{user.screen_name}}</div>
|
||||
<div v-if="isOtherUser" class="following-info">
|
||||
<div v-if="user.follows_you" class="following">
|
||||
Follows you!
|
||||
</div>
|
||||
<div class="followed">
|
||||
<span v-if="user.following">
|
||||
Following them!
|
||||
<button @click="unfollowUser">
|
||||
Unfollow!
|
||||
</button>
|
||||
</span>
|
||||
<span v-if="!user.following" >
|
||||
<button @click="followUser">
|
||||
Follow!
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
@ -37,6 +55,21 @@
|
|||
color: `#${this.user.profile_link_color}`,
|
||||
'background-image': `url(${this.user.cover_photo})`
|
||||
}
|
||||
},
|
||||
isOtherUser () {
|
||||
return this.user !== this.$store.state.users.currentUser
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
followUser () {
|
||||
const store = this.$store
|
||||
store.state.api.backendInteractor.followUser(this.user.id)
|
||||
.then((followedUser) => store.commit('addNewUsers', [followedUser]))
|
||||
},
|
||||
unfollowUser () {
|
||||
const store = this.$store
|
||||
store.state.api.backendInteractor.unfollowUser(this.user.id)
|
||||
.then((unfollowedUser) => store.commit('addNewUsers', [unfollowedUser]))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,3 +5,20 @@
|
|||
</template>
|
||||
|
||||
<script src="./user_profile.js"></script>
|
||||
|
||||
<style lang="scss">
|
||||
.user-profile {
|
||||
flex: 2;
|
||||
flex-basis: 500px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
.following-info {
|
||||
display: flex;
|
||||
|
||||
div {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue