mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-13 07:50:41 -04:00
[web] Simplify image control
This commit is contained in:
parent
2b8bbb774f
commit
b11865289a
@ -10,8 +10,7 @@ import { renderSVG } from '@/lib/SVGRenderer'
|
||||
export default {
|
||||
name: 'ControlImage',
|
||||
props: {
|
||||
album: { default: '', type: String },
|
||||
artist: { default: '', type: String },
|
||||
caption: { default: '', type: String },
|
||||
url: { default: '', type: String }
|
||||
},
|
||||
emits: ['click'],
|
||||
@ -29,8 +28,8 @@ export default {
|
||||
methods: {
|
||||
dataURI() {
|
||||
return renderSVG({
|
||||
alternate: `${this.artist} - ${this.album}`,
|
||||
caption: (this.album || this.artist || '').substring(0, 2),
|
||||
alternate: this.caption,
|
||||
caption: this.caption.substring(0, 2),
|
||||
font: this.font,
|
||||
size: this.size
|
||||
})
|
||||
|
@ -3,7 +3,7 @@
|
||||
v-for="item in items"
|
||||
:key="item.itemId"
|
||||
:is-item="item.isItem"
|
||||
:image="url(item)"
|
||||
:image="image(item)"
|
||||
:index="item.index"
|
||||
:lines="[
|
||||
item.item.name,
|
||||
@ -79,6 +79,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
image(item) {
|
||||
if (this.settingsStore.show_cover_artwork_in_album_lists) {
|
||||
return { url: item.item.artwork_url, caption: item.item.name }
|
||||
}
|
||||
return null
|
||||
},
|
||||
open(item) {
|
||||
this.selectedItem = item
|
||||
if (this.media_kind_resolved === 'podcast') {
|
||||
@ -117,12 +123,6 @@ export default {
|
||||
webapi.library_playlist_delete(this.playlistToRemove.id).then(() => {
|
||||
this.$emit('podcast-deleted')
|
||||
})
|
||||
},
|
||||
url(item) {
|
||||
if (this.settingsStore.show_cover_artwork_in_album_lists) {
|
||||
return item.item.artwork_url
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
:is-item="item.isItem"
|
||||
:image="url(item)"
|
||||
:image="image(item)"
|
||||
:index="item.index"
|
||||
:lines="[
|
||||
item.name,
|
||||
@ -36,6 +36,12 @@ export default {
|
||||
return { selectedItem: {}, showDetailsModal: false }
|
||||
},
|
||||
methods: {
|
||||
image(item) {
|
||||
if (this.settingsStore.show_cover_artwork_in_album_lists) {
|
||||
return { url: item.images?.[0]?.url ?? '', caption: item.name }
|
||||
}
|
||||
return null
|
||||
},
|
||||
open(item) {
|
||||
this.$router.push({
|
||||
name: 'music-spotify-album',
|
||||
@ -45,12 +51,6 @@ export default {
|
||||
openDetails(item) {
|
||||
this.selectedItem = item
|
||||
this.showDetailsModal = true
|
||||
},
|
||||
url(item) {
|
||||
if (this.settingsStore.show_cover_artwork_in_album_lists) {
|
||||
return item.images?.[0]?.url ?? ''
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,12 @@
|
||||
@click="open"
|
||||
>
|
||||
<mdicon v-if="icon" class="media-left icon" :name="icon" />
|
||||
<control-image v-if="image" :url="image" class="media-left is-small" />
|
||||
<control-image
|
||||
v-if="image"
|
||||
:url="image.url"
|
||||
:caption="image.caption"
|
||||
class="media-left is-small"
|
||||
/>
|
||||
<div class="media-content">
|
||||
<div
|
||||
v-for="(line, position) in lines"
|
||||
@ -51,7 +56,7 @@ export default {
|
||||
components: { ControlImage },
|
||||
props: {
|
||||
icon: { default: null, type: String },
|
||||
image: { default: null, type: String },
|
||||
image: { default: null, type: Object },
|
||||
index: { default: null, type: [String, Number] },
|
||||
isItem: { default: true, type: Boolean },
|
||||
lines: { default: null, type: Array },
|
||||
|
@ -2,8 +2,7 @@
|
||||
<control-image
|
||||
v-if="item.image"
|
||||
:url="item.image"
|
||||
:artist="item.artist"
|
||||
:album="item.name"
|
||||
:caption="item.name"
|
||||
class="is-normal mb-5"
|
||||
/>
|
||||
<slot v-if="$slots.buttons" name="buttons" />
|
||||
|
@ -7,8 +7,7 @@
|
||||
<template #image>
|
||||
<control-image
|
||||
:url="album.artwork_url"
|
||||
:artist="album.artist"
|
||||
:album="album.name"
|
||||
:caption="album.name"
|
||||
class="is-clickable is-medium"
|
||||
@click="openDetails"
|
||||
/>
|
||||
|
@ -7,8 +7,7 @@
|
||||
<template #image>
|
||||
<control-image
|
||||
:url="album.images?.[0]?.url ?? ''"
|
||||
:artist="album.artists[0].name"
|
||||
:album="album.name"
|
||||
:caption="album.name"
|
||||
class="is-clickable is-medium"
|
||||
@click="openDetails"
|
||||
/>
|
||||
|
@ -7,8 +7,7 @@
|
||||
<template #image>
|
||||
<control-image
|
||||
:url="album.artwork_url"
|
||||
:artist="album.artist"
|
||||
:album="album.name"
|
||||
:caption="album.name"
|
||||
class="is-clickable is-medium"
|
||||
@click="openDetails"
|
||||
/>
|
||||
|
@ -5,8 +5,7 @@
|
||||
<div v-if="track.id" class="mx-auto" style="max-width: 32rem">
|
||||
<control-image
|
||||
:url="track.artwork_url"
|
||||
:artist="track.artist"
|
||||
:album="track.album"
|
||||
:caption="track.album"
|
||||
class="is-clickable is-big"
|
||||
:class="{ 'is-masked': lyricsStore.active }"
|
||||
@click="openDetails(track)"
|
||||
|
@ -7,8 +7,7 @@
|
||||
<template #image>
|
||||
<control-image
|
||||
:url="album.artwork_url"
|
||||
:artist="album.artist"
|
||||
:album="album.name"
|
||||
:caption="album.name"
|
||||
class="is-clickable is-medium"
|
||||
@click="openDetails"
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user