fix: 🎨 improve small tips

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import App from './App.vue'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import router from './router'
import router from './router.ts'
const Vue = createApp(App)
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 { defineStore } from 'pinia'
import { formatEpisodeTimestamp } from '../utils/time'
import { formatEpisodeTimestamp } from '../utils/time.ts'
import { generateUrl } from '@nextcloud/router'
const audio = new Audio()
@ -86,18 +86,15 @@ export const usePlayer = defineStore('player', {
return
}
this.episode = {
...this.episode,
action: {
podcast: this.podcastUrl,
episode: this.episode.url,
guid: this.episode.guid,
action: 'play',
timestamp: formatEpisodeTimestamp(new Date()),
started: Math.round(this.started),
position: Math.round(audio.currentTime),
total: Math.round(audio.duration),
},
this.episode.action = {
podcast: this.podcastUrl,
episode: this.episode.url,
guid: this.episode.guid,
action: 'play',
timestamp: formatEpisodeTimestamp(new Date()),
started: Math.round(this.started),
position: Math.round(audio.currentTime),
total: Math.round(audio.duration),
}
axios.post(generateUrl('/apps/gpoddersync/episode_action/create'), [

View File

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

View File

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