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' import UserAvatar from '../user_avatar/user_avatar.vue'
const AvatarList = { const AvatarList = {
props: ['avatars'], props: ['users'],
computed: { computed: {
slicedAvatars () { slicedUsers () {
return this.avatars ? this.avatars.slice(0, 15) : [] return this.users ? this.users.slice(0, 15) : []
} }
}, },
components: { components: {

View file

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

View file

@ -1,7 +1,11 @@
<template> <template>
<div class="basic-user-card"> <div class="basic-user-card">
<router-link :to="userProfileLink(user)"> <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> </router-link>
<div class="basic-user-card-expanded-content" v-if="userExpanded"> <div class="basic-user-card-expanded-content" v-if="userExpanded">
<UserCard :user="user" :rounded="true" :bordered="true"/> <UserCard :user="user" :rounded="true" :bordered="true"/>

View file

@ -7,7 +7,7 @@
</status> </status>
<div class="non-mention" :class="[userClass, { highlighted: userStyle }]" :style="[ userStyle ]" v-else> <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"> <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> </a>
<div class='notification-right'> <div class='notification-right'>
<UserCard :user="getUser(notification)" :rounded="true" :bordered="true" v-if="userExpanded" /> <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 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 // 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.favoritedBy,
this.statusFromGlobalRepository.rebloggedBy this.statusFromGlobalRepository.rebloggedBy
) )
return uniqBy(combinedAvatars, 'id') return uniqBy(combinedUsers, 'id')
} }
}, },
components: { components: {

View file

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

View file

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

View file

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

View file

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

View file

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