refactor(ratings): remove dead code

This commit is contained in:
Timothy Z. 2025-06-05 17:54:57 +03:00
parent 38d5290d91
commit dc9cfb12f3
4 changed files with 8 additions and 45 deletions

View file

@ -58,31 +58,6 @@
color: var(--primary-background-color);
}
}
&.rating-button {
&.active {
background-color: var(--primary-accent-color);
.icon {
color: var(--primary-foreground-color);
}
.label-container {
display: flex;
.label {
color: var(--primary-foreground-color);
opacity: 1;
}
}
}
&:not(.active) {
.label-container {
display: none;
}
}
}
}
@media @phone-landscape {

View file

@ -268,10 +268,9 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
})}
icon={'thumbs-up'}
label={t('LIKE')}
showLabel={liked}
tooltip={true}
tabIndex={compact ? -1 : 0}
onClick={onLiked}
tooltip={compact}
/>
:
null
@ -284,10 +283,9 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
})}
icon={'heart'}
label={t('LOVE')}
showLabel={loved}
tooltip={true}
tabIndex={compact ? -1 : 0}
onClick={onLoved}
tooltip={compact}
/>
:
null

View file

@ -210,20 +210,10 @@
&.rating-button {
&.active {
width: auto;
padding: 0 2rem;
border-radius: 4rem;
background-color: var(--primary-accent-color);
&:hover, &:focus {
background-color: var(--primary-accent-color);
opacity: 0.8;
}
}
&:not(.active) {
&:hover, &:focus {
background-color: var(--overlay-color);
.icon {
color: var(--primary-foreground-color);
}
}
}

View file

@ -20,7 +20,7 @@ const useRating = (metaId?: string, like?: Like) => {
},
},
});
}, [core]);
}, []);
const liked = useMemo(() => {
return like?.content === 'liked';
@ -32,11 +32,11 @@ const useRating = (metaId?: string, like?: Like) => {
const onLiked = useCallback(() => {
setRating(like?.content === 'liked' ? null : 'liked');
}, [like, setRating]);
}, [like]);
const onLoved = useCallback(() => {
setRating(like?.content === 'loved' ? null : 'loved');
}, [like, setRating]);
}, [like]);
return {
onLiked,