fix: 🎨 improve small tips
All checks were successful
repod / xml (push) Successful in 14s
repod / php (push) Successful in 39s
repod / nodejs (push) Successful in 59s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-09-14 16:54:56 +02:00
parent c47111fcce
commit fca507f118
8 changed files with 22 additions and 27 deletions

View File

@ -6,7 +6,7 @@
:size="256" :size="256"
:url="episode.image" /> :url="episode.image" />
<h2>{{ episode.name }}</h2> <h2>{{ episode.name }}</h2>
<SafeHtml :source="episode.description" /> <SafeHtml :source="episode.description || ''" />
<div class="flex"> <div class="flex">
<NcButton v-if="episode.link" :href="episode.link" target="_blank"> <NcButton v-if="episode.link" :href="episode.link" target="_blank">
<template #icon> <template #icon>
@ -32,6 +32,7 @@
<script lang="ts"> <script lang="ts">
import { NcAvatar, NcButton } from '@nextcloud/vue' import { NcAvatar, NcButton } from '@nextcloud/vue'
import DownloadIcon from 'vue-material-design-icons/Download.vue' import DownloadIcon from 'vue-material-design-icons/Download.vue'
import type { EpisodeInterface } from '../../utils/types.ts'
import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue' import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue'
import SafeHtml from './SafeHtml.vue' import SafeHtml from './SafeHtml.vue'
import { filenameFromUrl } from '../../utils/url.ts' import { filenameFromUrl } from '../../utils/url.ts'
@ -49,7 +50,7 @@ export default {
}, },
props: { props: {
episode: { episode: {
type: Object, type: Object as () => EpisodeInterface,
required: true, required: true,
}, },
}, },

View File

@ -72,6 +72,7 @@ export default {
}, },
methods: { methods: {
...mapActions(useSubscriptions, ['fetch']), ...mapActions(useSubscriptions, ['fetch']),
t,
async addSubscription() { async addSubscription() {
try { try {
await axios.post( await axios.post(
@ -85,14 +86,12 @@ export default {
console.error(e) console.error(e)
showError(t('repod', 'Error while adding the feed')) showError(t('repod', 'Error while adding the feed'))
} }
this.fetch() this.fetch()
}, },
copyFeed() { copyFeed() {
window.navigator.clipboard.writeText(this.url) window.navigator.clipboard.writeText(this.url)
showSuccess(t('repod', 'Link copied to the clipboard')) showSuccess(t('repod', 'Link copied to the clipboard'))
}, },
t,
}, },
} }
</script> </script>

View File

@ -165,10 +165,10 @@ export default {
}, },
methods: { methods: {
...mapActions(usePlayer, ['load']), ...mapActions(usePlayer, ['load']),
filenameFromUrl,
formatLocaleDate, formatLocaleDate,
hasEnded, hasEnded,
isListening, isListening,
filenameFromUrl,
t, t,
isCurrentEpisode(episode: EpisodeInterface) { isCurrentEpisode(episode: EpisodeInterface) {
return this.playerEpisode?.url === episode.url return this.playerEpisode?.url === episode.url

View File

@ -43,15 +43,12 @@ export default {
if (!this.filters.listened && this.hasEnded(episode)) { if (!this.filters.listened && this.hasEnded(episode)) {
return false return false
} }
if (!this.filters.listening && this.isListening(episode)) { if (!this.filters.listening && this.isListening(episode)) {
return false return false
} }
if (!this.filters.unlistened && !this.isListening(episode)) { if (!this.filters.unlistened && !this.isListening(episode)) {
return false return false
} }
return true return true
}) })
}, },

View File

@ -1,7 +1,7 @@
import App from './App.vue' import App from './App.vue'
import { createApp } from 'vue' import { createApp } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import router from './router' import router from './router.ts'
const Vue = createApp(App) const Vue = createApp(App)
const pinia = createPinia() const pinia = createPinia()

View File

@ -1,7 +1,7 @@
import type { EpisodeActionInterface, EpisodeInterface } from '../utils/types' import type { EpisodeActionInterface, EpisodeInterface } from '../utils/types.ts'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { formatEpisodeTimestamp } from '../utils/time' import { formatEpisodeTimestamp } from '../utils/time.ts'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
const audio = new Audio() const audio = new Audio()
@ -86,9 +86,7 @@ export const usePlayer = defineStore('player', {
return return
} }
this.episode = { this.episode.action = {
...this.episode,
action: {
podcast: this.podcastUrl, podcast: this.podcastUrl,
episode: this.episode.url, episode: this.episode.url,
guid: this.episode.guid, guid: this.episode.guid,
@ -97,7 +95,6 @@ export const usePlayer = defineStore('player', {
started: Math.round(this.started), started: Math.round(this.started),
position: Math.round(audio.currentTime), position: Math.round(audio.currentTime),
total: Math.round(audio.duration), total: Math.round(audio.duration),
},
} }
axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [ axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [

View File

@ -1,5 +1,5 @@
import { getCookie, setCookie } from '../utils/cookies' import { getCookie, setCookie } from '../utils/cookies.ts'
import type { FiltersInterface } from '../utils/types' import type { FiltersInterface } from '../utils/types.ts'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
export const useSettings = defineStore('settings', { export const useSettings = defineStore('settings', {

View File

@ -2,8 +2,8 @@ import type {
PersonalSettingsMetricsInterface, PersonalSettingsMetricsInterface,
PodcastDataInterface, PodcastDataInterface,
SubscriptionInterface, SubscriptionInterface,
} from '../utils/types' } from '../utils/types.ts'
import { getCookie, setCookie } from '../utils/cookies' import { getCookie, setCookie } from '../utils/cookies.ts'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
@ -26,6 +26,7 @@ export const useSubscriptions = defineStore('subscriptions', {
const metrics = await axios.get<PersonalSettingsMetricsInterface>( const metrics = await axios.get<PersonalSettingsMetricsInterface>(
generateUrl('/apps/gpoddersync/personal_settings/metrics'), generateUrl('/apps/gpoddersync/personal_settings/metrics'),
) )
this.subs = [...metrics.data.subscriptions] this.subs = [...metrics.data.subscriptions]
.sort((a, b) => b.listenedSeconds - a.listenedSeconds) .sort((a, b) => b.listenedSeconds - a.listenedSeconds)
.map((sub) => ({ .map((sub) => ({