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 v-else
:disabled="followingLoading" :disabled="followingLoading"
class="btn btn-primary hashtag-follow font-weight-bold rounded-pill py-1 px-4" 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 /> <b-spinner v-if="followingLoading" small />
<span v-else> <span v-else>
{{ $t('profile.follow') }} {{ $t('profile.follow') }}
@ -43,7 +42,6 @@
</button> </button>
</template> </template>
</div> </div>
</div> </div>
</div> </div>
@ -74,7 +72,7 @@
width="32" width="32"
height="32" height="32"
:hash="status.media_attachments[0].blurhash" :hash="status.media_attachments[0].blurhash"
:src="status.media_attachments[0].preview_url" :src="getMediaSource(status)"
/> />
</div> </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> <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> </div>
</intersect> </intersect>
<!-- <div v-else class="ph-item">
<div class="ph-picture big"></div>
</div> -->
</div> </div>
</div> </div>
@ -120,6 +116,7 @@
</template> </template>
</div> </div>
</div> </div>
<drawer /> <drawer />
</div> </div>
</div> </div>
@ -281,6 +278,20 @@
}, 500); }, 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> </script>