2020-09-16 16:59:25 +00:00
|
|
|
<template>
|
2020-11-02 11:25:08 +00:00
|
|
|
<section>
|
|
|
|
<BaseLoadingPlaceholder v-if="isLoading" />
|
|
|
|
|
|
|
|
<template v-else>
|
2022-03-01 10:16:27 +00:00
|
|
|
<ResultsError v-if="viewInfo.error" :error="viewInfo.error"></ResultsError>
|
|
|
|
<div v-else-if="viewInfo.data.length === 0">
|
|
|
|
<h1 class="text-center">{{ $t('search.noResultsAlbum') }}</h1>
|
2020-11-02 11:25:08 +00:00
|
|
|
</div>
|
|
|
|
|
2021-05-23 16:46:03 +00:00
|
|
|
<div v-else class="release-grid">
|
|
|
|
<div v-for="release in viewInfo.data.slice(0, itemsToShow)" :key="release.albumID" class="w-40 release">
|
2022-05-28 13:12:11 +00:00
|
|
|
<router-link custom v-slot="{ navigate }" class="cursor-pointer" :to="{ name: 'Album', params: { id: release.albumID } }">
|
|
|
|
<div @click="navigate" @keypress.enter="navigate" role="link">
|
|
|
|
<CoverContainer
|
|
|
|
is-rounded
|
|
|
|
:cover="release.albumCoverMedium"
|
|
|
|
:link="release.albumLink"
|
|
|
|
@click.stop="$emit('add-to-queue', $event)"
|
|
|
|
/>
|
2020-11-02 21:33:00 +00:00
|
|
|
|
2022-05-28 13:12:11 +00:00
|
|
|
<span class="primary-text">
|
|
|
|
<i
|
|
|
|
v-if="release.isAlbumExplicit"
|
|
|
|
class="material-icons title-icon"
|
|
|
|
style="font-size: 1.0625rem !important"
|
|
|
|
>
|
|
|
|
explicit
|
|
|
|
</i>
|
|
|
|
{{ release.albumTitle }}
|
|
|
|
</span>
|
|
|
|
</div>
|
2020-11-02 21:33:00 +00:00
|
|
|
</router-link>
|
|
|
|
|
2020-11-02 22:24:10 +00:00
|
|
|
<p class="secondary-text">
|
2020-11-02 11:25:08 +00:00
|
|
|
{{
|
|
|
|
$t('globals.by', { artist: release.artistName }) +
|
|
|
|
' - ' +
|
|
|
|
$tc('globals.listTabs.trackN', release.albumTracks)
|
|
|
|
}}
|
|
|
|
</p>
|
2020-11-02 21:33:00 +00:00
|
|
|
</div>
|
2020-11-02 11:25:08 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</section>
|
2020-09-16 20:22:55 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-26 19:10:40 +00:00
|
|
|
import BaseLoadingPlaceholder from '@components/globals/BaseLoadingPlaceholder.vue'
|
2020-11-02 21:33:00 +00:00
|
|
|
import CoverContainer from '@components/globals/CoverContainer.vue'
|
2022-03-01 10:16:27 +00:00
|
|
|
import ResultsError from '@components/search/ResultsError.vue'
|
2020-09-16 20:22:55 +00:00
|
|
|
|
|
|
|
export default {
|
2020-11-02 21:33:00 +00:00
|
|
|
components: {
|
|
|
|
BaseLoadingPlaceholder,
|
2022-03-01 10:16:27 +00:00
|
|
|
CoverContainer,
|
|
|
|
ResultsError
|
2020-11-02 21:33:00 +00:00
|
|
|
},
|
2020-11-02 11:25:08 +00:00
|
|
|
props: {
|
|
|
|
viewInfo: {
|
2021-05-23 16:46:03 +00:00
|
|
|
validator(value) {
|
|
|
|
const isNull = Object.is(value, null)
|
|
|
|
const isObject = Object.prototype.toString.call(value) === '[object Object]'
|
2020-11-02 11:25:08 +00:00
|
|
|
|
|
|
|
return isNull || isObject
|
|
|
|
},
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
itemsToShow: {
|
|
|
|
type: Number,
|
2021-07-17 12:28:29 +00:00
|
|
|
default: 6
|
2020-11-02 11:25:08 +00:00
|
|
|
},
|
|
|
|
wantHeaders: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isLoading() {
|
|
|
|
return !this.viewInfo || !this.viewInfo.hasLoaded
|
|
|
|
}
|
2020-09-16 20:22:55 +00:00
|
|
|
}
|
|
|
|
}
|
2020-09-23 16:00:52 +00:00
|
|
|
</script>
|