refactor(MetaPreview): remove use of metaId for Rate action

This commit is contained in:
Tim 2025-06-10 18:09:11 +02:00
parent 48851a62cb
commit a5ffa2677d
3 changed files with 4 additions and 8 deletions

View file

@ -236,7 +236,6 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
{
!compact ?
<Ratings
metaId={metaId}
like={like}
className={styles['ratings']}
/>

View file

@ -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 (

View file

@ -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,
},
});
}, []);