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