import { Card } from '@automattic/components'; import { localize } from 'i18n-calypso'; import PropTypes from 'prop-types'; import { Component } from 'react'; import PopoverMenuItem from 'calypso/components/popover-menu/item'; import SplitButton from 'calypso/components/split-button'; import { decodeEntities } from 'calypso/lib/formatting'; import ActivityIcon from '../activity-log-item/activity-icon'; class ActivityLogTaskUpdate extends Component { static propTypes = { toUpdate: PropTypes.object.isRequired, disable: PropTypes.bool, name: PropTypes.string, slug: PropTypes.string, version: PropTypes.string, type: PropTypes.string, linked: PropTypes.bool, goToPage: PropTypes.func, enqueueTheme: PropTypes.func, dismissTheme: PropTypes.func, // Plugin specific enqueue: PropTypes.func, dismiss: PropTypes.func, // Localize translate: PropTypes.func.isRequired, }; handleEnqueue = () => this.props.enqueue( this.props.toUpdate ); handleDismiss = () => this.props.dismiss( this.props.toUpdate ); handleNameClick = () => this.props.goToPage( this.props.slug, this.props.type ); render() { const { translate, name, version, type, disable, linked, slug, siteSlug } = this.props; let updateType = translate( 'Plugin update available' ); if ( 'theme' === type ) { updateType = translate( 'Theme update available' ); } else if ( 'core' === type ) { updateType = translate( 'Core update available' ); } const url = 'plugin' === type ? `/plugins/${ slug }/${ siteSlug }` : `/theme/${ slug }/${ siteSlug }`; return (
{ linked ? ( { decodeEntities( name ) } ) : ( // Add button classes so unlinked names look the same. { decodeEntities( name ) } ) } • { version }
{ updateType }
{ translate( 'Dismiss' ) }
); } } export default localize( ActivityLogTaskUpdate );