aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_card
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/user_card')
-rw-r--r--src/components/user_card/user_card.js38
-rw-r--r--src/components/user_card/user_card.vue55
2 files changed, 48 insertions, 45 deletions
diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js
index cc8a1ed6..8e6b9d7f 100644
--- a/src/components/user_card/user_card.js
+++ b/src/components/user_card/user_card.js
@@ -4,13 +4,12 @@ import ProgressButton from '../progress_button/progress_button.vue'
import FollowButton from '../follow_button/follow_button.vue'
import ModerationTools from '../moderation_tools/moderation_tools.vue'
import AccountActions from '../account_actions/account_actions.vue'
-import { hex2rgb } from '../../services/color_convert/color_convert.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
import { mapGetters } from 'vuex'
export default {
props: [
- 'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar'
+ 'userId', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar'
],
data () {
return {
@@ -22,6 +21,12 @@ export default {
this.$store.dispatch('fetchUserRelationship', this.user.id)
},
computed: {
+ user () {
+ return this.$store.getters.findUser(this.userId)
+ },
+ relationship () {
+ return this.$store.getters.relationship(this.userId)
+ },
classes () {
return [{
'user-card-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius
@@ -30,21 +35,11 @@ export default {
}]
},
style () {
- const color = this.$store.getters.mergedConfig.customTheme.colors
- ? this.$store.getters.mergedConfig.customTheme.colors.bg // v2
- : this.$store.getters.mergedConfig.colors.bg // v1
-
- if (color) {
- const rgb = (typeof color === 'string') ? hex2rgb(color) : color
- const tintColor = `rgba(${Math.floor(rgb.r)}, ${Math.floor(rgb.g)}, ${Math.floor(rgb.b)}, .5)`
-
- return {
- backgroundColor: `rgb(${Math.floor(rgb.r * 0.53)}, ${Math.floor(rgb.g * 0.56)}, ${Math.floor(rgb.b * 0.59)})`,
- backgroundImage: [
- `linear-gradient(to bottom, ${tintColor}, ${tintColor})`,
- `url(${this.user.cover_photo})`
- ].join(', ')
- }
+ return {
+ backgroundImage: [
+ `linear-gradient(to bottom, var(--profileTint), var(--profileTint))`,
+ `url(${this.user.cover_photo})`
+ ].join(', ')
}
},
isOtherUser () {
@@ -93,6 +88,12 @@ export default {
const roleTitle = rights.admin ? 'admin' : 'moderator'
return validRole && roleTitle
},
+ hideFollowsCount () {
+ return this.isOtherUser && this.user.hide_follows_count
+ },
+ hideFollowersCount () {
+ return this.isOtherUser && this.user.hide_followers_count
+ },
...mapGetters(['mergedConfig'])
},
components: {
@@ -143,6 +144,9 @@ export default {
}
this.$store.dispatch('setMedia', [attachment])
this.$store.dispatch('setCurrent', attachment)
+ },
+ mentionUser () {
+ this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user })
}
}
}
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
index 6f3c958e..c4a5ce9d 100644
--- a/src/components/user_card/user_card.vue
+++ b/src/components/user_card/user_card.vue
@@ -50,15 +50,6 @@
>
{{ user.name }}
</div>
- <router-link
- v-if="!isOtherUser"
- :to="{ name: 'user-settings' }"
- >
- <i
- class="button-icon icon-wrench usersettings"
- :title="$t('tool_tip.user_settings')"
- />
- </router-link>
<a
v-if="isOtherUser && !user.is_local"
:href="user.statusnet_profile_url"
@@ -69,6 +60,7 @@
<AccountActions
v-if="isOtherUser && loggedIn"
:user="user"
+ :relationship="relationship"
/>
</div>
<div class="bottom-line">
@@ -92,7 +84,7 @@
</div>
<div class="user-meta">
<div
- v-if="user.follows_you && loggedIn && isOtherUser"
+ v-if="relationship.followed_by && loggedIn && isOtherUser"
class="following"
>
{{ $t('user_card.follows_you') }}
@@ -117,7 +109,7 @@
type="color"
>
<label
- for="style-switcher"
+ for="theme_tab"
class="userHighlightSel select"
>
<select
@@ -139,10 +131,10 @@
class="user-interactions"
>
<div class="btn-group">
- <FollowButton :user="user" />
- <template v-if="user.following">
+ <FollowButton :relationship="relationship" />
+ <template v-if="relationship.following">
<ProgressButton
- v-if="!user.subscribed"
+ v-if="!relationship.subscribing"
class="btn btn-default"
:click="subscribeUser"
:title="$t('user_card.subscribe')"
@@ -151,7 +143,7 @@
</ProgressButton>
<ProgressButton
v-else
- class="btn btn-default pressed"
+ class="btn btn-default toggled"
:click="unsubscribeUser"
:title="$t('user_card.unsubscribe')"
>
@@ -161,8 +153,8 @@
</div>
<div>
<button
- v-if="user.muted"
- class="btn btn-default btn-block pressed"
+ v-if="relationship.muting"
+ class="btn btn-default btn-block toggled"
@click="unmuteUser"
>
{{ $t('user_card.muted') }}
@@ -175,6 +167,14 @@
{{ $t('user_card.mute') }}
</button>
</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"
@@ -208,14 +208,14 @@
@click.prevent="setProfileView('friends')"
>
<h5>{{ $t('user_card.followees') }}</h5>
- <span>{{ user.friends_count }}</span>
+ <span>{{ hideFollowsCount ? $t('user_card.hidden') : user.friends_count }}</span>
</div>
<div
class="user-count"
@click.prevent="setProfileView('followers')"
>
<h5>{{ $t('user_card.followers') }}</h5>
- <span>{{ user.followers_count }}</span>
+ <span>{{ hideFollowersCount ? $t('user_card.hidden') : user.followers_count }}</span>
</div>
</div>
<!-- eslint-disable vue/no-v-html -->
@@ -278,6 +278,7 @@
mask-size: 100% 60%;
border-top-left-radius: calc(var(--panelRadius) - 1px);
border-top-right-radius: calc(var(--panelRadius) - 1px);
+ background-color: var(--profileBg);
&.hide-bio {
mask-size: 100% 40px;
@@ -291,6 +292,11 @@
&-bio {
text-align: center;
+ a {
+ color: $fallback--link;
+ color: var(--postLink, $fallback--link);
+ }
+
img {
object-fit: contain;
vertical-align: middle;
@@ -452,14 +458,13 @@
color: var(--text, $fallback--text);
}
- // TODO use proper colors
.staff {
flex: none;
text-transform: capitalize;
color: $fallback--text;
- color: var(--btnText, $fallback--text);
+ color: var(--alertNeutralText, $fallback--text);
background-color: $fallback--fg;
- background-color: var(--btn, $fallback--fg);
+ background-color: var(--alertNeutral, $fallback--fg);
}
}
@@ -530,12 +535,6 @@
button {
margin: 0;
-
- &.pressed {
- // TODO: This should be themed.
- border-bottom-color: rgba(255, 255, 255, 0.2);
- border-top-color: rgba(0, 0, 0, 0.2);
- }
}
}
}