1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-16 16:21:48 +00:00
seahub/frontend/src/components/dialog/about-dialog.js

48 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-02-11 08:18:35 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalBody } from 'reactstrap';
import { gettext, lang, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, seafileVersion, extraAboutDialogLinks } from '../../utils/constants';
2019-02-11 08:18:35 +00:00
const propTypes = {
onCloseAboutDialog: PropTypes.func.isRequired,
};
class AboutDialog extends React.Component {
toggle = () => {
this.props.onCloseAboutDialog();
}
renderExternalAboutLinks = () => {
if (extraAboutDialogLinks && (typeof extraAboutDialogLinks) === 'object') {
let keys = Object.keys(extraAboutDialogLinks);
return keys.map((key, index) => {
return <a key={index} className="d-block" href={extraAboutDialogLinks[key]}>{key}</a>;
});
}
return null;
}
2019-02-11 08:18:35 +00:00
render() {
let href = lang === lang == 'zh-cn' ? 'http://seafile.com/about/' : 'http://seafile.com/en/about/';
return (
<Modal isOpen={true} toggle={this.toggle}>
<ModalBody>
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<div className="about-content">
<p><img src={mediaUrl + logoPath} height={logoHeight} width={logoWidth} title={siteTitle} alt="logo" /></p>
<p>{gettext('Server Version: ')}{seafileVersion}<br />© 2019 {gettext('Seafile')}</p>
<p>{this.renderExternalAboutLinks()}</p>
2019-02-11 08:18:35 +00:00
<p><a href={href} target="_blank">{gettext('About Us')}</a></p>
</div>
</ModalBody>
</Modal>
);
}
}
AboutDialog.propTypes = propTypes;
export default AboutDialog;