clean up user card a lot

This commit is contained in:
Shpuld Shpuldson 2020-07-17 15:42:36 +03:00
parent c4b1acd775
commit c104c76889
9 changed files with 77 additions and 61 deletions

View File

@ -1,6 +1,7 @@
import { mapState } from 'vuex'
import ProgressButton from '../progress_button/progress_button.vue'
import Popover from '../popover/popover.vue'
import ModerationTools from '../moderation_tools/moderation_tools.vue'
const AccountActions = {
props: [
@ -11,7 +12,8 @@ const AccountActions = {
},
components: {
ProgressButton,
Popover
Popover,
ModerationTools
},
methods: {
showRepeats () {
@ -20,6 +22,12 @@ const AccountActions = {
hideRepeats () {
this.$store.dispatch('hideReblogs', this.user.id)
},
muteUser () {
this.$store.dispatch('muteUser', this.user.id)
},
unmuteUser () {
this.$store.dispatch('unmuteUser', this.user.id)
},
blockUser () {
this.$store.dispatch('blockUser', this.user.id)
},
@ -34,9 +42,15 @@ const AccountActions = {
name: 'chat',
params: { recipient_id: this.user.id }
})
},
mentionUser () {
this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
}
},
computed: {
loggedIn () {
return this.$store.state.users.currentUser
},
...mapState({
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable
})

View File

@ -30,6 +30,20 @@
class="dropdown-divider"
/>
</template>
<button
v-if="relationship.muting"
class="btn btn-default btn-block dropdown-item"
@click="unmuteUser"
>
{{ $t('user_card.muted') }}
</button>
<button
v-else
class="btn btn-default btn-block dropdown-item"
@click="muteUser"
>
{{ $t('user_card.mute') }}
</button>
<button
v-if="relationship.blocking"
class="btn btn-default btn-block dropdown-item"
@ -50,6 +64,10 @@
>
{{ $t('user_card.report') }}
</button>
<div
role="separator"
class="dropdown-divider"
/>
<button
v-if="pleromaChatMessagesAvailable"
class="btn btn-default btn-block dropdown-item"
@ -57,14 +75,25 @@
>
{{ $t('user_card.message') }}
</button>
<button
class="btn btn-default btn-block dropdown-item"
@click="mentionUser"
>
{{ $t('user_card.mention') }}
</button>
<ModerationTools
v-if="loggedIn.role === &quot;admin&quot; || loggedIn"
button-class="btn btn-default btn-block dropdown-item"
:user="user"
/>
</div>
</div>
<div
<button
slot="trigger"
class="btn btn-default ellipsis-button"
>
<i class="icon-ellipsis trigger-button" />
</div>
</button>
</Popover>
</div>
</template>
@ -74,7 +103,7 @@
<style lang="scss">
@import '../../_variables.scss';
.account-actions {
margin: 0 .8em;
margin: 0 .5em;
}
.account-actions button.dropdown-item {

View File

@ -11,7 +11,8 @@ const QUARANTINE = 'mrf_tag:quarantine'
const ModerationTools = {
props: [
'user'
'user',
'buttonClass'
],
data () {
return {

View File

@ -124,8 +124,7 @@
</div>
<button
slot="trigger"
class="btn btn-default btn-block"
:class="{ toggled }"
:class="`${buttonClass} ${toggled && 'toggled'}`"
>
{{ $t('user_card.admin_menu.moderation') }}
</button>

View File

@ -24,7 +24,7 @@ const Notifications = {
bottomedOut: false,
// How many seen notifications to display in the list. The more there are,
// the heavier the page becomes. This count is increased when loading
// older notifications, and cut back to default whenever hitting "Read!".
// older notifications, and cut back to default whenever hitting "Read!"1.
seenToDisplayCount: DEFAULT_SEEN_TO_DISPLAY_COUNT
}
},

View File

@ -31,7 +31,7 @@
@import '../../_variables.scss';
.popover {
z-index: 8;
z-index: 1000;
position: absolute;
min-width: 0;
transition: opacity 0.3s;
@ -60,7 +60,6 @@
text-align: left;
list-style: none;
max-width: 100vw;
z-index: 10;
white-space: nowrap;
.dropdown-divider {
@ -113,6 +112,17 @@
}
}
&.toggled {
background-color: $fallback--lightBg;
background-color: var(--selectedMenuPopover, $fallback--lightBg);
color: $fallback--link;
color: var(--selectedMenuPopoverText, $fallback--link);
--faint: var(--selectedMenuPopoverFaintText, $fallback--faint);
--faintLink: var(--selectedMenuPopoverFaintLink, $fallback--faint);
--lightText: var(--selectedMenuPopoverLightText, $fallback--lightText);
--icon: var(--selectedMenuPopoverIcon, $fallback--icon);
}
}
}
</style>

View File

@ -175,16 +175,16 @@
}
&:not(.active) {
z-index: 4;
z-index: 2;
&:hover {
z-index: 6;
z-index: 4;
}
}
&.active {
background: transparent;
z-index: 5;
z-index: 3;
color: $fallback--text;
color: var(--tabActiveText, $fallback--text);
}
@ -216,7 +216,7 @@
&::after {
content: '';
position: absolute;
z-index: 7;
z-index: 5;
}
}
}

View File

@ -111,12 +111,6 @@ export default {
FollowButton
},
methods: {
muteUser () {
this.$store.dispatch('muteUser', this.user.id)
},
unmuteUser () {
this.$store.dispatch('unmuteUser', this.user.id)
},
subscribeUser () {
return this.$store.dispatch('subscribeUser', this.user.id)
},
@ -150,9 +144,6 @@ export default {
}
this.$store.dispatch('setMedia', [attachment])
this.$store.dispatch('setCurrent', attachment)
},
mentionUser () {
this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
}
}
}

View File

@ -59,11 +59,6 @@
>
<i class="icon-link-ext usersettings" />
</a>
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
:relationship="relationship"
/>
</div>
<div class="bottom-line">
<router-link
@ -95,12 +90,6 @@
</div>
</div>
<div class="user-meta">
<div
v-if="relationship.followed_by && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }}
</div>
<div
v-if="isOtherUser && (loggedIn || !switcher)"
class="highlighter"
@ -161,36 +150,19 @@
>
<i class="icon-bell-ringing-o" />
</ProgressButton>
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
:relationship="relationship"
/>
</template>
</div>
<div>
<button
v-if="relationship.muting"
class="btn btn-default btn-block toggled"
@click="unmuteUser"
>
{{ $t('user_card.muted') }}
</button>
<button
v-else
class="btn btn-default btn-block"
@click="muteUser"
>
{{ $t('user_card.mute') }}
</button>
<div
v-if="relationship.followed_by && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }}
</div>
<div>
<button
class="btn btn-default btn-block"
@click="mentionUser"
>
{{ $t('user_card.mention') }}
</button>
</div>
<ModerationTools
v-if="loggedIn.role === &quot;admin&quot;"
:user="user"
/>
</div>
<div
v-if="!loggedIn && user.is_local"