diff options
| -rw-r--r-- | src/components/user_card/user_card.js | 14 | ||||
| -rw-r--r-- | src/components/user_card/user_card.vue | 19 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index e019ebbd..a3c962fb 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -5,6 +5,7 @@ import ModerationTools from '../moderation_tools/moderation_tools.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' +import { isEqual } from 'lodash' export default { props: [ 'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered' ], @@ -100,6 +101,11 @@ export default { const validRole = rights.admin || rights.moderator const roleTitle = rights.admin ? 'admin' : 'moderator' return validRole && roleTitle + }, + isActiveRoute () { + const profileRoute = this.userProfileLink(this.user) + const currentRoute = this.$router.currentRoute + return profileRoute.name === currentRoute.name && isEqual(profileRoute.params, currentRoute.params) } }, components: { @@ -162,6 +168,14 @@ export default { }, reportUser () { this.$store.dispatch('openUserReportingModal', this.user.id) + }, + enlargeAvatar () { + const attachment = { + url: this.user.profile_image_url_original, + mimetype: 'image' + } + this.$store.dispatch('setMedia', [attachment]) + this.$store.dispatch('setCurrent', attachment) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 9e142480..3c0bf0d4 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -7,7 +7,20 @@ <div class="panel-heading"> <div class="user-info"> <div class="container"> - <router-link :to="userProfileLink(user)"> + <a + v-if="isActiveRoute" + class="user-info-avatar-link" + @click="enlargeAvatar" + > + <UserAvatar + :better-shadow="betterShadow" + :user="user" + /> + </a> + <router-link + v-else + :to="userProfileLink(user)" + > <UserAvatar :better-shadow="betterShadow" :user="user" @@ -372,6 +385,10 @@ } } + &-avatar-link { + cursor: pointer; + } + .usersettings { color: $fallback--lightText; color: var(--lightText, $fallback--lightText); |
