Skip to content

Commit d58f359

Browse files
author
veedrin
committed
iframe 下线公告
1 parent 688c92c commit d58f359

File tree

5 files changed

+129
-111
lines changed

5 files changed

+129
-111
lines changed

app/containers/GlobalPrompt.jsx

Lines changed: 81 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,92 @@
1-
import React, { Component } from 'react'
1+
import React, { Component } from 'react';
22

3-
import Prompt from 'components/Prompt/Prompt'
4-
//import { browserDetect } from 'utils'
5-
import config from 'config'
6-
import i18n from 'utils/createI18n'
3+
import Prompt from 'components/Prompt/Prompt';
4+
//import { browserDetect } from 'utils';
5+
import config from 'config';
6+
import i18n from 'utils/createI18n';
77

88
class GlobalPrompt extends Component {
9-
constructor (props) {
10-
super(props)
11-
this.state = {
12-
prompts: []
9+
state = {
10+
prompts: [],
1311
}
14-
}
1512

16-
componentDidMount () {
17-
let id = 0
18-
//const browserVersion = browserDetect()
19-
const promptMessage = []
20-
const { prompts } = this.state
21-
22-
// promptMessage.push({
23-
// content: (
24-
// <p>
25-
// Cloud Studio 将于 9 月 6 日 19 点进行系统维护,预计时间为 30 分钟,敬请谅解。
26-
// </p>
27-
// ),
28-
// id: `global-prompt-${id++}`,
29-
// type: 'update'
30-
// })
31-
32-
// if (!localStorage.getItem('visited')) {
33-
// promptMessage.push({
34-
// content: (
35-
// <p>
36-
// WebIDE 现已全面升级为 Cloud Studio, 使用旧版 IDE 请点击{' '}
37-
// <a href='https://ide.coding.net' target='_blank' rel='noopener noreferrer'>
38-
// WebIDE
39-
// </a>{' '}
40-
// </p>
41-
// ),
42-
// id: `global-prompt-${id++}`,
43-
// type: 'update'
44-
// })
45-
// }
46-
47-
// if (browserVersion !== 'Chrome' && browserVersion !== 'Safari') {
48-
// promptMessage.push({
49-
// content: (
50-
// <p>
51-
// 检测到您的浏览器为 {browserVersion},为保障用户体验,推荐使用 Chrome 或 Safari
52-
// 浏览器访问。
53-
// </p>
54-
// ),
55-
// id: `global-prompt-${id++}`,
56-
// type: 'compatibility'
57-
// })
58-
// }
59-
if (config.willExpire) {
60-
promptMessage.push({
61-
content: (
62-
// <p>
63-
// {i18n`global.machineOutofDateSoon`}
64-
// <span className='important'>{i18n`global.outofDateSoon`}</span>
65-
// {i18n`global.machineOutofDateSoon2`}
66-
// <a href='https://console.cloud.tencent.com/lighthosting' target='_blank' rel='noopener noreferrer'>{i18n`global.renewals`}</a>
67-
// {i18n`global.and`}
68-
// <a href='https://dnspod.cloud.tencent.com/act/coding' target='_blank' rel='noopener noreferrer' >{i18n`global.actHint`}</a>
69-
// </p>
70-
<p>
71-
{i18n`global.offlineInfo`}
72-
<a href='https://studio.dev.tencent.com' rel='noopener noreferrer'>{i18n`global.gotoIDE`}</a>
73-
</p>
74-
),
75-
id: `global-prompt-${id++}`,
76-
type: 'compatibility'
77-
})
13+
render() {
14+
const { prompts } = this.state;
15+
return <Prompt prompts={prompts} handleClose={this.handleClosePrompt} />
7816
}
7917

80-
this.setState({
81-
prompts: [...prompts, ...promptMessage]
82-
})
83-
}
84-
85-
handleClosePrompt = (id, type) => {
86-
const { prompts } = this.state
87-
this.setState({ prompts: prompts.filter(prompt => prompt.id !== id) })
88-
if (type === 'update') {
89-
localStorage.setItem('visited', true)
18+
componentDidMount () {
19+
let id = 0;
20+
//const browserVersion = browserDetect();
21+
const promptMessage = [];
22+
const { prompts } = this.state;
23+
promptMessage.push({
24+
content: (
25+
<p>
26+
为提供更好的体验,我们将于 12 月 20 日 24:00 至 12 月 21 日 03:00 之间进行系统维护,请避免在此时间段内使用 Cloud Studio 服务。维护完毕之后,如遇见账户或使用问题,请尝试刷新和重新登录,或前往 <a href="https://feedback.coding.net/" target="blank" rel="noopener">feedback</a> 进行反馈。
27+
</p>
28+
),
29+
id: `global-prompt-${id++}`,
30+
type: 'update',
31+
});
32+
// if (!localStorage.getItem('visited')) {
33+
// promptMessage.push({
34+
// content: (
35+
// <p>
36+
// WebIDE 现已全面升级为 Cloud Studio, 使用旧版 IDE 请点击{' '}
37+
// <a href='https://ide.coding.net' target='_blank' rel='noopener noreferrer'>
38+
// WebIDE
39+
// </a>{' '}
40+
// </p>
41+
// ),
42+
// id: `global-prompt-${id++}`,
43+
// type: 'update'
44+
// })
45+
// }
46+
// if (browserVersion !== 'Chrome' && browserVersion !== 'Safari') {
47+
// promptMessage.push({
48+
// content: (
49+
// <p>
50+
// 检测到您的浏览器为 {browserVersion},为保障用户体验,推荐使用 Chrome 或 Safari
51+
// 浏览器访问。
52+
// </p>
53+
// ),
54+
// id: `global-prompt-${id++}`,
55+
// type: 'compatibility'
56+
// })
57+
// }
58+
if (config.willExpire) {
59+
promptMessage.push({
60+
content: (
61+
// <p>
62+
// {i18n`global.machineOutofDateSoon`}
63+
// <span className='important'>{i18n`global.outofDateSoon`}</span>
64+
// {i18n`global.machineOutofDateSoon2`}
65+
// <a href='https://console.cloud.tencent.com/lighthosting' target='_blank' rel='noopener noreferrer'>{i18n`global.renewals`}</a>
66+
// {i18n`global.and`}
67+
// <a href='https://dnspod.cloud.tencent.com/act/coding' target='_blank' rel='noopener noreferrer' >{i18n`global.actHint`}</a>
68+
// </p>
69+
<p>
70+
{i18n`global.offlineInfo`}
71+
<a href='https://studio.dev.tencent.com' rel='noopener noreferrer'>{i18n`global.gotoIDE`}</a>
72+
</p>
73+
),
74+
id: `global-prompt-${id++}`,
75+
type: 'compatibility',
76+
});
77+
}
78+
this.setState({
79+
prompts: [...prompts, ...promptMessage]
80+
});
9081
}
91-
}
9282

93-
render () {
94-
const { prompts } = this.state
95-
return <Prompt prompts={prompts} handleClose={this.handleClosePrompt} />
96-
}
83+
handleClosePrompt = (id, type) => {
84+
const { prompts } = this.state;
85+
this.setState({ prompts: prompts.filter(prompt => prompt.id !== id) });
86+
if (type === 'update') {
87+
localStorage.setItem('visited', true);
88+
}
89+
}
9790
}
9891

99-
export default GlobalPrompt
92+
export default GlobalPrompt;

app/dashboard/view/home/Home.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import './home.css';
66
import cloudstudio from '../../static/cloudstudio.svg';
77

88
import Mask from './mask';
9+
import Bulletin from './bulletin';
910
import Stripe from '../../share/stripe';
1011
import Bell from '../bell';
1112
import Profile from './profile';
@@ -25,20 +26,22 @@ class Home extends Component {
2526
this.state = {
2627
loaded: false,
2728
isMaskOn: false,
29+
isBulletinOn: true,
2830
isBellOn: false,
2931
isProfileOn: false,
3032
};
3133
this.fetchUserProfile();
3234
}
3335

3436
render() {
35-
const { loaded, isMaskOn, isBellOn, isProfileOn } = this.state;
37+
const { loaded, isMaskOn, isBulletinOn, isBellOn, isProfileOn } = this.state;
3638
const { isMbarOn, wsCount, hideMbar } = this.props;
3739
if (isMaskOn) {
3840
return <Mask />;
3941
}
4042
return (
4143
<div id="dash-container" onClick={this.turnOffPanel}>
44+
{isBulletinOn && <Bulletin close={this.closeBulletin} />}
4245
<div className="dash-mbar">
4346
<Link className="logo" to="/dashboard/workspace" onClick={hideMbar}><img src={cloudstudio} alt="" /></Link>
4447
<Stripe />
@@ -177,6 +180,10 @@ class Home extends Component {
177180
});
178181
}
179182
}
183+
184+
closeBulletin = () => {
185+
this.setState({ isBulletinOn: false });
186+
}
180187
}
181188

182189
const mapState = (state) => {

app/dashboard/view/home/bulletin/Bulletin.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ import React from 'react';
22

33
import './bulletin.css';
44

5-
import i18n from '../../../utils/i18n';
6-
75
const Bulletin = ({ close }) => {
86
return (
97
<div className="dash-bulletin">
10-
<span>{i18n('global.eventStreamBulletin1')}</span>
11-
<a href="https://mp.weixin.qq.com/s/IaOWxG0XLvn2znvvP1dmwA" target="_blank">{i18n('global.eventStreamBulletin2')}</a>
12-
<span>{i18n('global.eventStreamBulletin3')}</span>
13-
<i className="fa fa-remove" onClick={close}></i>
8+
<div className="top">
9+
<div className="title">
10+
<i className="fa fa-bullhorn"></i>
11+
<span>维护通知</span>
12+
</div>
13+
<span className="close" onClick={close}></span>
14+
</div>
15+
<div className="content">
16+
为提供更好的体验,我们将于 12 月 20 日 24:00 至 12 月 21 日 03:00 之间进行系统维护,请避免在此时间段内使用 Cloud Studio 服务。维护完毕之后,如遇见账户或使用问题,请尝试刷新和重新登录,或前往 <a href="https://feedback.coding.net/" target="blank" rel="noopener">feedback</a> 进行反馈。
17+
</div>
1418
</div>
1519
);
1620
}
Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
.dash-bulletin {
2-
width: 990px;
3-
padding: 15px 35px;
4-
border-radius: 4px;
2+
width: 440px;
3+
padding: 15px;
4+
border-radius: 5px;
55
color: #ccc;
66
background-color: #444;
77
box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.3);
8-
transform: translate(-50%, 0);
9-
position: absolute;
10-
top: 10px;
11-
left: 50%;
8+
position: fixed;
9+
bottom: 25px;
10+
right: 25px;
1211
z-index: 300;
1312
}
14-
.dash-bulletin i {
13+
.dash-bulletin .top {
14+
display: flex;
15+
justify-content: space-between;
16+
align-items: center;
17+
color: #fff;
18+
padding-bottom: 6px;
19+
}
20+
.dash-bulletin .top .title i {
21+
margin-right: 5px;
22+
font-size: 16px;
23+
}
24+
.dash-bulletin .close {
25+
font-size: 16px;
26+
color: #999;
27+
transform: rotate(45deg);
1528
cursor: pointer;
16-
transform: translate(0, -50%);
17-
position: absolute;
18-
top: 50%;
19-
right: 15px;
29+
transition: color .2s ease;
30+
}
31+
.dash-bulletin .close:hover {
32+
color: #ccc;
2033
}
21-
.dash-bulletin i:hover {
22-
color: #aaa;
34+
.dash-bulletin .content {
35+
font-size: 13px;
2336
}

app/styles/core-ui/Initialize.styl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@
291291
top: 0px;
292292
color: #333;
293293
font-size: 14px;
294-
line-height: 20px;
295-
padding: 5px 5px 5px 15px;
294+
line-height: 24px;
295+
padding: 5px 8px 5px 15px;
296296
border-radius: 2px;
297297
background-color: #e6e6e6;
298298
box-shadow: 0 0 20px 0 rgba(3,65,157,0.10);
@@ -309,6 +309,7 @@
309309

310310
p {
311311
margin: 0px;
312+
text-align: left;
312313
}
313314

314315
.important {

0 commit comments

Comments
 (0)