import React from 'react'; import PropTypes from 'prop-types'; import { Badge, Image, SelectableBox, } from '@edx/paragon'; import { FormattedMessage, FormattedDate, FormattedTime } from '@edx/frontend-platform/i18n'; import messages from './messages'; import { formatDuration } from '../../utils'; import LanguageNamesWidget from '../../containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/LanguageNamesWidget'; export const GalleryCard = ({ asset, thumbnailFallback, }) => { const [thumbnailError, setThumbnailError] = React.useState(false); return (
{(thumbnailError && thumbnailFallback) ? (
{ thumbnailFallback }
) : ( setThumbnailError(true))} /> )} { asset.status && asset.statusBadgeVariant && ( {asset.status} )} { asset.duration >= 0 && ( {formatDuration(asset.duration)} )}

{asset.displayName}

{ asset.transcripts && (
)}

, time: , }} />

); }; GalleryCard.defaultProps = { thumbnailFallback: undefined, }; GalleryCard.propTypes = { asset: PropTypes.shape({ contentType: PropTypes.string, displayName: PropTypes.string, externalUrl: PropTypes.string, id: PropTypes.string, dateAdded: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), locked: PropTypes.bool, portableUrl: PropTypes.string, thumbnail: PropTypes.string, url: PropTypes.string, duration: PropTypes.number, status: PropTypes.string, statusBadgeVariant: PropTypes.string, transcripts: PropTypes.arrayOf(PropTypes.string), }).isRequired, thumbnailFallback: PropTypes.element, }; export default GalleryCard;