improve code quality

This commit is contained in:
Brenden Bice 2019-04-02 16:00:09 -04:00
parent 8c9bcdc6c1
commit 8a2f55644c
2 changed files with 9 additions and 36 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<ul class="avatars" :class="{ 'transparent-avatar': slicedAvatars.length == 15 }"> <ul class="avatars">
<li class="avatars-item" v-for="avatar in slicedAvatars" :key="avatar.id"> <li class="avatars-item" v-for="(avatar, index) in slicedAvatars" :key="`avatar-${index}`">
<UserAvatar :src="avatar.profile_image_url" class="avatars-img" /> <UserAvatar :src="avatar.profile_image_url" class="avatars-img" />
</li> </li>
</ul> </ul>
@ -18,37 +18,16 @@
flex-direction: row-reverse; flex-direction: row-reverse;
&-item { &-item {
height: 30px; height: 25px;
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 15px; width: 15px;
.avatars-img { .avatars-img {
border-radius: 50%; border-radius: $fallback--avatarAltRadius;
height: 30px; border-radius: var(--avatarAltRadius, $fallback--avatarAltRadius);
width: 30px; height: 25px !important;
line-height: 30px; width: 25px !important;
background-color: $main-background;
}
}
}
.transparent-avatar {
.avatars-item {
&:first-child {
position: relative;
.avatars-img {
&::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.7);
left: 0;
top: 0;
}
}
} }
} }
} }

View File

@ -121,8 +121,8 @@ const conversation = {
this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id}) this.$store.state.api.backendInteractor.fetchConversation({id: this.status.id})
.then(({ancestors, descendants}) => { .then(({ancestors, descendants}) => {
const ancestorId = ancestors.length ? ancestors[0].id : this.status.id const ancestorId = ancestors.length ? ancestors[0].id : this.status.id
this.fetchFavoritedByUsers(ancestorId) this.$store.dispatch('fetchFavoritedByUsers', { id: ancestorId })
this.fetchRebloggedByUsers(ancestorId) this.$store.dispatch('fetchRebloggedByUsers', { id: ancestorId })
this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: ancestors })
this.$store.dispatch('addNewStatuses', { statuses: descendants }) this.$store.dispatch('addNewStatuses', { statuses: descendants })
}) })
@ -151,12 +151,6 @@ const conversation = {
if (!this.expanded) { if (!this.expanded) {
this.setHighlight(null) this.setHighlight(null)
} }
},
fetchFavoritedByUsers (id) {
this.$store.dispatch('fetchFavoritedByUsers', { id })
},
fetchRebloggedByUsers (id) {
this.$store.dispatch('fetchRebloggedByUsers', { id })
} }
} }
} }