mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-26 19:21:39 +00:00
Apply suggestions from code review
Thanks for all the tweaks @advplyr! Co-authored-by: advplyr <67830747+advplyr@users.noreply.github.com>
This commit is contained in:
parent
f64c74519b
commit
adba22cbd6
3 changed files with 3 additions and 34 deletions
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
<p class="font-book pt-1.5" style="font-size: 0.9rem">Social</p>
|
||||
|
||||
<div v-show="paramId === 'collections'" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
|
||||
<div v-show="isSocialPage" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
|
||||
</nuxt-link>
|
||||
|
||||
<nuxt-link v-if="numIssues" :to="`/library/${currentLibraryId}/bookshelf?filter=issues`" class="w-full h-20 flex flex-col items-center justify-center text-white text-opacity-80 border-b border-primary border-opacity-70 hover:bg-opacity-40 cursor-pointer relative" :class="showingIssues ? 'bg-error bg-opacity-40' : ' bg-error bg-opacity-20'">
|
||||
|
|
|
|||
|
|
@ -51,11 +51,8 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
coverAspectRatio() {
|
||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
||||
},
|
||||
bookCoverAspectRatio() {
|
||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
||||
},
|
||||
bookCoverWidth() {
|
||||
return 70
|
||||
|
|
@ -64,25 +61,6 @@ export default {
|
|||
if (!this.listeningStats) return []
|
||||
return this.listeningStats.sort(function(a, b) {return b.latest.lastUpdate - a.latest.lastUpdate})
|
||||
},
|
||||
userMediaProgress() {
|
||||
return this.user.mediaProgress || []
|
||||
},
|
||||
userItemsFinished() {
|
||||
if (!this.listeningStats) return []
|
||||
return this.listeningStats.itemsRead
|
||||
},
|
||||
mostRecentListeningSessions() {
|
||||
if (!this.listeningStats) return []
|
||||
return this.listeningStats.recentSessions || []
|
||||
},
|
||||
totalMinutesListening() {
|
||||
if (!this.listeningStats) return 0
|
||||
return Math.round(this.listeningStats.totalTime / 60)
|
||||
},
|
||||
totalDaysListened() {
|
||||
if (!this.listeningStats) return 0
|
||||
return Object.values(this.listeningStats.days).length
|
||||
},
|
||||
usersOnline() {
|
||||
var usermap = {}
|
||||
this.$store.state.users.users.forEach((u) => (usermap[u.id] = { online: true, session: u.session }))
|
||||
|
|
@ -109,14 +87,6 @@ export default {
|
|||
}
|
||||
this.listeningStats = listeningStats
|
||||
},
|
||||
async getLibraryItem(user) {
|
||||
user.libraryItem = await this.$axios
|
||||
.$get(`/api/items/${id}`)
|
||||
.catch((error) => {
|
||||
console.error('Failed', error)
|
||||
return false
|
||||
})
|
||||
},
|
||||
changeSharingSetting() {
|
||||
this.$store.dispatch('user/updateUserSettings', { shareListeningActivity: !this.isSharingActivity })
|
||||
this.init()
|
||||
|
|
|
|||
|
|
@ -260,10 +260,9 @@ class MiscController {
|
|||
}
|
||||
// GET: api/social
|
||||
async getSocialStats(req, res) {
|
||||
if (this.db.serverSettings.sharedListeningStats == false) {
|
||||
if (!this.db.serverSettings.sharedListeningStats) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
Logger.error(this.db.serverSettings.sharedListeningStats)
|
||||
var filteredUsers = this.db.users.filter(c => c.settings.shareListeningActivity == true)
|
||||
var userData = []
|
||||
for (let i = 0; i < filteredUsers.length; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue