import React from 'react'; import PropTypes from 'prop-types'; import { gettext } from '../../utils/constants'; const { err, filePerm, fileType, repoID, filePath } = window.app.pageOptions; const propTypes = { errorMsg: PropTypes.string }; class FileViewTip 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 canOpenViaClient = false; if (filePerm == 'rw' && (fileType == 'Document' || fileType == 'SpreadSheet')) { canOpenViaClient = true; } return (
{errorMsg} {gettext('Download')} {canOpenViaClient && ( {gettext('Open via Client')}

{gettext('Please install the desktop client to open file via client.')}

)}
); } } FileViewTip.propTypes = propTypes; export default FileViewTip;