Fixed error for Ratings page and stats page & added controlls to make Rating system and Ratings page optional (admin can turn it on or off for the server)

This commit is contained in:
fannta1990 2026-02-09 10:58:17 +01:00
parent 3a8075a077
commit e4e2770fbd
10 changed files with 128 additions and 49 deletions

View file

@ -68,7 +68,7 @@
<div v-show="isNarratorsPage" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
</nuxt-link>
<nuxt-link v-if="isBookLibrary" :to="`/library/${currentLibraryId}/ratings`" class="w-full h-20 flex flex-col items-center justify-center text-white/80 border-b border-primary/70 hover:bg-primary cursor-pointer relative" :class="isRatingsPage ? 'bg-primary/80' : 'bg-bg/60'">
<nuxt-link v-if="isBookLibrary && enableReviews && showReviewsInSidebar" :to="`/library/${currentLibraryId}/ratings`" class="w-full h-20 flex flex-col items-center justify-center text-white/80 border-b border-primary/70 hover:bg-primary cursor-pointer relative" :class="isRatingsPage ? 'bg-primary/80' : 'bg-bg/60'">
<span class="material-symbols text-2xl">star</span>
<p class="pt-1 text-center leading-4" style="font-size: 0.9rem">{{ $strings.ButtonRatings }}</p>
@ -207,6 +207,12 @@ export default {
numIssues() {
return this.$store.state.libraries.issues || 0
},
enableReviews() {
return this.$store.getters['getServerSetting']('enableReviews')
},
showReviewsInSidebar() {
return this.$store.getters['getServerSetting']('showReviewsInSidebar')
},
versionData() {
return this.$store.state.versionData || {}
},

View file

@ -1,6 +1,6 @@
<template>
<modals-modal v-model="show" name="review-modal" :width="500">
<div class="px-6 py-8 w-full rounded-lg bg-bg shadow-lg border border-black-300" style="max-height: 80vh">
<div class="px-6 py-8 w-full text-sm rounded-lg bg-bg shadow-lg border border-black-300 overflow-y-auto overflow-x-hidden" style="max-height: 80vh">
<h2 class="text-xl font-semibold mb-4">{{ title }}</h2>
<div class="mb-6">
@ -84,7 +84,7 @@ export default {
reviewText: this.reviewText
}
const review = await this.$axios.$post(`/api/items/${this.libraryItem.id}/review`, payload)
this.$emit('review-updated', review)
this.$root.$emit('review-updated', review)
this.$toast.success('Review submitted')
this.show = false
} catch (error) {

View file

@ -10,7 +10,7 @@
<div class="grow" />
<ui-btn small color="bg-success" class="mr-4" @click.stop="writeReview">
<ui-btn small :color="userReview ? '' : 'bg-success'" class="mr-4" @click.stop="writeReview">
{{ userReview ? $strings.ButtonReviewEdit : $strings.ButtonReviewWrite }}
</ui-btn>