diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 133eaa5c6..d54287ca0 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -899,6 +899,8 @@
"preferLocalLyrics": "prefer local lyrics",
"showLyricsInSidebar_description": "a panel will be added to the attached play queue that displays the lyrics",
"showLyricsInSidebar": "show lyrics in player sidebar",
+ "showRatings_description": "controls if the star ratings feature shows up in the interface",
+ "showRatings": "show star ratings",
"showVisualizerInSidebar_description": "a panel will be added to the player sidebar that displays the visualizer",
"showVisualizerInSidebar": "show visualizer in player sidebar",
"combinedLyricsAndVisualizer_description": "combine lyrics and visualizer into the same panel",
diff --git a/src/i18n/locales/pt-BR.json b/src/i18n/locales/pt-BR.json
index c28b00d9e..37b14f6c8 100644
--- a/src/i18n/locales/pt-BR.json
+++ b/src/i18n/locales/pt-BR.json
@@ -383,6 +383,8 @@
"savePlayQueue_description": "Salvar a fila de reprodução ao fechar a aplicação e restaurá-la ao abrir a aplicação",
"scrobble": "Scrobblar",
"scrobble_description": "Scrobblar reproduções para o seu servidor de mídia",
+ "showRatings": "exibir avaliações por estrelas",
+ "showRatings_description": "exibir ou ocultar as avaliações por estrelas",
"showSkipButton": "Exibir botões de pular",
"showSkipButton_description": "Exibir ou ocultar os botões de pular na barra do reprodutor",
"showSkipButtons": "Exibir botões de pular",
diff --git a/src/renderer/components/item-card/item-card-controls.tsx b/src/renderer/components/item-card/item-card-controls.tsx
index c5722241b..512e6bd1d 100644
--- a/src/renderer/components/item-card/item-card-controls.tsx
+++ b/src/renderer/components/item-card/item-card-controls.tsx
@@ -32,6 +32,7 @@ interface ItemCardControlsProps {
internalState?: ItemListStateActions;
item: Album | AlbumArtist | Artist | Playlist | Song | undefined;
itemType: LibraryItem;
+ showRating: boolean;
type?: 'compact' | 'default' | 'poster';
}
@@ -180,6 +181,7 @@ export const ItemCardControls = ({
internalState,
item,
itemType,
+ showRating,
type = 'default',
}: ItemCardControlsProps) => {
const playNowHandler = useMemo(
@@ -267,6 +269,7 @@ export const ItemCardControls = ({
)}
{controls?.onRating &&
+ showRating &&
(item?._serverType === ServerType.NAVIDROME ||
item?._serverType === ServerType.SUBSONIC) && (
{
+ const { showRatings } = useGeneralSettings();
const imageUrl = getImageUrl(data);
const rows = providedRows || [];
@@ -84,6 +86,7 @@ export const ItemCard = ({
isRound={isRound}
itemType={itemType}
rows={rows}
+ showRating={showRatings}
withControls={withControls}
/>
);
@@ -100,6 +103,7 @@ export const ItemCard = ({
isRound={isRound}
itemType={itemType}
rows={rows}
+ showRating={showRatings}
withControls={withControls}
/>
);
@@ -117,6 +121,7 @@ export const ItemCard = ({
isRound={isRound}
itemType={itemType}
rows={rows}
+ showRating={showRatings}
withControls={withControls}
/>
);
@@ -130,6 +135,7 @@ export interface ItemCardDerivativeProps extends Omit {
imageUrl: string | undefined;
internalState?: ItemListStateActions;
rows: DataRow[];
+ showRating: boolean;
}
const CompactItemCard = ({
@@ -142,6 +148,7 @@ const CompactItemCard = ({
isRound,
itemType,
rows,
+ showRating,
withControls,
}: ItemCardDerivativeProps) => {
const [showControls, setShowControls] = useState(false);
@@ -286,7 +293,7 @@ const CompactItemCard = ({
typeof (data as { userRating: null | number }).userRating === 'number'
? (data as { userRating: null | number }).userRating
: null;
- const hasRating = userRating !== null && userRating > 0;
+ const hasRating = showRating && userRating !== null && userRating > 0;
const imageContainerClassName = clsx(styles.imageContainer, {
[styles.isRound]: isRound,
@@ -312,6 +319,7 @@ const CompactItemCard = ({
internalState={internalState}
item={data}
itemType={itemType}
+ showRating={hasRating}
type="compact"
/>
)}
@@ -407,6 +415,7 @@ const DefaultItemCard = ({
isRound,
itemType,
rows,
+ showRating,
withControls,
}: ItemCardDerivativeProps) => {
const [showControls, setShowControls] = useState(false);
@@ -508,7 +517,7 @@ const DefaultItemCard = ({
typeof (data as { userRating: null | number }).userRating === 'number'
? (data as { userRating: null | number }).userRating
: null;
- const hasRating = userRating !== null && userRating > 0;
+ const hasRating = showRating && userRating !== null && userRating > 0;
const imageContainerContent = (
<>
@@ -527,6 +536,7 @@ const DefaultItemCard = ({
enableExpansion={enableExpansion}
item={data}
itemType={itemType}
+ showRating={showRating}
type="default"
/>
)}
@@ -620,6 +630,7 @@ const PosterItemCard = ({
isRound,
itemType,
rows,
+ showRating,
withControls,
}: ItemCardDerivativeProps) => {
const [showControls, setShowControls] = useState(false);
@@ -768,7 +779,7 @@ const PosterItemCard = ({
typeof (data as { userRating: null | number }).userRating === 'number'
? (data as { userRating: null | number }).userRating
: null;
- const hasRating = userRating !== null && userRating > 0;
+ const hasRating = showRating && userRating !== null && userRating > 0;
const imageContainerContent = (
<>
@@ -788,6 +799,7 @@ const PosterItemCard = ({
internalState={internalState}
item={data}
itemType={itemType}
+ showRating={showRating}
type="poster"
/>
)}
diff --git a/src/renderer/features/albums/components/album-detail-header.tsx b/src/renderer/features/albums/components/album-detail-header.tsx
index 828d9cb5a..0365f60a6 100644
--- a/src/renderer/features/albums/components/album-detail-header.tsx
+++ b/src/renderer/features/albums/components/album-detail-header.tsx
@@ -13,7 +13,7 @@ import {
LibraryHeaderMenu,
} from '/@/renderer/features/shared/components/library-header';
import { AppRoute } from '/@/renderer/router/routes';
-import { useCurrentServer } from '/@/renderer/store';
+import { useCurrentServer, useGeneralSettings } from '/@/renderer/store';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { Group } from '/@/shared/components/group/group';
import { Stack } from '/@/shared/components/stack/stack';
@@ -24,13 +24,15 @@ import { Play } from '/@/shared/types/types';
export const AlbumDetailHeader = forwardRef((_props, ref) => {
const { albumId } = useParams() as { albumId: string };
const server = useCurrentServer();
+ const { showRatings } = useGeneralSettings();
const detailQuery = useQuery(
albumQueries.detail({ query: { id: albumId }, serverId: server?.id }),
);
const showRating =
- detailQuery?.data?._serverType === ServerType.NAVIDROME ||
- detailQuery?.data?._serverType === ServerType.SUBSONIC;
+ showRatings &&
+ (detailQuery?.data?._serverType === ServerType.NAVIDROME ||
+ detailQuery?.data?._serverType === ServerType.SUBSONIC);
const { addToQueueByFetch, setFavorite, setRating } = usePlayer();
const playButtonBehavior = usePlayButtonBehavior();
diff --git a/src/renderer/features/artists/components/album-artist-detail-header.tsx b/src/renderer/features/artists/components/album-artist-detail-header.tsx
index c0e9c384e..b8a3e8fc4 100644
--- a/src/renderer/features/artists/components/album-artist-detail-header.tsx
+++ b/src/renderer/features/artists/components/album-artist-detail-header.tsx
@@ -14,7 +14,7 @@ import {
LibraryHeaderMenu,
} from '/@/renderer/features/shared/components/library-header';
import { AppRoute } from '/@/renderer/router/routes';
-import { useCurrentServer } from '/@/renderer/store';
+import { useCurrentServer, useGeneralSettings } from '/@/renderer/store';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { formatDurationString } from '/@/renderer/utils';
import { Group } from '/@/shared/components/group/group';
@@ -30,6 +30,7 @@ export const AlbumArtistDetailHeader = forwardRef((_props, ref: Ref {
return detailQuery.data?.imageUrl || imageUrl;
}, [detailQuery.data?.imageUrl, imageUrl]);
diff --git a/src/renderer/features/context-menu/actions/set-rating-action.tsx b/src/renderer/features/context-menu/actions/set-rating-action.tsx
index 69cdb01e9..717217d22 100644
--- a/src/renderer/features/context-menu/actions/set-rating-action.tsx
+++ b/src/renderer/features/context-menu/actions/set-rating-action.tsx
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useSetRating } from '/@/renderer/features/shared/mutations/set-rating-mutation';
-import { useCurrentServer, useCurrentServerId } from '/@/renderer/store';
+import { useCurrentServer, useCurrentServerId, useGeneralSettings } from '/@/renderer/store';
import { ContextMenu } from '/@/shared/components/context-menu/context-menu';
import { Rating } from '/@/shared/components/rating/rating';
import { LibraryItem } from '/@/shared/types/domain-types';
@@ -17,6 +17,7 @@ export const SetRatingAction = ({ ids, itemType }: SetRatingActionProps) => {
const { t } = useTranslation();
const server = useCurrentServer();
const serverId = useCurrentServerId();
+ const { showRatings } = useGeneralSettings();
const setRatingMutation = useSetRating({});
@@ -35,7 +36,7 @@ export const SetRatingAction = ({ ids, itemType }: SetRatingActionProps) => {
});
};
- if (!isRatingSupported) {
+ if (!showRatings || !isRatingSupported) {
return null;
}
diff --git a/src/renderer/features/settings/components/general/application-settings.tsx b/src/renderer/features/settings/components/general/application-settings.tsx
index 6f4c3cb58..995584de3 100644
--- a/src/renderer/features/settings/components/general/application-settings.tsx
+++ b/src/renderer/features/settings/components/general/application-settings.tsx
@@ -554,6 +554,27 @@ export const ApplicationSettings = () => {
isHidden: !settings.externalLinks,
title: t('setting.musicbrainz', { postProcess: 'sentenceCase' }),
},
+ {
+ control: (
+ {
+ setSettings({
+ general: {
+ ...settings,
+ showRatings: e.currentTarget.checked,
+ },
+ });
+ }}
+ />
+ ),
+ description: t('setting.showRatings', {
+ context: 'description',
+ postProcess: 'sentenceCase',
+ }),
+ isHidden: false,
+ title: t('setting.showRatings', { postProcess: 'sentenceCase' }),
+ },
{
control: (