2016-02-29 14:08:40 +08:00
|
|
|
import React from 'react';
|
2016-09-28 13:43:32 +08:00
|
|
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
2016-05-15 21:14:27 +08:00
|
|
|
import { Select, Modal } from 'antd';
|
2016-05-27 11:48:08 +08:00
|
|
|
import { version as antdVersion } from 'antd/package.json';
|
|
|
|
import { docVersions } from '../../';
|
2016-08-23 21:00:35 +08:00
|
|
|
|
2016-03-17 15:46:07 +08:00
|
|
|
const Option = Select.Option;
|
2016-02-29 14:08:40 +08:00
|
|
|
|
2016-05-17 12:04:44 +08:00
|
|
|
function isLocalStorageNameSupported() {
|
|
|
|
const testKey = 'test';
|
|
|
|
const storage = window.localStorage;
|
|
|
|
try {
|
|
|
|
storage.setItem(testKey, '1');
|
|
|
|
storage.removeItem(testKey);
|
|
|
|
return true;
|
|
|
|
} catch (error) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-23 23:02:01 +08:00
|
|
|
docVersions[antdVersion] = antdVersion;
|
|
|
|
|
2016-09-28 13:43:32 +08:00
|
|
|
class Footer extends React.Component {
|
2016-05-15 21:14:27 +08:00
|
|
|
componentDidMount() {
|
2016-05-17 12:04:44 +08:00
|
|
|
// for some iOS
|
|
|
|
// http://stackoverflow.com/a/14555361
|
|
|
|
if (!isLocalStorageNameSupported()) {
|
|
|
|
return;
|
|
|
|
}
|
2016-05-15 21:14:27 +08:00
|
|
|
// 大版本发布后全局弹窗提示
|
|
|
|
// 1. 点击『知道了』之后不再提示
|
|
|
|
// 2. 超过截止日期后不再提示
|
2016-11-21 14:39:15 +08:00
|
|
|
if (
|
|
|
|
localStorage.getItem('antd@2.0.0-notification-sent') !== 'true' &&
|
|
|
|
Date.now() < new Date('2016/10/14').getTime()
|
|
|
|
) {
|
2016-09-28 13:43:32 +08:00
|
|
|
this.infoNewVersion();
|
2016-05-15 21:14:27 +08:00
|
|
|
}
|
|
|
|
}
|
2016-03-17 15:46:07 +08:00
|
|
|
|
2016-09-28 13:43:32 +08:00
|
|
|
infoNewVersion() {
|
|
|
|
const messages = this.props.intl.messages;
|
|
|
|
Modal.info({
|
|
|
|
title: messages['app.publish.title'],
|
|
|
|
content: (
|
|
|
|
<div>
|
|
|
|
<img src="https://os.alipayobjects.com/rmsportal/nyqBompsynAQCpJ.svg" alt="Ant Design" />
|
|
|
|
<p>
|
|
|
|
{messages['app.publish.greeting']}
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="/changelog">antd@2.0.0</a>
|
|
|
|
{messages['app.publish.intro']}
|
|
|
|
{messages['app.publish.old-version-guide']}
|
|
|
|
<a target="_blank" rel="noopener noreferrer" href="http://1x.ant.design">1x.ant.design</a>
|
|
|
|
{messages['app.publish.old-version-tips']}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
),
|
|
|
|
okText: 'OK',
|
|
|
|
onOk: () => localStorage.setItem('antd@2.0.0-notification-sent', 'true'),
|
|
|
|
className: 'new-version-info-modal',
|
|
|
|
width: 470,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-05-15 21:14:27 +08:00
|
|
|
handleVersionChange = (url) => {
|
2016-10-10 21:04:20 +08:00
|
|
|
window.location.href = window.location.href.replace(window.location.origin, url);
|
2016-03-17 15:46:07 +08:00
|
|
|
}
|
|
|
|
|
2016-02-29 14:08:40 +08:00
|
|
|
render() {
|
2016-11-21 14:39:15 +08:00
|
|
|
const options = Object.keys(docVersions)
|
|
|
|
.map(version => <Option value={docVersions[version]} key={version}>{version}</Option>);
|
2016-03-01 14:19:50 +08:00
|
|
|
return (
|
|
|
|
<footer id="footer">
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<h2>GitHub</h2>
|
2016-05-12 17:44:36 +08:00
|
|
|
<div>
|
2016-09-01 11:53:55 +08:00
|
|
|
<a target="_blank " href="https://github.com/ant-design/ant-design">
|
|
|
|
<FormattedMessage id="app.footer.repo" />
|
|
|
|
</a>
|
2016-05-12 17:44:36 +08:00
|
|
|
</div>
|
|
|
|
<div>
|
2016-09-28 13:43:32 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva">dva</a> - <FormattedMessage id="app.footer.dva" />
|
2016-05-12 17:44:36 +08:00
|
|
|
</div>
|
|
|
|
<div>
|
2016-09-28 13:43:32 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva-cli">dva-cli</a> -
|
|
|
|
<FormattedMessage id="app.footer.scaffold" />
|
2016-05-12 17:44:36 +08:00
|
|
|
</div>
|
2016-08-16 19:20:03 +08:00
|
|
|
<div>
|
2016-09-28 13:43:32 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="http://ant-tool.github.io">ant-tool</a> - <FormattedMessage id="app.footer.dev-tools" />
|
2016-08-16 19:20:03 +08:00
|
|
|
</div>
|
2016-03-01 14:19:50 +08:00
|
|
|
</li>
|
|
|
|
<li>
|
2016-09-01 11:53:55 +08:00
|
|
|
<h2><FormattedMessage id="app.footer.links" /></h2>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="http://mobile.ant.design">Ant Design Mobile</a>
|
|
|
|
<span> - </span>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.mobile" />
|
|
|
|
</div>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="https://g2.alipay.com/">G2</a>
|
|
|
|
<span> - </span>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.data-vis" />
|
|
|
|
</div>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="https://antv.alipay.com/">AntV</a>
|
|
|
|
<span> - </span>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.data-vis-spec" />
|
|
|
|
</div>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="http://motion.ant.design">Ant Motion</a>
|
|
|
|
<span> - </span>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.motion" />
|
|
|
|
</div>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="http://library.ant.design/">AntD Library</a>
|
|
|
|
<span> - </span>
|
2016-09-28 13:43:32 +08:00
|
|
|
<FormattedMessage id="app.footer.antd-library" />
|
|
|
|
</div>
|
2016-10-07 14:33:08 +08:00
|
|
|
<div>
|
|
|
|
<a href="http://ux.ant.design">Ant UX</a>
|
|
|
|
<span> - </span>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.material" />
|
|
|
|
</div>
|
2016-03-01 14:19:50 +08:00
|
|
|
</li>
|
|
|
|
<li>
|
2016-09-01 11:53:55 +08:00
|
|
|
<h2><FormattedMessage id="app.footer.community" /></h2>
|
2016-08-16 19:20:03 +08:00
|
|
|
<div>
|
2016-11-24 00:30:56 +08:00
|
|
|
<a rel="noopener noreferrer" href="/changelog">
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.change-log" />
|
2016-08-16 19:20:03 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
2016-05-12 17:44:36 +08:00
|
|
|
<div>
|
2016-08-23 21:00:35 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues">
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.feedback" />
|
2016-05-12 17:44:36 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2016-08-23 21:00:35 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="https://gitter.im/ant-design/ant-design">
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.discuss" />
|
2016-05-12 17:44:36 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div>
|
2016-08-23 21:00:35 +08:00
|
|
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues/new">
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.bug-report" />
|
2016-05-12 17:44:36 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
2016-03-01 14:19:50 +08:00
|
|
|
</li>
|
|
|
|
<li>
|
2016-09-01 11:53:55 +08:00
|
|
|
<div>©2016 <FormattedMessage id="app.footer.author" /></div>
|
2016-05-27 15:43:34 +08:00
|
|
|
<div>Powered by <a href="https://github.com/benjycui/bisheng">BiSheng</a></div>
|
2016-05-12 17:44:36 +08:00
|
|
|
<div style={{ marginTop: 10 }}>
|
2016-09-01 11:53:55 +08:00
|
|
|
<FormattedMessage id="app.footer.version" />
|
2016-03-23 23:02:01 +08:00
|
|
|
<Select
|
|
|
|
size="small"
|
|
|
|
dropdownMatchSelectWidth={false}
|
|
|
|
defaultValue={antdVersion}
|
2016-06-06 13:54:10 +08:00
|
|
|
onChange={this.handleVersionChange}
|
|
|
|
>
|
2016-03-23 23:02:01 +08:00
|
|
|
{options}
|
2016-03-01 14:19:50 +08:00
|
|
|
</Select>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</footer>
|
|
|
|
);
|
2016-02-29 14:08:40 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-28 13:43:32 +08:00
|
|
|
|
|
|
|
export default injectIntl(Footer);
|