Skip to content

Commit

Permalink
update url
Browse files Browse the repository at this point in the history
  • Loading branch information
jljsj33 committed Apr 19, 2019
1 parent f2c8dc7 commit 24f3979
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions site/edit/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'app.header.publish-cloud.success': 'Publish Succeeded',
'app.header.publish-cloud.successRemarks': 'Your website has been publish succeeded, URL:',
'app.header.publish-cloud.error': 'Publish Error!!!',
'app.header.publish-cloud.currentURL': 'If the publication is successful, visit the URL: ',
'app.header.edit-data': 'Edit data',
'app.header.edit-data.header': 'Current edit data',
'app.header.edit-data.remarks': 'Paste the downloaded JSON here, please don\'t change the data. Please refresh if the data is wrong.',
Expand Down
28 changes: 21 additions & 7 deletions site/edit/template/components/PublishModal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Icon, Button, Form, Modal, Input, Tooltip, message, notification } from 'antd';
import { FormattedMessage } from 'react-intl';
import ticker from 'rc-tween-one/lib/ticker';
Expand Down Expand Up @@ -50,11 +51,15 @@ class PublishModal extends React.Component {
<p key="0"><FormattedMessage id="app.header.publish-cloud.build" /></p>,
<p key="1">
<FormattedMessage id="app.header.publish-cloud.state" />
{' BUILDING'}
{' FORMAT'}
</p>,
],
};

static contextTypes = {
intl: PropTypes.object.isRequired,
};

componentDidMount() {
// 监听有没有在发布
const { templateData } = this.props;
Expand Down Expand Up @@ -102,7 +107,9 @@ class PublishModal extends React.Component {

onMonitorPublishState = (id) => {
const { explain } = this.state;
const { templateData } = this.props;
ticker.clear(this.getPublishState);
const currentUrl = `${templateData.uid}.antdlanding.now.sh`;
this.getPublishState = ticker.interval(() => {
fetch(`${nowURL}api/deploy/${id}`, {
method: 'GET',
Expand All @@ -116,12 +123,12 @@ class PublishModal extends React.Component {
switch (item.readyState) {
case 'READY':
notification.open({
message: <FormattedMessage id="app.header.publish-cloud.success" />,
message: this.context.intl.formatMessage({ id: 'app.header.publish-cloud.success' }),
description: (
<p>
<FormattedMessage id="app.header.publish-cloud.successRemarks" />
<a href={`https://${url}`} target="_blank">
{url}
{this.context.intl.formatMessage({ id: 'app.header.publish-cloud.successRemarks' })}
<a href={`https://${currentUrl}`} target="_blank">
{currentUrl}
</a>
</p>
),
Expand All @@ -130,7 +137,7 @@ class PublishModal extends React.Component {
this.publishEnd();
break;
case 'ERROR':
message.error(<FormattedMessage id="app.header.publish-cloud.error" />);
message.error(this.context.intl.formatMessage({ id: 'pp.header.publish-cloud.error' }));
this.publishEnd();
break;
default:
Expand Down Expand Up @@ -198,6 +205,7 @@ class PublishModal extends React.Component {
const { isLoad, explain } = this.state;
const locale = isZhCN(location.pathname) ? 'zh-CN' : 'en-US';
const page = templateData.data.page || {};
const url = `${templateData.uid}.antdlanding.now.sh`;
return (
<Modal
{...props}
Expand Down Expand Up @@ -238,7 +246,6 @@ class PublishModal extends React.Component {
<h3 style={{ marginTop: 16 }}>
<FormattedMessage id="app.header.publish-cloud.meta" />
</h3>
<p />
<Form onSubmit={this.onClick} className="modal-form">
<Item label="Title">
{getFieldDecorator('title', {
Expand Down Expand Up @@ -268,8 +275,15 @@ class PublishModal extends React.Component {
<Button disabled={isLoad} type="primary" icon={isLoad ? 'loading' : 'cloud-upload'} htmlType="submit">
<FormattedMessage id="app.header.publish-cloud.button" />
</Button>

</Item>
</Form>
<p style={{ lineHeight: 2, fontSize: 14, marginTop: 8 }}>
<FormattedMessage id="app.header.publish-cloud.currentURL" />
<a href={`https://${url}`} target="_blank">
{url}
</a>
</p>
</>
)}
</Modal>
Expand Down
1 change: 1 addition & 0 deletions site/edit/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'app.header.publish-cloud.success': '发布成功',
'app.header.publish-cloud.successRemarks': '你的网站已发布成功,URL地址:',
'app.header.publish-cloud.error': '发布失败!!!',
'app.header.publish-cloud.currentURL': '如果发布成功,请访问 URL: ',
'app.header.edit-data': '编辑数据',
'app.header.edit-data.header': '当前编辑数据',
'app.header.edit-data.remarks': '将下载的 JSON 粘贴到此处,请不要随便改更数据。如果数据出错请刷新。',
Expand Down

0 comments on commit 24f3979

Please sign in to comment.