Subscription ok
This commit is contained in:
parent
7dbe046ad3
commit
fb21092dff
@ -1,16 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<a @click="addSubscription">
|
<router-link :to="toUrl(link)">
|
||||||
<img :alt="`${title} - ${author}`"
|
<img :alt="`${title} - ${author}`"
|
||||||
:src="imageUrl"
|
:src="imageUrl"
|
||||||
:title="author">
|
:title="author">
|
||||||
</a>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from '@nextcloud/axios'
|
|
||||||
import { generateUrl } from '@nextcloud/router'
|
|
||||||
import { showError } from '@nextcloud/dialogs'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TopItem',
|
name: 'TopItem',
|
||||||
components: {},
|
components: {},
|
||||||
@ -33,15 +29,8 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async addSubscription() {
|
toUrl(url) {
|
||||||
try {
|
return `/${btoa(url)}`
|
||||||
await axios.post(generateUrl('/apps/gpoddersync/subscription_change/create'), { add: [this.link], remove: [] })
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
showError(t('Error while adding the feed'))
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch('subscriptions/fetch')
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<small>{{ description }}</small>
|
<small>{{ description }}</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<NcAppNavigationNew :text="t('Subscribe')" @click="addSubscription">
|
<NcAppNavigationNew v-if="!isSubscribed" :text="t('Subscribe')" @click="addSubscription">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Plus :size="20" />
|
<Plus :size="20" />
|
||||||
</template>
|
</template>
|
||||||
@ -65,6 +65,9 @@ export default {
|
|||||||
url() {
|
url() {
|
||||||
return atob(this.$route.params.url)
|
return atob(this.$route.params.url)
|
||||||
},
|
},
|
||||||
|
isSubscribed() {
|
||||||
|
return this.$store.state.subscriptions.subscriptions.includes(this.url)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async addSubscription() {
|
async addSubscription() {
|
||||||
|
@ -14,13 +14,14 @@
|
|||||||
:url="episode.episodeImage" />
|
:url="episode.episodeImage" />
|
||||||
</template>
|
</template>
|
||||||
<template #subname>
|
<template #subname>
|
||||||
{{ format(new Date(episode.episodeDuration*1000), 'HH:mm:ss') }}
|
{{ format(new Date(episode.episodeDuration*1000), 'H:mm:ss') }}
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<NcActionButton>
|
<NcActionButton>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Play :size="20" />
|
<Play :size="20" />
|
||||||
</template>
|
</template>
|
||||||
|
{{ t('Play') }}
|
||||||
</NcActionButton>
|
</NcActionButton>
|
||||||
</template>
|
</template>
|
||||||
</NcListItem>
|
</NcListItem>
|
||||||
|
28
src/components/Player/Bar.vue
Normal file
28
src/components/Player/Bar.vue
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="currentPlayingUrl" class="oui">
|
||||||
|
{{ 'oui' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'Bar',
|
||||||
|
components: {},
|
||||||
|
computed: {
|
||||||
|
currentPlayingUrl() {
|
||||||
|
return this.$store.state.currentPlayingUrl
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.oui {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 4rem;
|
||||||
|
background-color: red;
|
||||||
|
z-index: 1001;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,5 +1,7 @@
|
|||||||
|
import { player } from './player.js'
|
||||||
import { subscriptions } from './subscriptions.js'
|
import { subscriptions } from './subscriptions.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
player,
|
||||||
subscriptions,
|
subscriptions,
|
||||||
}
|
}
|
||||||
|
11
src/modules/player.js
Normal file
11
src/modules/player.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export const player = {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
currentPlayingUrl: null,
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
set: (state, currentPlayingUrl) => {
|
||||||
|
state.currentPlayingUrl = currentPlayingUrl
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -18,6 +18,7 @@
|
|||||||
</NcAppContentList>
|
</NcAppContentList>
|
||||||
</NcAppNavigation>
|
</NcAppNavigation>
|
||||||
<router-view />
|
<router-view />
|
||||||
|
<Bar />
|
||||||
</fragment>
|
</fragment>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ import {
|
|||||||
NcAppNavigationNew,
|
NcAppNavigationNew,
|
||||||
NcLoadingIcon,
|
NcLoadingIcon,
|
||||||
} from '@nextcloud/vue'
|
} from '@nextcloud/vue'
|
||||||
|
import Bar from '../components/Player/Bar.vue'
|
||||||
import Item from '../components/Sidebar/Item.vue'
|
import Item from '../components/Sidebar/Item.vue'
|
||||||
import Plus from 'vue-material-design-icons/Plus.vue'
|
import Plus from 'vue-material-design-icons/Plus.vue'
|
||||||
import { showError } from '@nextcloud/dialogs'
|
import { showError } from '@nextcloud/dialogs'
|
||||||
@ -35,6 +37,7 @@ import { showError } from '@nextcloud/dialogs'
|
|||||||
export default {
|
export default {
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
components: {
|
components: {
|
||||||
|
Bar,
|
||||||
Item,
|
Item,
|
||||||
NcAppContentList,
|
NcAppContentList,
|
||||||
NcAppNavigation,
|
NcAppNavigation,
|
||||||
|
Loading…
Reference in New Issue
Block a user