mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-05 04:19:55 +00:00
refactor(MetaPreview): discover fix
This commit is contained in:
parent
ad680ca2a5
commit
beb873e34e
2 changed files with 31 additions and 25 deletions
|
|
@ -27,7 +27,7 @@ const ALLOWED_LINK_REDIRECTS = [
|
|||
|
||||
const MetaPreview = React.forwardRef(({ className, compact, name, logo, background, runtime, releaseInfo, released, description, deepLinks, links, trailerStreams, inLibrary, toggleInLibrary, metaDetails }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
const { onLiked, onLoved, like } = useRating(metaDetails);
|
||||
const { onLiked, onLoved } = useRating(metaDetails);
|
||||
const [shareModalOpen, openShareModal, closeShareModal] = useBinaryState(false);
|
||||
const linksGroups = React.useMemo(() => {
|
||||
return Array.isArray(links) ?
|
||||
|
|
@ -222,30 +222,6 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
|
|||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
!compact ?
|
||||
<ActionButton
|
||||
className={styles['action-button']}
|
||||
icon={'volume-medium'}
|
||||
tabIndex={compact ? -1 : 0}
|
||||
onClick={onLiked}
|
||||
tooltip={compact}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
!compact ?
|
||||
<ActionButton
|
||||
className={styles['action-button']}
|
||||
icon={'volume-high'}
|
||||
tabIndex={compact ? -1 : 0}
|
||||
onClick={onLoved}
|
||||
tooltip={compact}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
typeof showHref === 'string' && compact ?
|
||||
<ActionButton
|
||||
|
|
@ -284,6 +260,30 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
|
|||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
!compact ?
|
||||
<ActionButton
|
||||
className={styles['action-button']}
|
||||
icon={'volume-medium'}
|
||||
tabIndex={compact ? -1 : 0}
|
||||
onClick={onLiked}
|
||||
tooltip={compact}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
{
|
||||
!compact ?
|
||||
<ActionButton
|
||||
className={styles['action-button']}
|
||||
icon={'volume-high'}
|
||||
tabIndex={compact ? -1 : 0}
|
||||
onClick={onLoved}
|
||||
tooltip={compact}
|
||||
/>
|
||||
:
|
||||
null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,12 @@ import { useMemo, useCallback } from 'react';
|
|||
import { useServices } from 'stremio/services';
|
||||
|
||||
const useRating = (metaDetails: MetaDetails) => {
|
||||
if (!metaDetails) {
|
||||
return {
|
||||
onLiked: () => {},
|
||||
onLoved: () => {},
|
||||
};
|
||||
}
|
||||
const { core } = useServices();
|
||||
|
||||
const like = useMemo(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue