Refactor Hashtag component from #5427

This commit is contained in:
Daniel Supernault 2025-01-05 14:55:16 -07:00
parent 6ea108b67c
commit 0a73094d82
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1

View file

@ -34,8 +34,7 @@
v-else
:disabled="followingLoading"
class="btn btn-primary hashtag-follow font-weight-bold rounded-pill py-1 px-4"
@click="followHashtag()"
>
@click="followHashtag()">
<b-spinner v-if="followingLoading" small />
<span v-else>
{{ $t('profile.follow') }}
@ -43,7 +42,6 @@
</button>
</template>
</div>
</div>
</div>
@ -74,7 +72,7 @@
width="32"
height="32"
:hash="status.media_attachments[0].blurhash"
:src="status.media_attachments[0].preview_url"
:src="getMediaSource(status)"
/>
</div>
<span v-if="status.pf_type == 'photo:album'" class="float-right mr-3 post-icon"><i class="fas fa-images fa-2x"></i></span>
@ -99,9 +97,7 @@
</div>
</intersect>
<!-- <div v-else class="ph-item">
<div class="ph-picture big"></div>
</div> -->
</div>
</div>
@ -120,6 +116,7 @@
</template>
</div>
</div>
<drawer />
</div>
</div>
@ -281,6 +278,20 @@
}, 500);
});
},
getMediaSource(status) {
let media = status.media_attachments[0];
if(media.preview_url && media.preview_url.endsWith('storage/no-preview.png')) {
return media.url;
}
if(media.preview_url && media.preview_url.length) {
return media.url;
}
return media.url;
}
}
}
</script>