Merge branch 'feat/title-alt-for-avatars' into 'develop'

#513 Title/alt for avatars

See merge request pleroma/pleroma-fe!776
This commit is contained in:
HJ 2019-05-01 20:30:40 +00:00
commit 2d07f26dd7
10 changed files with 33 additions and 19 deletions

View file

@ -1,10 +1,10 @@
import UserAvatar from '../user_avatar/user_avatar.vue'
const AvatarList = {
props: ['avatars'],
props: ['users'],
computed: {
slicedAvatars () {
return this.avatars ? this.avatars.slice(0, 15) : []
slicedUsers () {
return this.users ? this.users.slice(0, 15) : []
}
},
components: {

View file

@ -1,7 +1,7 @@
<template>
<div class="avatars">
<div class="avatars-item" v-for="avatar in slicedAvatars">
<UserAvatar :src="avatar.profile_image_url" class="avatar-small" />
<div class="avatars-item" v-for="user in slicedUsers">
<UserAvatar :user="user" class="avatar-small" />
</div>
</div>
</template>

View file

@ -1,7 +1,11 @@
<template>
<div class="basic-user-card">
<router-link :to="userProfileLink(user)">
<UserAvatar class="avatar" @click.prevent.native="toggleUserExpanded" :src="user.profile_image_url"/>
<UserAvatar
class="avatar"
:user="user"
@click.prevent.native="toggleUserExpanded"
/>
</router-link>
<div class="basic-user-card-expanded-content" v-if="userExpanded">
<UserCard :user="user" :rounded="true" :bordered="true"/>

View file

@ -7,7 +7,7 @@
</status>
<div class="non-mention" :class="[userClass, { highlighted: userStyle }]" :style="[ userStyle ]" v-else>
<a class='avatar-container' :href="notification.from_profile.statusnet_profile_url" @click.stop.prevent.capture="toggleUserExpanded">
<UserAvatar :compact="true" :betterShadow="betterShadow" :src="notification.from_profile.profile_image_url_original" />
<UserAvatar :compact="true" :betterShadow="betterShadow" :user="notification.from_profile"/>
</a>
<div class='notification-right'>
<UserCard :user="getUser(notification)" :rounded="true" :bordered="true" v-if="userExpanded" />

View file

@ -263,13 +263,13 @@ const Status = {
}
return this.status.summary_html + '<br />' + this.status.statusnet_html
},
combinedFavsAndRepeatsAvatars () {
combinedFavsAndRepeatsUsers () {
// Use the status from the global status repository since favs and repeats are saved in it
const combinedAvatars = [].concat(
const combinedUsers = [].concat(
this.statusFromGlobalRepository.favoritedBy,
this.statusFromGlobalRepository.rebloggedBy
)
return uniqBy(combinedAvatars, 'id')
return uniqBy(combinedUsers, 'id')
}
},
components: {

View file

@ -13,7 +13,7 @@
</template>
<template v-else>
<div v-if="retweet && !noHeading && !inConversation" :class="[repeaterClass, { highlighted: repeaterStyle }]" :style="[repeaterStyle]" class="media container retweet-info">
<UserAvatar class="media-left" v-if="retweet" :betterShadow="betterShadow" :src="statusoid.user.profile_image_url_original"/>
<UserAvatar class="media-left" v-if="retweet" :betterShadow="betterShadow" :user="statusoid.user"/>
<div class="media-body faint">
<span class="user-name">
<router-link v-if="retweeterHtml" :to="retweeterProfileLink" v-html="retweeterHtml"/>
@ -27,7 +27,7 @@
<div :class="[userClass, { highlighted: userStyle, 'is-retweet': retweet && !inConversation }]" :style="[ userStyle ]" class="media status">
<div v-if="!noHeading" class="media-left">
<router-link :to="userProfileLink" @click.stop.prevent.capture.native="toggleUserExpanded">
<UserAvatar :compact="compact" :betterShadow="betterShadow" :src="status.user.profile_image_url_original"/>
<UserAvatar :compact="compact" :betterShadow="betterShadow" :user="status.user"/>
</router-link>
</div>
<div class="status-body">
@ -91,8 +91,13 @@
</div>
<div v-if="showPreview" class="status-preview-container">
<status class="status-preview" v-if="preview" :isPreview="true" :statusoid="preview" :compact=true></status>
<div class="status-preview status-preview-loading" v-else>
<status class="status-preview"
v-if="preview"
:isPreview="true"
:statusoid="preview"
:compact=true
/>
<div v-else class="status-preview status-preview-loading">
<i class="icon-spin4 animate-spin"></i>
</div>
</div>
@ -134,7 +139,7 @@
</div>
<transition name="fade">
<div class="favs-repeated-users" v-if="combinedFavsAndRepeatsAvatars.length > 0 && isFocused">
<div class="favs-repeated-users" v-if="combinedFavsAndRepeatsUsers.length > 0 && isFocused">
<div class="stats">
<div class="stat-count" v-if="statusFromGlobalRepository.rebloggedBy && statusFromGlobalRepository.rebloggedBy.length > 0">
<a class="stat-title">{{ $t('status.repeats') }}</a>
@ -145,7 +150,7 @@
<div class="stat-number">{{ statusFromGlobalRepository.favoritedBy.length }}</div>
</div>
<div class="avatar-row">
<AvatarList :avatars='combinedFavsAndRepeatsAvatars'></AvatarList>
<AvatarList :users="combinedFavsAndRepeatsUsers"></AvatarList>
</div>
</div>
</div>

View file

@ -2,7 +2,7 @@ import StillImage from '../still-image/still-image.vue'
const UserAvatar = {
props: [
'src',
'user',
'betterShadow',
'compact'
],

View file

@ -1,8 +1,10 @@
<template>
<StillImage
class="avatar"
:alt="user.screen_name"
:title="user.screen_name"
:src="user.profile_image_url_original"
:class="{ 'avatar-compact': compact, 'better-shadow': betterShadow }"
:src="imgSrc"
:imageLoadError="imageLoadError"
/>
</template>

View file

@ -4,7 +4,7 @@
<div class='user-info'>
<div class='container'>
<router-link :to="userProfileLink(user)">
<UserAvatar :betterShadow="betterShadow" :src="user.profile_image_url_original"/>
<UserAvatar :betterShadow="betterShadow" :user="user"/>
</router-link>
<div class="name-and-screen-name">
<div class="top-line">

View file

@ -275,6 +275,9 @@ export const parseStatus = (data) => {
output.retweeted_status = parseStatus(retweetedStatus)
}
output.favoritedBy = []
output.rebloggedBy = []
return output
}