mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
refactor(MetaPreview): remove use of metaId for Rate action
This commit is contained in:
parent
48851a62cb
commit
a5ffa2677d
3 changed files with 4 additions and 8 deletions
|
|
@ -236,7 +236,6 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
|
|||
{
|
||||
!compact ?
|
||||
<Ratings
|
||||
metaId={metaId}
|
||||
like={like}
|
||||
className={styles['ratings']}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ type Props = {
|
|||
className?: string;
|
||||
};
|
||||
|
||||
const Ratings = ({ metaId, like, className }: Props) => {
|
||||
const { onLiked, onLoved, liked, loved } = useRating(metaId, like);
|
||||
const Ratings = ({ like, className }: Props) => {
|
||||
const { onLiked, onLoved, liked, loved } = useRating(like);
|
||||
const disabled = useMemo(() => like?.type !== 'Ready', [like]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ type Like = {
|
|||
type: 'Ready' | 'Loading' | 'Error';
|
||||
};
|
||||
|
||||
const useRating = (metaId?: string, like?: Like) => {
|
||||
const useRating = (like?: Like) => {
|
||||
const { core } = useServices();
|
||||
|
||||
const setRating = useCallback((status: 'liked' | 'loved' | null) => {
|
||||
|
|
@ -16,10 +16,7 @@ const useRating = (metaId?: string, like?: Like) => {
|
|||
action: 'MetaDetails',
|
||||
args: {
|
||||
action: 'Rate',
|
||||
args: {
|
||||
id: metaId,
|
||||
status,
|
||||
},
|
||||
args: status,
|
||||
},
|
||||
});
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Reference in a new issue