2022-11-01 12:12:54 +00:00
|
|
|
<template>
|
2023-07-16 20:27:31 +00:00
|
|
|
<div class="flex flex-col flex-justify-between">
|
2024-01-19 14:24:12 +00:00
|
|
|
<router-link :to="item.url">
|
2023-08-13 17:31:57 +00:00
|
|
|
<div class="my-4 flex justify-center">
|
2024-01-19 14:24:12 +00:00
|
|
|
<img loading="lazy" class="aspect-square w-[50%] rounded-full" :src="item.thumbnail" />
|
2022-11-01 12:12:54 +00:00
|
|
|
</div>
|
|
|
|
<p>
|
2024-01-19 14:24:12 +00:00
|
|
|
<span v-text="item.name" />
|
|
|
|
<font-awesome-icon v-if="item.verified" class="ml-1.5" icon="check" />
|
2022-11-01 12:12:54 +00:00
|
|
|
</p>
|
|
|
|
</router-link>
|
2024-01-19 14:24:12 +00:00
|
|
|
<p v-if="item.description" v-text="item.description" />
|
|
|
|
<router-link v-if="item.uploaderUrl" class="link" :to="item.uploaderUrl">
|
2022-11-01 12:12:54 +00:00
|
|
|
<p>
|
2024-01-19 14:24:12 +00:00
|
|
|
<span v-text="item.uploader" />
|
|
|
|
<font-awesome-icon v-if="item.uploaderVerified" class="ml-1.5" icon="check" />
|
2022-11-01 12:12:54 +00:00
|
|
|
</p>
|
|
|
|
</router-link>
|
|
|
|
|
2024-01-19 14:24:12 +00:00
|
|
|
<a v-if="item.uploaderName" class="link" v-text="item.uploaderName" />
|
|
|
|
<template v-if="item.videos >= 0">
|
|
|
|
<br v-if="item.uploaderName" />
|
|
|
|
<strong v-text="`${item.videos} ${$t('video.videos')}`" />
|
2022-11-01 12:12:54 +00:00
|
|
|
</template>
|
|
|
|
|
2024-01-19 14:24:12 +00:00
|
|
|
<button
|
|
|
|
v-if="subscribed != null"
|
2024-02-23 16:39:16 +00:00
|
|
|
class="btn mt-2 w-max"
|
2024-01-19 14:24:12 +00:00
|
|
|
@click="subscribeHandler"
|
|
|
|
v-text="
|
|
|
|
$t('actions.' + (subscribed ? 'unsubscribe' : 'subscribe')) + ' - ' + numberFormat(item.subscribers)
|
|
|
|
"
|
|
|
|
/>
|
|
|
|
|
2022-11-01 12:12:54 +00:00
|
|
|
<br />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2024-01-19 14:24:12 +00:00
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
item: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
subscribed: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
channelId(_this) {
|
|
|
|
return _this.item.url.substr(-24);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.updateSubscribedStatus();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async updateSubscribedStatus() {
|
|
|
|
this.subscribed = await this.fetchSubscriptionStatus(this.channelId);
|
|
|
|
console.log(this.subscribed);
|
|
|
|
},
|
|
|
|
subscribeHandler() {
|
|
|
|
this.toggleSubscriptionState(this.channelId, this.subscribed).then(success => {
|
|
|
|
if (success) this.subscribed = !this.subscribed;
|
|
|
|
});
|
|
|
|
},
|
2023-07-27 11:46:05 +00:00
|
|
|
},
|
2024-01-19 14:24:12 +00:00
|
|
|
};
|
2022-11-01 12:12:54 +00:00
|
|
|
</script>
|