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

View file

@ -30,6 +30,20 @@
class="dropdown-divider" class="dropdown-divider"
/> />
</template> </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 <button
v-if="relationship.blocking" v-if="relationship.blocking"
class="btn btn-default btn-block dropdown-item" class="btn btn-default btn-block dropdown-item"
@ -50,6 +64,10 @@
> >
{{ $t('user_card.report') }} {{ $t('user_card.report') }}
</button> </button>
<div
role="separator"
class="dropdown-divider"
/>
<button <button
v-if="pleromaChatMessagesAvailable" v-if="pleromaChatMessagesAvailable"
class="btn btn-default btn-block dropdown-item" class="btn btn-default btn-block dropdown-item"
@ -57,14 +75,25 @@
> >
{{ $t('user_card.message') }} {{ $t('user_card.message') }}
</button> </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> </div>
<div <button
slot="trigger" slot="trigger"
class="btn btn-default ellipsis-button" class="btn btn-default ellipsis-button"
> >
<i class="icon-ellipsis trigger-button" /> <i class="icon-ellipsis trigger-button" />
</div> </button>
</Popover> </Popover>
</div> </div>
</template> </template>
@ -74,7 +103,7 @@
<style lang="scss"> <style lang="scss">
@import '../../_variables.scss'; @import '../../_variables.scss';
.account-actions { .account-actions {
margin: 0 .8em; margin: 0 .5em;
} }
.account-actions button.dropdown-item { .account-actions button.dropdown-item {

View file

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

View file

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

View file

@ -24,7 +24,7 @@ const Notifications = {
bottomedOut: false, bottomedOut: false,
// How many seen notifications to display in the list. The more there are, // How many seen notifications to display in the list. The more there are,
// the heavier the page becomes. This count is increased when loading // 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 seenToDisplayCount: DEFAULT_SEEN_TO_DISPLAY_COUNT
} }
}, },

View file

@ -31,7 +31,7 @@
@import '../../_variables.scss'; @import '../../_variables.scss';
.popover { .popover {
z-index: 8; z-index: 1000;
position: absolute; position: absolute;
min-width: 0; min-width: 0;
transition: opacity 0.3s; transition: opacity 0.3s;
@ -60,7 +60,6 @@
text-align: left; text-align: left;
list-style: none; list-style: none;
max-width: 100vw; max-width: 100vw;
z-index: 10;
white-space: nowrap; white-space: nowrap;
.dropdown-divider { .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> </style>

View file

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

View file

@ -111,12 +111,6 @@ export default {
FollowButton FollowButton
}, },
methods: { methods: {
muteUser () {
this.$store.dispatch('muteUser', this.user.id)
},
unmuteUser () {
this.$store.dispatch('unmuteUser', this.user.id)
},
subscribeUser () { subscribeUser () {
return this.$store.dispatch('subscribeUser', this.user.id) return this.$store.dispatch('subscribeUser', this.user.id)
}, },
@ -150,9 +144,6 @@ export default {
} }
this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setMedia', [attachment])
this.$store.dispatch('setCurrent', 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" /> <i class="icon-link-ext usersettings" />
</a> </a>
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
:relationship="relationship"
/>
</div> </div>
<div class="bottom-line"> <div class="bottom-line">
<router-link <router-link
@ -95,12 +90,6 @@
</div> </div>
</div> </div>
<div class="user-meta"> <div class="user-meta">
<div
v-if="relationship.followed_by && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }}
</div>
<div <div
v-if="isOtherUser && (loggedIn || !switcher)" v-if="isOtherUser && (loggedIn || !switcher)"
class="highlighter" class="highlighter"
@ -161,36 +150,19 @@
> >
<i class="icon-bell-ringing-o" /> <i class="icon-bell-ringing-o" />
</ProgressButton> </ProgressButton>
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
:relationship="relationship"
/>
</template> </template>
</div> </div>
<div> <div
<button v-if="relationship.followed_by && loggedIn && isOtherUser"
v-if="relationship.muting" class="following"
class="btn btn-default btn-block toggled"
@click="unmuteUser"
> >
{{ $t('user_card.muted') }} {{ $t('user_card.follows_you') }}
</button>
<button
v-else
class="btn btn-default btn-block"
@click="muteUser"
>
{{ $t('user_card.mute') }}
</button>
</div> </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>
<div <div
v-if="!loggedIn && user.is_local" v-if="!loggedIn && user.is_local"