2023-08-23 10:11:39 +02:00
|
|
|
<template>
|
|
|
|
<div class="header">
|
2024-04-30 00:48:47 +02:00
|
|
|
<img class="background" :src="imageUrl" />
|
2023-08-23 10:11:39 +02:00
|
|
|
<div class="content">
|
2024-01-21 12:16:59 +01:00
|
|
|
<div>
|
2024-04-30 00:48:47 +02:00
|
|
|
<NcAvatar
|
|
|
|
:display-name="author || title"
|
2024-01-21 12:16:59 +01:00
|
|
|
:is-no-user="true"
|
|
|
|
:size="128"
|
|
|
|
:url="imageUrl" />
|
|
|
|
<a class="feed" :href="url" @click.prevent="copyFeed">
|
2024-03-16 18:35:31 +01:00
|
|
|
<RssIcon :size="20" />
|
2024-01-21 12:16:59 +01:00
|
|
|
<i>{{ t('repod', 'Copy feed') }}</i>
|
|
|
|
</a>
|
|
|
|
</div>
|
2023-12-24 10:58:37 +01:00
|
|
|
<div class="inner">
|
|
|
|
<div class="infos">
|
|
|
|
<h2>{{ title }}</h2>
|
|
|
|
<a :href="link" target="_blank">
|
|
|
|
<i>{{ author }}</i>
|
|
|
|
</a>
|
2024-04-30 00:48:47 +02:00
|
|
|
<br /><br />
|
2024-08-08 11:37:48 +02:00
|
|
|
<SafeHtml :source="description" />
|
2023-12-24 10:58:37 +01:00
|
|
|
</div>
|
2024-04-30 00:48:47 +02:00
|
|
|
<NcAppNavigationNew
|
|
|
|
v-if="!isSubscribed"
|
2024-01-10 15:25:54 +01:00
|
|
|
:text="t('repod', 'Subscribe')"
|
2023-12-24 10:58:37 +01:00
|
|
|
@click="addSubscription">
|
|
|
|
<template #icon>
|
2024-03-16 18:35:31 +01:00
|
|
|
<PlusIcon :size="20" />
|
2023-12-24 10:58:37 +01:00
|
|
|
</template>
|
|
|
|
</NcAppNavigationNew>
|
2023-08-23 10:11:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { NcAppNavigationNew, NcAvatar } from '@nextcloud/vue'
|
2024-01-21 12:16:59 +01:00
|
|
|
import { showError, showSuccess } from '@nextcloud/dialogs'
|
2024-03-16 18:35:31 +01:00
|
|
|
import PlusIcon from 'vue-material-design-icons/Plus.vue'
|
|
|
|
import RssIcon from 'vue-material-design-icons/Rss.vue'
|
2024-08-08 11:37:48 +02:00
|
|
|
import SafeHtml from '../Atoms/SafeHtml.vue'
|
2023-08-23 17:54:09 +02:00
|
|
|
import axios from '@nextcloud/axios'
|
2024-01-11 21:41:37 +01:00
|
|
|
import { decodeUrl } from '../../utils/url.js'
|
2023-08-23 17:54:09 +02:00
|
|
|
import { generateUrl } from '@nextcloud/router'
|
2023-08-23 10:11:39 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Banner',
|
|
|
|
components: {
|
|
|
|
NcAvatar,
|
|
|
|
NcAppNavigationNew,
|
2024-03-16 18:35:31 +01:00
|
|
|
PlusIcon,
|
|
|
|
RssIcon,
|
2024-08-08 11:37:48 +02:00
|
|
|
SafeHtml,
|
2023-08-23 10:11:39 +02:00
|
|
|
},
|
|
|
|
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() {
|
2024-01-11 21:41:37 +01:00
|
|
|
return decodeUrl(this.$route.params.url)
|
2023-08-23 17:54:09 +02:00
|
|
|
},
|
2023-08-24 22:29:11 +02:00
|
|
|
isSubscribed() {
|
|
|
|
return this.$store.state.subscriptions.subscriptions.includes(this.url)
|
|
|
|
},
|
2023-08-23 17:54:09 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async addSubscription() {
|
|
|
|
try {
|
2024-05-06 12:47:47 +00:00
|
|
|
await axios.post(
|
|
|
|
generateUrl('/apps/gpoddersync/subscription_change/create'),
|
|
|
|
{
|
|
|
|
add: [this.url],
|
|
|
|
remove: [],
|
|
|
|
},
|
|
|
|
)
|
2023-08-23 17:54:09 +02:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
2024-01-10 15:25:54 +01:00
|
|
|
showError(t('repod', 'Error while adding the feed'))
|
2023-08-23 17:54:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
this.$store.dispatch('subscriptions/fetch')
|
|
|
|
},
|
2024-01-21 12:16:59 +01:00
|
|
|
copyFeed() {
|
|
|
|
window.navigator.clipboard.writeText(this.url)
|
2024-07-15 16:41:31 +02:00
|
|
|
showSuccess(t('repod', 'Link copied to the clipboard'))
|
2024-01-21 12:16:59 +01:00
|
|
|
},
|
2023-08-23 17:54:09 +02:00
|
|
|
},
|
2023-08-23 10:11:39 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
2024-04-30 00:48:47 +02:00
|
|
|
.background {
|
|
|
|
filter: blur(1rem) brightness(50%);
|
|
|
|
height: auto;
|
|
|
|
left: 0;
|
|
|
|
opacity: 0.4;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
z-index: -1;
|
|
|
|
}
|
2023-08-23 10:11:39 +02:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
.content {
|
|
|
|
display: flex;
|
|
|
|
gap: 1rem;
|
|
|
|
height: 10rem;
|
|
|
|
position: relative;
|
|
|
|
}
|
2023-08-23 17:54:09 +02:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
.feed {
|
|
|
|
display: flex;
|
|
|
|
gap: 0.2rem;
|
|
|
|
margin: 0.5rem;
|
|
|
|
}
|
2024-01-21 12:16:59 +01:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
.header {
|
|
|
|
height: 14rem;
|
|
|
|
overflow: hidden;
|
|
|
|
padding: 2rem;
|
|
|
|
position: relative;
|
|
|
|
}
|
2023-12-24 10:58:37 +01:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
.infos {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
2023-12-24 10:58:37 +01:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
.inner {
|
|
|
|
display: flex;
|
|
|
|
}
|
2023-12-24 10:58:37 +01:00
|
|
|
|
2024-04-30 00:48:47 +02:00
|
|
|
@media only screen and (max-width: 768px) {
|
|
|
|
.inner {
|
|
|
|
flex-direction: column;
|
2023-12-24 10:58:37 +01:00
|
|
|
}
|
2024-04-30 00:48:47 +02:00
|
|
|
}
|
2023-08-23 10:11:39 +02:00
|
|
|
</style>
|