11import React from 'react' ;
2+ import PropTypes from 'prop-types' ;
23import { Icon , Button , Form , Modal , Input , Tooltip , message , notification } from 'antd' ;
34import { FormattedMessage } from 'react-intl' ;
45import ticker from 'rc-tween-one/lib/ticker' ;
@@ -50,11 +51,15 @@ class PublishModal extends React.Component {
5051 < p key = "0" > < FormattedMessage id = "app.header.publish-cloud.build" /> </ p > ,
5152 < p key = "1" >
5253 < FormattedMessage id = "app.header.publish-cloud.state" />
53- { ' BUILDING ' }
54+ { ' FORMAT ' }
5455 </ p > ,
5556 ] ,
5657 } ;
5758
59+ static contextTypes = {
60+ intl : PropTypes . object . isRequired ,
61+ } ;
62+
5863 componentDidMount ( ) {
5964 // 监听有没有在发布
6065 const { templateData } = this . props ;
@@ -102,7 +107,9 @@ class PublishModal extends React.Component {
102107
103108 onMonitorPublishState = ( id ) => {
104109 const { explain } = this . state ;
110+ const { templateData } = this . props ;
105111 ticker . clear ( this . getPublishState ) ;
112+ const currentUrl = `${ templateData . uid } .antdlanding.now.sh` ;
106113 this . getPublishState = ticker . interval ( ( ) => {
107114 fetch ( `${ nowURL } api/deploy/${ id } ` , {
108115 method : 'GET' ,
@@ -116,12 +123,12 @@ class PublishModal extends React.Component {
116123 switch ( item . readyState ) {
117124 case 'READY' :
118125 notification . open ( {
119- message : < FormattedMessage id = " app.header.publish-cloud.success" /> ,
126+ message : this . context . intl . formatMessage ( { id : ' app.header.publish-cloud.success' } ) ,
120127 description : (
121128 < p >
122- < FormattedMessage id = " app.header.publish-cloud.successRemarks" />
123- < a href = { `https://${ url } ` } target = "_blank" >
124- { url }
129+ { this . context . intl . formatMessage ( { id : ' app.header.publish-cloud.successRemarks' } ) }
130+ < a href = { `https://${ currentUrl } ` } target = "_blank" >
131+ { currentUrl }
125132 </ a >
126133 </ p >
127134 ) ,
@@ -130,7 +137,7 @@ class PublishModal extends React.Component {
130137 this . publishEnd ( ) ;
131138 break ;
132139 case 'ERROR' :
133- message . error ( < FormattedMessage id = "app .header.publish-cloud.error" /> ) ;
140+ message . error ( this . context . intl . formatMessage ( { id : 'pp .header.publish-cloud.error' } ) ) ;
134141 this . publishEnd ( ) ;
135142 break ;
136143 default :
@@ -198,6 +205,7 @@ class PublishModal extends React.Component {
198205 const { isLoad, explain } = this . state ;
199206 const locale = isZhCN ( location . pathname ) ? 'zh-CN' : 'en-US' ;
200207 const page = templateData . data . page || { } ;
208+ const url = `${ templateData . uid } .antdlanding.now.sh` ;
201209 return (
202210 < Modal
203211 { ...props }
@@ -238,7 +246,6 @@ class PublishModal extends React.Component {
238246 < h3 style = { { marginTop : 16 } } >
239247 < FormattedMessage id = "app.header.publish-cloud.meta" />
240248 </ h3 >
241- < p />
242249 < Form onSubmit = { this . onClick } className = "modal-form" >
243250 < Item label = "Title" >
244251 { getFieldDecorator ( 'title' , {
@@ -268,8 +275,15 @@ class PublishModal extends React.Component {
268275 < Button disabled = { isLoad } type = "primary" icon = { isLoad ? 'loading' : 'cloud-upload' } htmlType = "submit" >
269276 < FormattedMessage id = "app.header.publish-cloud.button" />
270277 </ Button >
278+
271279 </ Item >
272280 </ Form >
281+ < p style = { { lineHeight : 2 , fontSize : 14 , marginTop : 8 } } >
282+ < FormattedMessage id = "app.header.publish-cloud.currentURL" />
283+ < a href = { `https://${ url } ` } target = "_blank" >
284+ { url }
285+ </ a >
286+ </ p >
273287 </ >
274288 ) }
275289 </ Modal >
0 commit comments