feat: add modal to episode bar
All checks were successful
repod / xml (push) Successful in 27s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Successful in 2m40s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-01-17 22:18:32 +01:00
parent 5f0b43c26f
commit b784040b69
3 changed files with 50 additions and 30 deletions

View File

@ -44,19 +44,11 @@ export default {
OpenInNew, OpenInNew,
}, },
props: { props: {
name: {
type: String,
required: true,
},
image: {
type: String,
required: true,
},
description: { description: {
type: String, type: String,
default: '', default: '',
}, },
url: { image: {
type: String, type: String,
required: true, required: true,
}, },
@ -64,7 +56,7 @@ export default {
type: String, type: String,
default: null, default: null,
}, },
title: { name: {
type: String, type: String,
required: true, required: true,
}, },
@ -72,6 +64,14 @@ export default {
type: Number, type: Number,
default: null, default: null,
}, },
title: {
type: String,
required: true,
},
url: {
type: String,
required: true,
},
}, },
computed: { computed: {
episodeFileSize() { episodeFileSize() {

View File

@ -33,28 +33,30 @@
{{ t('repod', 'Stop') }} {{ t('repod', 'Stop') }}
</NcActionButton> </NcActionButton>
</template> </template>
<template #extra>
<NcModal :show="modalEpisode && modalEpisode.guid === episode.guid" @close="modalEpisode = null">
<Modal :description="episode.description"
:image="episode.image"
:link="episode.link"
:name="episode.name"
:size="episode.size"
:title="episode.title"
:url="episode.url" />
</NcModal>
</template>
</NcListItem> </NcListItem>
</ul> </ul>
<NcModal v-if="modalEpisode" @close="closeModal">
<Modal :description="modalEpisode.description"
:image="modalEpisode.image"
:link="modalEpisode.link"
:name="modalEpisode.name"
:size="modalEpisode.size"
:title="modalEpisode.title"
:url="modalEpisode.url" />
</NcModal>
</div> </div>
</template> </template>
<script> <script>
import { NcActionButton, NcAvatar, NcListItem, NcModal } from '@nextcloud/vue' import { NcActionButton, NcAvatar, NcListItem, NcModal } from '@nextcloud/vue'
import { decodeUrl, encodeUrl } from '../../utils/url.js'
import Loading from '../Atoms/Loading.vue' import Loading from '../Atoms/Loading.vue'
import Modal from './Modal.vue' import Modal from '../Atoms/Modal.vue'
import PlayButton from 'vue-material-design-icons/Play.vue' import PlayButton from 'vue-material-design-icons/Play.vue'
import StopButton from 'vue-material-design-icons/Stop.vue' import StopButton from 'vue-material-design-icons/Stop.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { decodeUrl } from '../../utils/url.js'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
import moment from '@nextcloud/moment' import moment from '@nextcloud/moment'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
@ -112,10 +114,6 @@ export default {
load(episode) { load(episode) {
this.$store.dispatch('player/load', episode) this.$store.dispatch('player/load', episode)
}, },
closeModal() {
this.modalEpisode = null
this.$router.push(encodeUrl(this.url))
},
}, },
} }
</script> </script>

View File

@ -1,19 +1,37 @@
<template> <template>
<div> <div class="root">
<a :href="player.episode.link" target="_blank"> <strong class="name" @click="modal = true">{{ player.episode.name }}</strong>
<strong>{{ player.episode.name }}</strong>
</a>
<router-link :to="hash"> <router-link :to="hash">
<i>{{ player.episode.title }}</i> <i>{{ player.episode.title }}</i>
</router-link> </router-link>
<NcModal :show="modal" @close="modal = false">
<Modal :description="player.episode.description"
:image="player.episode.image"
:link="player.episode.link"
:name="player.episode.name"
:size="player.episode.size"
:title="player.episode.title"
:url="player.episode.url" />
</NcModal>
</div> </div>
</template> </template>
<script> <script>
import Modal from '../Atoms/Modal.vue'
import { NcModal } from '@nextcloud/vue'
import { toUrl } from '../../utils/url.js' import { toUrl } from '../../utils/url.js'
export default { export default {
name: 'Infos', name: 'Infos',
components: {
Modal,
NcModal,
},
data() {
return {
modal: false,
}
},
computed: { computed: {
player() { player() {
return this.$store.state.player return this.$store.state.player
@ -26,7 +44,11 @@ export default {
</script> </script>
<style scoped> <style scoped>
div { .name {
cursor: pointer;
}
.root {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;