Compare commits

..

No commits in common. "7b7ceef5038619f00f323e2c5a901c934fe5a156" and "7c151d8f58bb63b1c0b7c669cb14503d24c77d98" have entirely different histories.

8 changed files with 24 additions and 30 deletions

View File

@ -19,7 +19,7 @@
</template> </template>
<template #actions> <template #actions>
<NcActionButton <NcActionButton
v-if="!getSubscriptions.includes(feed.link)" v-if="!subs.includes(feed.link)"
:aria-label="t('repod', 'Subscribe')" :aria-label="t('repod', 'Subscribe')"
:name="t('repod', 'Subscribe')" :name="t('repod', 'Subscribe')"
:title="t('repod', 'Subscribe')" :title="t('repod', 'Subscribe')"
@ -67,7 +67,7 @@ export default {
loading: false, loading: false,
}), }),
computed: { computed: {
...mapState(useSubscriptions, ['getSubscriptions']), ...mapState(useSubscriptions, ['subs']),
}, },
watch: { watch: {
value() { value() {

View File

@ -23,7 +23,7 @@
<SafeHtml :source="description" /> <SafeHtml :source="description" />
</div> </div>
<NcAppNavigationNew <NcAppNavigationNew
v-if="!getSubscriptions.includes(url)" v-if="!subs.includes(url)"
:text="t('repod', 'Subscribe')" :text="t('repod', 'Subscribe')"
@click="addSubscription"> @click="addSubscription">
<template #icon> <template #icon>
@ -79,7 +79,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState(useSubscriptions, ['getSubscriptions']), ...mapState(useSubscriptions, ['subs']),
url() { url() {
return decodeUrl(this.$route.params.url) return decodeUrl(this.$route.params.url)
}, },

View File

@ -53,9 +53,9 @@ export default {
loading: true, loading: true,
}), }),
computed: { computed: {
...mapState(useSubscriptions, ['getFavorites']), ...mapState(useSubscriptions, ['favs']),
currentFavoriteData() { currentFavoriteData() {
return this.getFavorites.find((fav) => fav.url === this.url) return this.favs.find((fav) => fav.url === this.url)
}, },
}, },
async mounted() { async mounted() {

View File

@ -75,9 +75,9 @@ export default {
feed: null, feed: null,
}), }),
computed: { computed: {
...mapState(useSubscriptions, ['getFavorites']), ...mapState(useSubscriptions, ['favs']),
isFavorite() { isFavorite() {
return this.getFavorites.map((fav) => fav.url).includes(this.url) return this.favs.map((fav) => fav.url).includes(this.url)
}, },
}, },
async mounted() { async mounted() {
@ -131,7 +131,7 @@ export default {
}, },
switchFavorite(value) { switchFavorite(value) {
if (value) { if (value) {
if (this.getFavorites.length >= 10) { if (this.favs.length >= 10) {
showError(t('repod', 'You can only have 10 favorites')) showError(t('repod', 'You can only have 10 favorites'))
return return
} }

View File

@ -12,13 +12,15 @@
<Loading v-if="loading" /> <Loading v-if="loading" />
<NcAppNavigationList v-if="!loading"> <NcAppNavigationList v-if="!loading">
<Subscription <Subscription
v-for="url of getFavorites.map((fav) => fav.url)" v-for="url of favs
.sort((fav) => fav.lastPub)
.map((fav) => fav.url)
.filter((url) => subs.includes(url))"
:key="url" :key="url"
:url="url" /> :url="url" />
<Subscription <Subscription
v-for="url of getSubscriptions.filter( v-for="url of subs.filter(
(sub) => (sub) => !favs.map((fav) => fav.url).includes(sub),
!getFavorites.map((fav) => fav.url).includes(sub),
)" )"
:key="url" :key="url"
:url="url" /> :url="url" />
@ -62,7 +64,7 @@ export default {
loading: true, loading: true,
}), }),
computed: { computed: {
...mapState(useSubscriptions, ['getSubscriptions', 'getFavorites']), ...mapState(useSubscriptions, ['subs', 'favs']),
}, },
async mounted() { async mounted() {
try { try {

View File

@ -44,11 +44,11 @@ export const usePlayer = defineStore('player', {
}), }),
) )
this.episode.action = action.data this.episode.action = action
} catch {} } catch {}
if ( if (
this.episode.action && this.episode.action?.position &&
this.episode.action.position < this.episode.action.total this.episode.action.position < this.episode.action.total
) { ) {
audio.currentTime = this.episode.action.position audio.currentTime = this.episode.action.position

View File

@ -8,16 +8,6 @@ export const useSubscriptions = defineStore('subscriptions', {
subs: [], subs: [],
favs: [], favs: [],
}), }),
getters: {
getSubscriptions: (state) => {
return state.subs
},
getFavorites: (state) => {
return state.favs
.filter((fav) => state.subs.includes(fav.url))
.sort((fav) => fav.lastPub)
},
},
actions: { actions: {
async fetch() { async fetch() {
const metrics = await axios.get( const metrics = await axios.get(

View File

@ -1,7 +1,7 @@
<template> <template>
<AppContent> <AppContent>
<EmptyContent <EmptyContent
v-if="!getFavorites.length" v-if="!favs.length"
class="empty" class="empty"
:description=" :description="
t('repod', 'Pin some subscriptions to see their latest updates') t('repod', 'Pin some subscriptions to see their latest updates')
@ -11,8 +11,10 @@
<StarOffIcon :size="20" /> <StarOffIcon :size="20" />
</template> </template>
</EmptyContent> </EmptyContent>
<ul v-if="getFavorites.length"> <ul v-if="favs.length">
<li v-for="url in getFavorites.map((fav) => fav.url)" :key="url"> <li
v-for="url in favs.sort((fav) => fav.lastPub).map((fav) => fav.url)"
:key="url">
<Favorites :url="url" /> <Favorites :url="url" />
</li> </li>
</ul> </ul>
@ -36,7 +38,7 @@ export default {
StarOffIcon, StarOffIcon,
}, },
computed: { computed: {
...mapState(useSubscriptions, ['getFavorites']), ...mapState(useSubscriptions, ['favs']),
}, },
} }
</script> </script>