mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-11 08:10:40 +00:00
detail: add tooltips for rating like and rating love
This commit is contained in:
parent
fc7dc45a54
commit
e136770d7e
1 changed files with 4 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (C) 2017-2025 Smart code 203358507
|
// Copyright (C) 2017-2025 Smart code 203358507
|
||||||
|
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import useRating from './useRating';
|
import useRating from './useRating';
|
||||||
import { ActionsGroup } from 'stremio/components';
|
import { ActionsGroup } from 'stremio/components';
|
||||||
|
|
||||||
|
|
@ -11,17 +12,20 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const Ratings = ({ ratingInfo, className }: Props) => {
|
const Ratings = ({ ratingInfo, className }: Props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
const { onLiked, onLoved, liked, loved } = useRating(ratingInfo);
|
const { onLiked, onLoved, liked, loved } = useRating(ratingInfo);
|
||||||
const disabled = useMemo(() => ratingInfo?.type !== 'Ready', [ratingInfo]);
|
const disabled = useMemo(() => ratingInfo?.type !== 'Ready', [ratingInfo]);
|
||||||
|
|
||||||
const items = useMemo(() => [
|
const items = useMemo(() => [
|
||||||
{
|
{
|
||||||
icon: liked ? 'thumbs-up' : 'thumbs-up-outline',
|
icon: liked ? 'thumbs-up' : 'thumbs-up-outline',
|
||||||
|
label: liked ? t('RATING_UNLIKE') : t('RATING_LIKE'),
|
||||||
disabled,
|
disabled,
|
||||||
onClick: onLiked,
|
onClick: onLiked,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: loved ? 'heart' : 'heart-outline',
|
icon: loved ? 'heart' : 'heart-outline',
|
||||||
|
label: loved ? t('RATING_UNLOVE') : t('RATING_LOVE'),
|
||||||
disabled,
|
disabled,
|
||||||
onClick: onLoved,
|
onClick: onLoved,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue