diff --git a/src/components/DiscItem/DiscItem.js b/src/components/DiscItem/DiscItem.js
index cc1cf5315..d09e35380 100644
--- a/src/components/DiscItem/DiscItem.js
+++ b/src/components/DiscItem/DiscItem.js
@@ -6,7 +6,7 @@ const classnames = require('classnames');
const MetaItem = require('stremio/components/MetaItem');
const { t } = require('i18next');
-const DiscItem = ({ id, watched, selected, toggleWatched, select, ...props }) => {
+const DiscItem = ({ id, watched, selected, toggleWatched, ...props }) => {
const options = React.useMemo(() => {
return [
diff --git a/src/components/MetaPreview/Ratings/Ratings.less b/src/components/IconsGroup/IconsGroup.less
similarity index 92%
rename from src/components/MetaPreview/Ratings/Ratings.less
rename to src/components/IconsGroup/IconsGroup.less
index afe7b3637..8e09c9f93 100644
--- a/src/components/MetaPreview/Ratings/Ratings.less
+++ b/src/components/IconsGroup/IconsGroup.less
@@ -8,7 +8,7 @@
@width-mobile: 3rem;
-.ratings-container {
+.group-container {
display: flex;
flex-direction: row;
align-items: center;
@@ -17,6 +17,8 @@
border-radius: 2rem;
height: @height;
width: fit-content;
+ margin-bottom: 1rem;
+ margin-right: 1rem;
.icon-container {
display: flex;
@@ -45,7 +47,7 @@
}
@media @phone-landscape {
- .ratings-container {
+ .group-container {
height: @height-mobile;
.icon-container {
diff --git a/src/components/IconsGroup/IconsGroup.tsx b/src/components/IconsGroup/IconsGroup.tsx
new file mode 100644
index 000000000..a667592de
--- /dev/null
+++ b/src/components/IconsGroup/IconsGroup.tsx
@@ -0,0 +1,36 @@
+// Copyright (C) 2017-2023 Smart code 203358507
+
+import classNames from 'classnames';
+import React from 'react';
+import Icon from '@stremio/stremio-icons/react';
+import styles from './IconsGroup.less';
+
+type GroupItem = {
+ icon: string;
+ filled?: string;
+ disabled?: boolean;
+ className?: string;
+ onClick?: () => void;
+};
+
+type Props = {
+ items: GroupItem[];
+ className?: string;
+};
+
+const IconsGroup = ({ items, className }: Props) => {
+ return (
+
{
@@ -209,30 +220,9 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
null
}
{
- typeof toggleInLibrary === 'function' ?
-
- :
- null
- }
- {
- typeof toggleWatched === 'function' ?
-
- :
- null
+ typeof toggleInLibrary === 'function' && typeof toggleWatched === 'function'
+ ?
+ : null
}
{
typeof showHref === 'string' && compact ?
@@ -247,13 +237,9 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
null
}
{
- !compact && ratingInfo !== null ?
-
- :
- null
+ !compact && ratingInfo !== null
+ ?
+ : null
}
{
linksGroups.has(CONSTANTS.SHARE_LINK_CATEGORY) && !compact ?
diff --git a/src/components/MetaPreview/Ratings/Ratings.tsx b/src/components/MetaPreview/Ratings/Ratings.tsx
index 6bef0cc6d..49ed77ba1 100644
--- a/src/components/MetaPreview/Ratings/Ratings.tsx
+++ b/src/components/MetaPreview/Ratings/Ratings.tsx
@@ -2,9 +2,7 @@
import React, { useMemo } from 'react';
import useRating from './useRating';
-import styles from './Ratings.less';
-import Icon from '@stremio/stremio-icons/react';
-import classNames from 'classnames';
+import { IconsGroup } from 'stremio/components/IconsGroup';
type Props = {
metaId?: string;
@@ -15,17 +13,20 @@ type Props = {
const Ratings = ({ ratingInfo, className }: Props) => {
const { onLiked, onLoved, liked, loved } = useRating(ratingInfo);
const disabled = useMemo(() => ratingInfo?.type !== 'Ready', [ratingInfo]);
+ const items = useMemo(() => [
+ {
+ icon: liked ? 'thumbs-up' : 'thumbs-up-outline',
+ disabled,
+ onClick: onLiked,
+ },
+ {
+ icon: loved ? 'heart' : 'heart-outline',
+ disabled,
+ onClick: onLoved,
+ },
+ ], [liked, loved, disabled, onLiked, onLoved]);
- return (
-
- );
+ return
;
};
export default Ratings;
diff --git a/src/components/MetaPreview/styles.less b/src/components/MetaPreview/styles.less
index 3fea95a5f..9347552a0 100644
--- a/src/components/MetaPreview/styles.less
+++ b/src/components/MetaPreview/styles.less
@@ -208,11 +208,6 @@
}
}
}
-
- .ratings {
- margin-bottom: 1rem;
- margin-right: 1rem;
- }
}
.share-prompt {