feat: review facts

This commit is contained in:
higorgoulart 2025-11-08 13:59:10 -03:00
parent ff08e377fc
commit 987201edd3
2 changed files with 17 additions and 13 deletions

View file

@ -99,7 +99,7 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
const renderLogoFallback = React.useCallback(() => (
<div className={styles['logo-placeholder']}>{name}</div>
), [name]);
const libAndWatchedGroup = React.useMemo(() => [
const metaItemActions = React.useMemo(() => [
{
icon: inLibrary ? 'remove-from-library' : 'add-to-library',
label: inLibrary ? t('REMOVE_FROM_LIB') : t('ADD_TO_LIB'),
@ -223,7 +223,7 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
}
{
typeof toggleInLibrary === 'function' && typeof toggleWatched === 'function'
? <IconsGroup items={libAndWatchedGroup} className={styles['group-container']} />
? <IconsGroup items={metaItemActions} className={styles['group-container']} />
: null
}
{
@ -239,9 +239,13 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
null
}
{
!compact && ratingInfo !== null
? <Ratings ratingInfo={ratingInfo} className={styles['group-container']} />
: null
!compact && ratingInfo !== null ?
<Ratings
ratingInfo={ratingInfo}
className={styles['ratings']}
/>
:
null
}
{
linksGroups.has(CONSTANTS.SHARE_LINK_CATEGORY) && !compact ?

View file

@ -74,17 +74,17 @@ const Discover = ({ urlParams, queryParams }) => {
}
});
}, [selectedMetaItem]);
const toggleWatched = React.useCallback((item) => {
if (item === null) {
const toggleWatched = React.useCallback(() => {
if (selectedMetaItem === null) {
return;
}
if (!item.inLibrary) {
if (!selectedMetaItem.inLibrary) {
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'AddToLibrary',
args: item
args: selectedMetaItem
}
});
}
@ -94,12 +94,12 @@ const Discover = ({ urlParams, queryParams }) => {
args: {
action: 'LibraryItemMarkAsWatched',
args: {
id: item.id,
is_watched: !item.watched
id: selectedMetaItem.id,
is_watched: !selectedMetaItem.watched
}
}
});
}, []);
}, [selectedMetaItem]);
const metaItemsOnFocusCapture = React.useCallback((event) => {
if (event.target.dataset.index !== null && !isNaN(event.target.dataset.index)) {
setSelectedMetaItemIndex(parseInt(event.target.dataset.index, 10));
@ -220,7 +220,7 @@ const Discover = ({ urlParams, queryParams }) => {
inLibrary={selectedMetaItem.inLibrary}
toggleInLibrary={selectedMetaItem.inLibrary ? removeFromLibrary : addToLibrary}
watched={selectedMetaItem.watched}
toggleWatched={() => toggleWatched(selectedMetaItem)}
toggleWatched={toggleWatched}
metaId={selectedMetaItem.id}
like={selectedMetaItem.like}
/>