enlarge avatar in profile page

This commit is contained in:
taehoon 2019-07-22 16:58:20 -04:00
parent 8aa3e7d52e
commit 7c2982064e
2 changed files with 32 additions and 1 deletions

View file

@ -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)
}
}
}

View file

@ -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);