This commit is contained in:
Eliot Berriot 2019-12-27 10:22:39 +01:00
parent 8024c4654f
commit f0b72c8204
No known key found for this signature in database
GPG Key ID: 6B501DFD73514E14
4 changed files with 42 additions and 75 deletions

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="app-card card"> <div class="app-card card">
<div :class="['ui', 'head-image', 'circular', 'image', {'default-cover': !cover.original}]" v-lazy:background-image="imageUrl"> <div
@click="$router.push({name: 'library.artists.detail', params: {id: artist.id}})"
:class="['ui', 'head-image', 'circular', 'image', {'default-cover': !cover.original}]" v-lazy:background-image="imageUrl">
<play-button :icon-only="true" :is-playable="artist.is_playable" :button-classes="['ui', 'circular', 'large', 'orange', 'icon', 'button']" :artist="artist"></play-button> <play-button :icon-only="true" :is-playable="artist.is_playable" :button-classes="['ui', 'circular', 'large', 'orange', 'icon', 'button']" :artist="artist"></play-button>
</div> </div>
<div class="content"> <div class="content">

View File

@ -1,45 +1,24 @@
<template> <template>
<div class="ui playlist card"> <div class="ui app-card card">
<div class="ui top attached icon button" :style="coversStyle"> <div
@click="$router.push({name: 'library.playlists.detail', params: {id: playlist.id }})"
:class="['ui', 'head-image', 'squares']">
<img v-lazy="url" v-for="(url, idx) in images" :key="idx" />
<play-button :icon-only="true" :is-playable="playlist.is_playable" :button-classes="['ui', 'circular', 'large', 'orange', 'icon', 'button']" :playlist="playlist"></play-button>
</div> </div>
<div class="content"> <div class="content">
<div class="header"> <strong>
<div class="right floated"> <router-link class="discrete link" :title="playlist.name" :to="{name: 'library.playlists.detail', params: {id: playlist.id }}">
<play-button {{ playlist.name }}
:is-playable="playlist.is_playable"
:icon-only="true" class="ui inline"
:button-classes="['ui', 'circular', 'large', {orange: playlist.tracks_count > 0}, 'icon', 'button', {disabled: playlist.tracks_count === 0}]"
:playlist="playlist"></play-button>
<play-button
:is-playable="playlist.is_playable"
class="basic inline icon"
:dropdown-only="true"
:dropdown-icon-classes="['ellipsis', 'vertical', 'large', {disabled: playlist.tracks_count === 0}, 'grey']"
:account="playlist.actor"
:playlist="playlist"></play-button>
</div>
<router-link :title="playlist.name" class="discrete link" :to="{name: 'library.playlists.detail', params: {id: playlist.id }}">
{{ playlist.name | truncate(30) }}
</router-link> </router-link>
</div> </strong>
<div class="meta"> <div class="description">
<duration :seconds="playlist.duration" /> <user-link :user="playlist.user" class="left floated" />
|
<i class="sound icon"></i>
<translate translate-context="Content/*/Card/List item"
translate-plural="%{ count } tracks"
:translate-n="playlist.tracks_count"
:translate-params="{count: playlist.tracks_count}">
%{ count} track
</translate>&nbsp;
</div> </div>
</div> </div>
<div class="extra content"> <div class="extra content">
<user-link :user="playlist.user" class="left floated" /> <translate translate-context="*/*/*" :translate-params="{count: playlist.tracks_count}" :translate-n="playlist.tracks_count" translate-plural="%{ count } tracks">%{ count } track</translate>
<span class="right floated"> <play-button class="right floated basic icon" :dropdown-only="true" :is-playable="playlist.is_playable" :dropdown-icon-classes="['ellipsis', 'horizontal', 'large', 'grey']" :playlist="playlist"></play-button>
<i class="clock outline icon" />
<human-date :date="playlist.creation_date" />
</span>
</div> </div>
</div> </div>
</template> </template>
@ -53,41 +32,18 @@ export default {
PlayButton PlayButton
}, },
computed: { computed: {
coversStyle () { images () {
let self = this let self = this
let urls = this.playlist.album_covers.map((url) => { let urls = this.playlist.album_covers.map((url) => {
url = self.$store.getters['instance/absoluteUrl'](url) return self.$store.getters['instance/absoluteUrl'](url)
return `url("${url}")`
}).slice(0, 4) }).slice(0, 4)
return { while (urls.length < 4) {
'background-image': urls.join(', ') urls.push(
'../../../assets/audio/default-cover.png'
)
} }
return urls
} }
} }
} }
</script> </script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
.playlist.card .header .ellipsis.vertical.large.grey {
font-size: 1.2em;
margin-right: 0;
}
</style>
<style scoped>
.card .header {
margin-bottom: 0.25em;
}
.attached.button {
background-size: 25%;
background-repeat: no-repeat;
background-origin: border-box;
background-position: 0 0, 33.33% 0, 66.67% 0, 100% 0;
/* background-position: 0 0, 50% 0, 100% 0; */
/* background-position: 0 0, 25% 0, 50% 0, 75% 0, 100% 0; */
font-size: 4em;
box-shadow: 0px 0px 0px 1px rgba(34, 36, 38, 0.15) inset !important;
padding: unset;
}
</style>

View File

@ -1,15 +1,8 @@
<template> <template>
<div <div v-if="playlists.length > 0">
v-if="playlists.length > 0" <div class="ui app-cards cards">
v-masonry
transition-duration="0"
item-selector=".card"
percent-position="true"
stagger="0">
<div class="ui cards">
<playlist-card <playlist-card
:playlist="playlist" :playlist="playlist"
v-masonry-tile
v-for="playlist in playlists" v-for="playlist in playlists"
:key="playlist.id" :key="playlist.id"
></playlist-card> ></playlist-card>

View File

@ -449,6 +449,22 @@ input + .help {
margin: 0.5em; margin: 0.5em;
} }
&.squares {
display: block !important;
position: relative;
.button {
position: absolute;
bottom: 0.5em;
right: 0.5em;
}
img {
display: inline-block;
width: 50%;
height: 50%;
margin: 0;
border-radius: 0;
}
}
} }
.extra { .extra {
border-top: 0 !important; border-top: 0 !important;