Take over branch and fix some issues

This commit is contained in:
shpuld 2019-02-17 18:54:22 +02:00
parent 5d0e51cae3
commit e801d78e9d
5 changed files with 81 additions and 64 deletions

View File

@ -26,7 +26,9 @@ const FollowList = {
entries () { entries () {
return this.showFollowers ? this.user.followers : this.user.friends return this.showFollowers ? this.user.followers : this.user.friends
}, },
showActions () { return this.$store.state.users.currentUser.id === this.userId } showFollowsYou () {
return !this.showFollowers || (this.showFollowers && this.userId !== this.$store.state.users.currentUser.id)
}
}, },
methods: { methods: {
fetchEntries () { fetchEntries () {

View File

@ -3,8 +3,7 @@
<user-card <user-card
v-for="entry in entries" v-for="entry in entries"
:key="entry.id" :user="entry" :key="entry.id" :user="entry"
:showFollows="!showFollowers" :noFollowsYou="!showFollowsYou"
:showActions="showActions"
/> />
<div class="text-center panel-footer"> <div class="text-center panel-footer">
<a v-if="error" @click="fetchEntries" class="alert error"> <a v-if="error" @click="fetchEntries" class="alert error">

View File

@ -6,9 +6,8 @@ import { requestFollow, requestUnfollow } from '../../services/follow_manipulate
const UserCard = { const UserCard = {
props: [ props: [
'user', 'user',
'showFollows', 'noFollowsYou',
'showApproval', 'showApproval'
'showActions'
], ],
data () { data () {
return { return {
@ -26,7 +25,7 @@ const UserCard = {
currentUser () { return this.$store.state.users.currentUser }, currentUser () { return this.$store.state.users.currentUser },
following () { return this.updated ? this.updated.following : this.user.following }, following () { return this.updated ? this.updated.following : this.user.following },
showFollow () { showFollow () {
return this.showActions && (!this.showFollows && !this.following || this.updated && !this.updated.following) return !this.showApproval && (!this.following || this.updated && !this.updated.following)
} }
}, },
methods: { methods: {

View File

@ -3,10 +3,11 @@
<router-link :to="userProfileLink(user)"> <router-link :to="userProfileLink(user)">
<UserAvatar class="avatar" @click.prevent.native="toggleUserExpanded" :src="user.profile_image_url"/> <UserAvatar class="avatar" @click.prevent.native="toggleUserExpanded" :src="user.profile_image_url"/>
</router-link> </router-link>
<div class="user-card-main-content">
<div class="usercard" v-if="userExpanded"> <div class="usercard" v-if="userExpanded">
<user-card-content :user="user" :switcher="false"></user-card-content> <user-card-content :user="user" :switcher="false"></user-card-content>
</div> </div>
<div class="name-and-screen-name" v-else> <div class="name-and-screen-name" v-if="!userExpanded">
<div :title="user.name" class="user-name"> <div :title="user.name" class="user-name">
<span v-if="user.name_html" v-html="user.name_html"></span> <span v-if="user.name_html" v-html="user.name_html"></span>
<span v-else>{{ user.name }}</span> <span v-else>{{ user.name }}</span>
@ -17,8 +18,8 @@
</router-link> </router-link>
</div> </div>
</div> </div>
<div class="follow-box"> <div class="follow-box" v-if="!userExpanded">
<span class="faint" v-if="showFollows && user.follows_you"> <span class="faint" v-if="!noFollowsYou && user.follows_you">
{{ currentUser.id == user.id ? $t('user_card.its_you') : $t('user_card.follows_you') }} {{ currentUser.id == user.id ? $t('user_card.its_you') : $t('user_card.follows_you') }}
</span> </span>
<button <button
@ -38,7 +39,7 @@
{{ $t('user_card.follow') }} {{ $t('user_card.follow') }}
</template> </template>
</button> </button>
<button v-if="showActions && following" class="btn btn-default" @click="unfollowUser" :disabled="followRequestInProgress"> <button v-if="following" class="btn btn-default pressed" @click="unfollowUser" :disabled="followRequestInProgress">
<template v-if="followRequestInProgress"> <template v-if="followRequestInProgress">
{{ $t('user_card.follow_progress') }} {{ $t('user_card.follow_progress') }}
</template> </template>
@ -52,15 +53,23 @@
<button class="btn btn-default" @click="denyUser">{{ $t('user_card.deny') }}</button> <button class="btn btn-default" @click="denyUser">{{ $t('user_card.deny') }}</button>
</div> </div>
</div> </div>
</div>
</template> </template>
<script src="./user_card.js"></script> <script src="./user_card.js"></script>
<style lang="scss"> <style lang="scss">
@import '../../_variables.scss'; @import '../../_variables.scss';
.name-and-screen-name {
.user-card-main-content {
display: flex;
flex-direction: column;
flex: 1 1 100%;
margin-left: 0.7em; margin-left: 0.7em;
margin-top: 0.0em; min-width: 0;
}
.name-and-screen-name {
text-align: left; text-align: left;
width: 100%; width: 100%;
@ -98,22 +107,24 @@
} }
.follow-box { .follow-box {
width: 15em;
text-align: center; text-align: center;
position: relative; flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
line-height: 1.5em;
.btn { .btn {
position: absolute; margin-top: 0.5em;
bottom: 0; margin-left: auto;
left: 0; width: 10em;
width: 100%;
} }
} }
} }
.usercard { .usercard {
width: fill-available; width: fill-available;
margin: 0.2em 0 0 0.7em;
border-radius: $fallback--panelRadius; border-radius: $fallback--panelRadius;
border-radius: var(--panelRadius, $fallback--panelRadius); border-radius: var(--panelRadius, $fallback--panelRadius);
border-style: solid; border-style: solid;
@ -134,9 +145,15 @@
} }
.approval { .approval {
display: flex;
flex-direction: row;
flex-wrap: wrap;
button { button {
width: 100%; margin-top: 0.5em;
margin-bottom: 0.5em; margin-right: 0.5em;
flex: 1 1;
max-width: 12em;
min-width: 8em;
} }
} }
</style> </style>

View File

@ -344,7 +344,7 @@
"follow_sent": "Request sent!", "follow_sent": "Request sent!",
"follow_progress": "Requesting…", "follow_progress": "Requesting…",
"follow_again": "Send request again?", "follow_again": "Send request again?",
"follow_unfollow": "Stop following", "follow_unfollow": "Unfollow",
"followees": "Following", "followees": "Following",
"followers": "Followers", "followers": "Followers",
"following": "Following!", "following": "Following!",