Lazy bookshelf finalized

This commit is contained in:
advplyr 2021-12-01 19:07:03 -06:00
parent 5c92aef048
commit 1ef9a689bc
53 changed files with 914 additions and 795 deletions

View file

@ -5,7 +5,7 @@
<path fill="currentColor" d="M9 3V18H12V3H9M12 5L16 18L19 17L15 4L12 5M5 5V18H8V5H5M3 19V21H21V19H3Z" />
</svg>
<div class="px-2">
<p class="text-4xl md:text-5xl font-bold">{{ audiobooks.length }}</p>
<p class="text-4xl md:text-5xl font-bold">{{ totalBooks }}</p>
<p class="font-book text-xs md:text-sm text-white text-opacity-80">Books in Library</p>
</div>
</div>
@ -35,7 +35,7 @@
<path fill="currentColor" d="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z" />
</svg>
<div class="px-1">
<p class="text-4xl md:text-5xl font-bold">{{ uniqueAuthors.length }}</p>
<p class="text-4xl md:text-5xl font-bold">{{ totalAuthors }}</p>
<p class="font-book text-xs md:text-sm text-white text-opacity-80">Authors</p>
</div>
</div>
@ -56,20 +56,24 @@ export default {
listeningStats: {
type: Object,
default: () => {}
},
libraryStats: {
type: Object,
default: () => {}
}
},
data() {
return {}
},
computed: {
audiobooks() {
return this.$store.state.audiobooks.audiobooks
},
user() {
return this.$store.state.user.user
},
uniqueAuthors() {
return this.$store.getters['audiobooks/getUniqueAuthors']
totalBooks() {
return this.libraryStats ? this.libraryStats.totalBooks : 0
},
totalAuthors() {
return this.libraryStats ? this.libraryStats.totalAuthors : 0
},
userAudiobooks() {
return Object.values(this.user.audiobooks || {})
@ -78,11 +82,7 @@ export default {
return this.userAudiobooks.filter((ab) => !!ab.isRead)
},
totalAudiobookDuration() {
var _total = 0
this.audiobooks.forEach((ab) => {
_total += ab.duration
})
return _total
return this.libraryStats ? this.libraryStats.totalDuration : 0
},
totalAudiobookHours() {
var totalHours = Math.round(this.totalAudiobookDuration / (60 * 60))