repod/src/components/Feed/Banner.vue

114 lines
2.0 KiB
Vue
Raw Normal View History

2023-08-23 10:11:39 +02:00
<template>
<div class="header">
<img class="background" :src="imageUrl">
<div class="content">
2023-08-23 17:54:09 +02:00
<NcAvatar class="avatar"
:display-name="author"
2023-08-23 10:11:39 +02:00
:is-no-user="true"
:url="imageUrl" />
<div class="infos">
2023-08-23 17:54:09 +02:00
<h2>{{ title }}</h2>
2023-08-23 10:11:39 +02:00
<a :href="link" target="_blank">
2023-08-23 17:54:09 +02:00
<i>{{ author }}</i>
2023-08-23 10:11:39 +02:00
</a>
2023-08-23 17:54:09 +02:00
<br><br>
<p>
<small>{{ description }}</small>
</p>
2023-08-23 10:11:39 +02:00
</div>
2023-08-23 17:54:09 +02:00
<NcAppNavigationNew :text="t('Subscribe')" @click="addSubscription">
2023-08-23 10:11:39 +02:00
<template #icon>
<Plus :size="20" />
</template>
</NcAppNavigationNew>
</div>
</div>
</template>
<script>
import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue'
import Plus from 'vue-material-design-icons/Plus.vue'
2023-08-23 17:54:09 +02:00
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs'
2023-08-23 10:11:39 +02:00
export default {
name: 'Banner',
components: {
NcAvatar,
NcAppNavigationNew,
Plus,
},
props: {
author: {
type: String,
required: true,
},
2023-08-23 17:54:09 +02:00
description: {
type: String,
required: true,
},
2023-08-23 10:11:39 +02:00
imageUrl: {
type: String,
required: true,
},
link: {
type: String,
required: true,
},
title: {
type: String,
required: true,
},
},
2023-08-23 17:54:09 +02:00
computed: {
url() {
return atob(this.$route.params.url)
},
},
methods: {
async addSubscription() {
try {
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.url], remove: [] })
} catch (e) {
console.error(e)
showError(t('Error while adding the feed'))
}
this.$store.dispatch('subscriptions/fetch')
},
},
2023-08-23 10:11:39 +02:00
}
</script>
<style scoped>
2023-08-23 17:54:09 +02:00
.avatar {
height: 8rem;
width: 8rem;
2023-08-23 10:11:39 +02:00
}
.background {
filter: blur(.5rem) brightness(50%);
2023-08-23 17:54:09 +02:00
height: auto;
left: 0;
2023-08-23 10:11:39 +02:00
opacity: 0.4;
position: absolute;
top: 0;
width: 100%;
}
.content {
2023-08-23 17:54:09 +02:00
display: flex;
gap: 2rem;
height: 10rem;
2023-08-24 00:42:01 +02:00
overflow: auto;
2023-08-23 17:54:09 +02:00
position: relative;
}
.header {
height: 14rem;
padding: 2rem;
2023-08-23 10:11:39 +02:00
position: relative;
}
</style>