Merge branch 'edijs/pleroma-fe-fix/followers-ui' into 'develop'

Fix followers/follows UI, fix #343 fix #340

Closes #340 and #343

See merge request pleroma/pleroma-fe!590
This commit is contained in:
Shpuld Shpludson 2019-02-19 14:47:32 +00:00
commit ed3c318be0
8 changed files with 75 additions and 51 deletions

View file

@ -739,3 +739,7 @@ nav {
width: 100%; width: 100%;
} }
} }
.btn.btn-default {
min-height: 28px;
}

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

@ -554,7 +554,7 @@ a.unmute {
.timeline > { .timeline > {
.status-el:last-child { .status-el:last-child {
border-bottom-radius: 0 0 $fallback--panelRadius $fallback--panelRadius;; border-radius: 0 0 $fallback--panelRadius $fallback--panelRadius;
border-radius: 0 0 var(--panelRadius, $fallback--panelRadius) var(--panelRadius, $fallback--panelRadius); border-radius: 0 0 var(--panelRadius, $fallback--panelRadius) var(--panelRadius, $fallback--panelRadius);
border-bottom: none; border-bottom: none;
} }

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

@ -1,23 +1,27 @@
<template> <template>
<div class="card"> <div class="card">
<router-link :to="userProfileLink(user)"> <router-link :to="userProfileLink(user)">
<UserAvatar class="avatar" :compact="true" @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="usercard" v-if="userExpanded"> <div class="user-card-main-content">
<user-card-content :user="user" :switcher="false"></user-card-content> <div class="usercard" v-if="userExpanded">
</div> <user-card-content :user="user" :switcher="false"></user-card-content>
<div class="name-and-screen-name" v-else> </div>
<div :title="user.name" class="user-name"> <div class="name-and-screen-name" v-if="!userExpanded">
<span v-if="user.name_html" v-html="user.name_html"></span> <div :title="user.name" class="user-name">
<span v-else>{{ user.name }}</span> <span v-if="user.name_html" v-html="user.name_html"></span>
<span class="follows-you" v-if="!userExpanded && showFollows && user.follows_you"> <span v-else>{{ user.name }}</span>
</div>
<div class="user-link-action">
<router-link class='user-screen-name' :to="userProfileLink(user)">
@{{user.screen_name}}
</router-link>
</div>
</div>
<div class="follow-box" v-if="!userExpanded">
<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>
</div>
<div class="user-link-action">
<router-link class='user-screen-name' :to="userProfileLink(user)">
@{{user.screen_name}}
</router-link>
<button <button
v-if="showFollow" v-if="showFollow"
class="btn btn-default" class="btn btn-default"
@ -35,7 +39,7 @@
{{ $t('user_card.follow') }} {{ $t('user_card.follow') }}
</template> </template>
</button> </button>
<button v-if="showActions && showFollows && 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>
@ -44,10 +48,10 @@
</template> </template>
</button> </button>
</div> </div>
</div> <div class="approval" v-if="showApproval">
<div class="approval" v-if="showApproval"> <button class="btn btn-default" @click="approveUser">{{ $t('user_card.approve') }}</button>
<button class="btn btn-default" @click="approveUser">{{ $t('user_card.approve') }}</button> <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>
@ -57,15 +61,19 @@
<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%;
.user-name {
display: flex;
justify-content: space-between;
.user-name {
img { img {
object-fit: contain; object-fit: contain;
height: 16px; height: 16px;
@ -78,16 +86,9 @@
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
button {
margin-top: 3px;
}
} }
} }
.follows-you {
margin-left: 2em;
}
.card { .card {
display: flex; display: flex;
@ -99,16 +100,31 @@
border-bottom: 1px solid; border-bottom: 1px solid;
margin: 0; margin: 0;
border-bottom-color: $fallback--border; border-bottom-color: $fallback--border;
border-bottom-color: var(--border, $fallback--border); border-bottom-color: var(--border, $fallback--border);
.avatar { .avatar {
padding: 0; padding: 0;
} }
.follow-box {
text-align: center;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
line-height: 1.5em;
.btn {
margin-top: 0.5em;
margin-left: auto;
width: 10em;
}
}
} }
.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;
@ -129,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

@ -386,6 +386,4 @@
} }
} }
.floater {
}
</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!",