import React from 'react'; import PropTypes from 'prop-types'; import { gettext } from '../../utils/constants'; const { err, trafficOverLimit, zipped, filePath, canDownload } = window.shared.pageOptions; const propTypes = { errorMsg: PropTypes.string }; class SharedFileViewTip extends React.Component { render() { let errorMsg; if (err == 'File preview unsupported') { errorMsg =

{gettext('Online view is not applicable to this file format')}

; } else { errorMsg =

{err || this.props.errorMsg}

; } let isShowDownloadBtn = canDownload && !trafficOverLimit; return (
{errorMsg} {isShowDownloadBtn && {gettext('Download')} }
); } } SharedFileViewTip.propTypes = propTypes; export default SharedFileViewTip;