import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Modal from 'react-bootstrap-modal'; import detect from 'browser-detect'; import './AboutModal.styl'; import { withTranslation } from '../../utils/LanguageProvider'; import 'react-bootstrap-modal/lib/css/rbm-patch.css'; // TODO: Is this the only component importing these? import './../../design/styles/common/modal.styl'; class AboutModal extends Component { constructor(props) { super(props); } // TODO: Make this component more generic to allow things other than W/L and hotkeys... static propTypes = { isOpen: PropTypes.bool.isRequired, onCancel: PropTypes.func, }; itemsPreset() { const { t } = this.props; const browser = detect(); const capitalize = s => s.substr(0, 1).toUpperCase() + s.substr(1).toLowerCase(); return [ { name: t('Repository URL'), value: 'https://github.com/OHIF/Viewers/', link: 'https://github.com/OHIF/Viewers/', }, { name: t('Latest Master Commits'), value: 'https://github.com/OHIF/Viewers/commits/master', link: 'https://github.com/OHIF/Viewers/commits/master', }, { name: 'Version Number', value: process.env.VERSION_NUMBER, }, { name: t('Build Number'), value: process.env.BUILD_NUM, }, { name: t('Browser'), value: `${capitalize(browser.name)} ${browser.version}`, }, { name: t('OS'), value: browser.os, }, ]; } static defaultProps = { isOpen: false, }; renderTableRow(item) { return ( {item.name} {item.link ? ( {item.value} ) : ( item.value )} ); } render() { const { t } = this.props; return ( {t('OHIF Viewer - About')}
{t('Visit the forum')} {` `} {t('Report an issue')} {` `} {t('More details')}

{t('Version Information')}

{this.itemsPreset().map(item => this.renderTableRow(item))}
{t('Name')} {t('Value')}
); } } const connectedComponent = withTranslation('AboutModal')(AboutModal); export { connectedComponent as AboutModal }; export default connectedComponent;