Skip to content

Commit 3ab423d

Browse files
committed
- StylusでコンパイルされたCSSをCachingする(ロディングが短くなる)
- Planet name changeのときにエラーハンドリング追加 + Bug fix - TeamのMemberを編集する場合、自分を編集することはできない - FinderにMarkdownのリンクがちゃんと外部に飛ぶように - Tray iconがちゃんと表示 - ArticleDetailのCodeアイコンがちゃんと表示されない
1 parent de6d6b6 commit 3ab423d

15 files changed

Lines changed: 72 additions & 33 deletions

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "browser/ace"]
22
path = browser/ace
33
url = https://github.com/ajaxorg/ace-builds.git
4+
[submodule "browser/electron-stylus"]
5+
path = browser/electron-stylus
6+
url = https://github.com/Rokt33r/electron-stylus.git

browser/electron-stylus

Submodule electron-stylus added at 6d86de7

browser/finder/Components/FinderDetail.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ var React = require('react/addons')
22

33
var CodeViewer = require('../../main/Components/CodeViewer')
44

5-
var Markdown = require('../../main/Mixins/Markdown')
5+
var MarkdownPreview = require('../../main/Components/MarkdownPreview')
66

77
module.exports = React.createClass({
8-
mixins: [Markdown],
98
propTypes: {
109
currentArticle: React.PropTypes.object
1110
},
@@ -28,7 +27,7 @@ module.exports = React.createClass({
2827
<div className='FinderDetail'>
2928
<div className='header'><i className='fa fa-file-text-o fa-fw'/> {article.title}</div>
3029
<div className='content'>
31-
<div className='marked' dangerouslySetInnerHTML={{__html: ' ' + this.markdown(article.content)}}></div>
30+
<MarkdownPreview className='marked' content={article.content}/>
3231
</div>
3332
</div>
3433
)

browser/finder/index.electron.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<div id="content"></div>
6565
<script src="../ace/src-min/ace.js"></script>
6666
<script>
67-
require('electron-stylus')(__dirname + '/../styles/finder/index.styl')
67+
require('../electron-stylus')(__dirname + '/../styles/finder/index.styl', 'finderCss')
6868
require('node-jsx').install({ harmony: true, extension: '.jsx' })
6969
require('./index.jsx')
7070
</script>

browser/main/Components/PlanetArticleDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = React.createClass({
6666
<div className='detailHeader'>
6767
<div className='itemLeft'>
6868
<ProfileImage className='profileImage' size='25' email={article.User.email}/>
69-
<i className='fa fa-file-text-o fa-fw'></i>
69+
<i className='fa fa-code fa-fw'></i>
7070
</div>
7171

7272
<div className='itemRight'>

browser/main/Components/PlanetCreateModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ module.exports = React.createClass({
7272
this.setState({error: {message: 'The entered name already in use'}})
7373
break
7474
default:
75-
this.setState({error: {message: 'Undefined error please try again'}})
75+
this.setState({error: {message: 'Unexpected error occured! please try again'}})
7676
}
7777
}.bind(this))
7878
})

browser/main/Components/PlanetSettingModal.jsx

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,44 @@ module.exports = React.createClass({
5858
handleSavePlanetProfile: function (e) {
5959
var planet = this.props.planet
6060

61-
this.setState({profileSubmitStatus: 'sending'}, function () {
61+
this.setState({profileFormStatus: 'sending', profileFormError: null}, function () {
6262
Hq.updatePlanet(planet.userName, planet.name, this.state.planet)
6363
.then(function (res) {
6464
var planet = res.body
65-
66-
this.setState({profileSubmitStatus: 'done'})
65+
console.log(planet)
66+
this.setState({profileFormStatus: 'done'})
6767

6868
PlanetStore.Actions.update(planet)
69+
this.props.close()
6970
}.bind(this))
7071
.catch(function (err) {
71-
this.setState({profileSubmitStatus: 'error'})
7272
console.error(err)
73+
var newState = {
74+
profileFormStatus: 'error'
75+
}
76+
77+
if (err.status == null) {
78+
newState.profileFormError = {message: 'Check your network connection'}
79+
return this.setState(newState)
80+
}
81+
82+
switch (err.status) {
83+
case 403:
84+
newState.profileFormError = err.response.body
85+
this.setState(newState)
86+
break
87+
case 422:
88+
newState.profileFormError = {message: 'Planet name should be Alphanumeric with _, -'}
89+
this.setState(newState)
90+
break
91+
case 409:
92+
newState.profileFormError = {message: 'The entered name already in use'}
93+
this.setState(newState)
94+
break
95+
default:
96+
newState.profileFormError = {message: 'Undefined error please try again'}
97+
this.setState(newState)
98+
}
7399
}.bind(this))
74100
})
75101
},
@@ -130,11 +156,11 @@ module.exports = React.createClass({
130156
<div className='formConfirm'>
131157
<button onClick={this.handleSavePlanetProfile} className='saveButton btn-primary'>Save</button>
132158

133-
<div className={'alertInfo' + (this.state.profileSubmitStatus === 'sending' ? '' : ' hide')}>on Sending...</div>
159+
<div className={'alertInfo' + (this.state.profileFormStatus === 'sending' ? '' : ' hide')}>on Sending...</div>
134160

135-
<div className={'alertError' + (this.state.profileSubmitStatus === 'error' ? '' : ' hide')}>Connection failed.. Try again.</div>
161+
<div className={'alertError' + (this.state.profileFormStatus === 'error' ? '' : ' hide')}>{this.state.profileFormError != null ? this.state.profileFormError.message : 'Unexpected error occured! please try again'}</div>
136162

137-
<div className={'alertSuccess' + (this.state.profileSubmitStatus === 'done' ? '' : ' hide')}>Successfully done!!</div>
163+
<div className={'alertSuccess' + (this.state.profileFormStatus === 'done' ? '' : ' hide')}>Successfully done!!</div>
138164
</div>
139165
</div>
140166
)

browser/main/Stores/PlanetStore.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ module.exports = Reflux.createStore({
5353
localStorage.setItem('currentUser', JSON.stringify(currentUser))
5454
UserStore.Actions.update(currentUser)
5555

56+
planet.Codes.forEach(function (code) {
57+
code.type = 'code'
58+
})
59+
60+
planet.Notes.forEach(function (note) {
61+
note.type = 'note'
62+
})
63+
5664
// Update the planet
5765
localStorage.setItem('planet-' + planet.id, JSON.stringify(planet))
5866

browser/main/index.electron.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@
2929
}
3030
#loadingCover img{
3131
display: block;
32-
margin: 0 auto;
32+
margin: 75px auto 5px;
33+
width: 160px;
34+
height: 160px;
3335
}
3436
#loadingCover .message{
35-
font-size: 45px;
37+
font-size: 30px;
3638
text-align: center;
3739
line-height: 1.6;
38-
font-weight: 200;
39-
color: #404849;
40+
font-weight: 100;
41+
color: #888;
4042
}
4143
</style>
4244
</head>
@@ -88,7 +90,7 @@
8890

8991
var version = require('remote').getGlobal('version')
9092
document.title = 'Boost ' + ((version == null || version.length === 0) ? 'DEV version' : 'v' + version)
91-
require('electron-stylus')(__dirname + '/../styles/main/index.styl')
93+
require('../electron-stylus')(__dirname + '/../styles/main/index.styl', 'mainCss')
9294
require('node-jsx').install({ harmony: true, extension: '.jsx' })
9395
require('./index.jsx')
9496
</script>

browser/styles/shared/modal.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
float right
9898
padding 12px 10px
9999
border-radius 5px
100-
width 200px
100+
width 320px
101101
font-size 1em
102102
overflow-x hidden
103103
white-space nowrap
@@ -139,7 +139,7 @@
139139
float right
140140
padding 12px 10px
141141
border-radius 5px
142-
width 200px
142+
width 320px
143143
font-size 1em
144144
overflow-x hidden
145145
white-space nowrap

0 commit comments

Comments
 (0)