import React, { type FC } from 'react'; import ButtonGroup from '@mui/material/ButtonGroup'; import classNames from 'classnames'; import { appRouter } from 'components/router/appRouter'; import escapeHTML from 'escape-html'; import PlayArrowIconButton from '../../common/PlayArrowIconButton'; import MoreVertIconButton from '../../common/MoreVertIconButton'; import type { ItemDto } from 'types/itemDto'; import type { CardOptions } from 'types/cardOptions'; const sholudShowOverlayPlayButton = ( overlayPlayButton: boolean | undefined, item: ItemDto ) => { return ( overlayPlayButton && !item.IsPlaceHolder && (item.LocationType !== 'Virtual' || !item.MediaType || item.Type === 'Program') && item.Type !== 'Person' ); }; interface CardOverlayButtonsProps { item: ItemDto; cardOptions: CardOptions; } const CardOverlayButtons: FC = ({ item, cardOptions }) => { let overlayPlayButton = cardOptions.overlayPlayButton; if ( overlayPlayButton == null && !cardOptions.overlayMoreButton && !cardOptions.overlayInfoButton && !cardOptions.cardLayout ) { overlayPlayButton = item.MediaType === 'Video'; } const url = appRouter.getRouteUrl(item, { parentId: cardOptions.parentId }); const btnCssClass = classNames( 'paper-icon-button-light', 'cardOverlayButton', 'itemAction' ); const centerPlayButtonClass = classNames( btnCssClass, 'cardOverlayButton-centered' ); return ( {cardOptions.centerPlayButton && ( )} {sholudShowOverlayPlayButton(overlayPlayButton, item) && ( )} {cardOptions.overlayMoreButton && ( )} ); }; export default CardOverlayButtons;