import {useTrans} from '@common/i18n/use-trans'; import {message} from '@common/i18n/message'; import clsx from 'clsx'; import {Title} from '@app/titles/models/title'; import {TitleLink} from '@app/titles/title-link'; import {ImageSize, useImageSrc} from '@app/images/use-image-src'; import {Link} from 'react-router-dom'; import {getWatchLink} from '@app/videos/watch-page/get-watch-link'; import {MediaPlayIcon} from '@common/icons/media/media-play'; import {IconButton} from '@common/ui/buttons/icon-button'; import {Fragment} from 'react'; import {MovieIcon} from '@common/icons/material/Movie'; interface Props { title: Title; className?: string; size?: string; lazy?: boolean; srcSize?: ImageSize; aspect?: string; showPlayButton?: boolean; link?: string; } export function TitlePoster({ title, className, size = 'w-full', srcSize, lazy = true, aspect = 'aspect-poster', showPlayButton, link, }: Props) { const {trans} = useTrans(); const src = useImageSrc(title?.poster, {size: srcSize}); if (!title.primary_video) { showPlayButton = false; } const imageClassName = clsx( 'h-full w-full rounded bg-fg-base/4 object-cover', !src ? 'flex items-center justify-center' : 'block', ); const image = src ? ( {trans(message('Poster ) : ( ); const linkChildren = ( {image} ); return (
{link ? ( {linkChildren} ) : ( {linkChildren} )} {showPlayButton ? (
) : null}
); }