sepia-search-motore-di-rice.../client/src/components/ChannelResult.vue

83 lines
2.2 KiB
Vue
Raw Normal View History

2020-08-27 14:44:21 +02:00
<template>
<div class="channel root-result">
2020-09-24 10:12:33 +02:00
<a target="_blank" rel="nofollow noreferrer noopener" v-bind:href="channel.url" :title="discoverChannelMessage" class="avatar">
2020-08-27 14:44:21 +02:00
<img v-if="channel.avatar" v-bind:src="channel.avatar.url" alt="">
<img v-else src="/img/default-avatar.png" alt="">
2020-09-02 10:44:10 +02:00
</a>
2020-08-27 14:44:21 +02:00
<div class="information">
<div class="title-block">
2020-09-02 10:44:10 +02:00
<h5 class="title">
2020-09-24 10:12:33 +02:00
<a target="_blank" rel="nofollow noreferrer noopener" v-bind:href="channel.url" :title="discoverChannelMessage">
2020-09-02 10:44:10 +02:00
{{ channel.displayName }}
</a>
</h5>
2020-08-27 14:44:21 +02:00
<span class="handle">{{ channel.name }}@{{ channel.host }}</span>
</div>
<div class="additional-information">
2020-09-01 11:50:55 +02:00
<div class="followers-count">
<translate :translate-n="channel.followersCount" translate-plural="%{channel.followersCount} followers">%{ channel.followersCount } follower</translate>
</div>
2020-08-27 14:44:21 +02:00
</div>
<div class="description">{{ channel.description }}</div>
<div class="button">
2020-09-24 10:12:33 +02:00
<a class="button-link" rel="nofollow noreferrer noopener" target="_blank" v-bind:href="channel.url">
2020-09-02 10:44:10 +02:00
{{ discoverChannelMessage }}
2020-09-01 11:50:55 +02:00
</a>
2020-08-27 14:44:21 +02:00
</div>
</div>
</div>
</template>
<style lang="scss">
@import '../scss/_variables';
.channel {
.avatar {
width: $thumbnail-width;
min-width: $thumbnail-width;
margin-right: 20px;
display: flex;
justify-content: center;
img {
object-fit: cover;
width: 110px;
height: 110px;
min-width: 110px;
min-height: 110px;
}
}
}
</style>
<script lang="ts">
2021-06-25 11:44:32 +02:00
import { useGettext } from '@jshmrtn/vue3-gettext'
import { defineComponent, PropType } from 'vue'
import { VideoChannel } from '../../../PeerTube/shared/models'
2020-08-27 14:44:21 +02:00
2021-06-25 11:44:32 +02:00
export default defineComponent({
2020-08-27 14:44:21 +02:00
props: {
channel: Object as PropType<VideoChannel>
},
computed: {
2021-06-25 11:44:32 +02:00
host (): string {
2020-08-27 14:44:21 +02:00
const url = this.channel.url
return new URL(url as string).host
2020-09-02 10:44:10 +02:00
},
2021-06-25 11:44:32 +02:00
discoverChannelMessage (): string {
2020-09-02 11:24:02 +02:00
return this.$gettextInterpolate(this.$gettext('Discover this channel on %{host}'), { host: this.host })
2020-08-27 14:44:21 +02:00
}
}
})
</script>