fix: 🐛 fix crash NcTextField
Some checks failed
repod / xml (push) Successful in 1m38s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Failing after 1m6s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-08-09 22:21:07 +02:00
parent 1feb0291bb
commit 81af0c219f
4 changed files with 18 additions and 15 deletions

View File

@ -9,12 +9,12 @@
<script> <script>
import 'toastify-js/src/toastify.css' import 'toastify-js/src/toastify.css'
import { mapActions, mapState } from 'pinia'
import Bar from './components/Player/Bar.vue' import Bar from './components/Player/Bar.vue'
import GPodder from './views/GPodder.vue' import GPodder from './views/GPodder.vue'
import { NcContent } from '@nextcloud/vue' import { NcContent } from '@nextcloud/vue'
import Subscriptions from './components/Sidebar/Subscriptions.vue' import Subscriptions from './components/Sidebar/Subscriptions.vue'
import { loadState } from '@nextcloud/initial-state' import { loadState } from '@nextcloud/initial-state'
import { mapActions } from 'pinia'
import { usePlayer } from './store/player.js' import { usePlayer } from './store/player.js'
export default { export default {
@ -26,15 +26,22 @@ export default {
Subscriptions, Subscriptions,
}, },
computed: { computed: {
...mapState(usePlayer, ['paused']),
gpodder() { gpodder() {
return loadState('repod', 'gpodder', false) return loadState('repod', 'gpodder', false)
}, },
}, },
mounted() { mounted() {
this.init() this.init()
setInterval(() => {
if (this.paused === false) {
this.time()
}
}, 40000)
}, },
methods: { methods: {
...mapActions(usePlayer, ['init']), ...mapActions(usePlayer, ['init', 'time']),
}, },
} }
</script> </script>

View File

@ -28,12 +28,6 @@ export const usePlayer = defineStore('player', {
audio.onseeked = () => (this.currentTime = audio.currentTime) audio.onseeked = () => (this.currentTime = audio.currentTime)
audio.ontimeupdate = () => (this.currentTime = audio.currentTime) audio.ontimeupdate = () => (this.currentTime = audio.currentTime)
audio.onvolumechange = () => (this.volume = audio.volume) audio.onvolumechange = () => (this.volume = audio.volume)
setInterval(() => {
if (this.paused === false) {
this.time()
}
}, 40000)
}, },
load: async (episode, podcastUrl) => { load: async (episode, podcastUrl) => {
this.episode = episode this.episode = episode

View File

@ -4,9 +4,9 @@ export const showMessage = (text, backgroundColor) =>
toastify({ toastify({
text, text,
backgroundColor, backgroundColor,
}) }).showToast()
export const showError = (text) => showMessage(text, '--color-error') export const showError = (text) => showMessage(text, 'var(--color-error)')
export const showWarning = (text) => showMessage(text, '--color-warning') export const showWarning = (text) => showMessage(text, 'var(--color-warning)')
export const showInfo = (text) => showMessage(text, '--color-primary') export const showInfo = (text) => showMessage(text, 'var(--color-primary)')
export const showSuccess = (text) => showMessage(text, '--color-success') export const showSuccess = (text) => showMessage(text, 'var(--color-success)')

View File

@ -1,7 +1,9 @@
<template> <template>
<AppContent class="main"> <AppContent class="main">
<NcTextField :label="t('repod', 'Find a podcast')" :value.sync="search"> <NcTextField :label="t('repod', 'Find a podcast')" v-model="search">
<template #icon>
<Magnify :size="20" /> <Magnify :size="20" />
</template>
</NcTextField> </NcTextField>
<Search v-if="search" :value="search" /> <Search v-if="search" :value="search" />
<Toplist v-if="!search" type="hot" /> <Toplist v-if="!search" type="hot" />