diff --git a/browser/main/ArticleDetail/index.js b/browser/main/ArticleDetail/index.js
deleted file mode 100644
index 1db13315..00000000
--- a/browser/main/ArticleDetail/index.js
+++ /dev/null
@@ -1,339 +0,0 @@
-import React, { PropTypes } from 'react'
-import ReactDOM from 'react-dom'
-import moment from 'moment'
-import _ from 'lodash'
-import TagSelect from 'browser/components/TagSelect'
-import ModeSelect from 'browser/components/ModeSelect'
-import ShareButton from './ShareButton'
-import { openModal, isModalOpen } from 'browser/main/lib/modal'
-import DeleteArticleModal from '../modals/DeleteArticleModal'
-import ArticleEditor from './ArticleEditor'
-const electron = require('electron')
-const ipc = electron.ipcRenderer
-import fetchConfig from 'browser/lib/fetchConfig'
-
-let config = fetchConfig()
-ipc.on('config-apply', function (e, newConfig) {
- config = newConfig
-})
-
-const BRAND_COLOR = '#18AF90'
-const OSX = global.process.platform === 'darwin'
-
-const tagSelectTutorialElement = (
-
-)
-
-const modeSelectTutorialElement = (
-
- Select code syntax!!
-
-
-
-
-
-
-
-)
-
-export default class ArticleDetail extends React.Component {
- constructor (props) {
- super(props)
-
- this.deleteHandler = (e) => {
- if (isModalOpen()) return true
- this.handleDeleteButtonClick()
- }
- this.uncacheHandler = (e) => {
- if (isModalOpen()) return true
- this.handleUncache()
- }
- this.titleHandler = (e) => {
- if (isModalOpen()) return true
- if (this.refs.title) {
- this.focusTitle()
- }
- }
- this.editHandler = (e) => {
- if (isModalOpen()) return true
- if (this.refs.editor) this.refs.editor.switchEditMode()
- }
- this.previewHandler = (e) => {
- if (isModalOpen()) return true
- if (this.refs.editor) this.refs.editor.switchPreviewMode()
- }
- this.configApplyHandler = (e, config) => this.handleConfigApply(e, config)
-
- this.state = {
- article: Object.assign({content: ''}, props.activeArticle),
- openShareDropdown: false,
- fontFamily: config['editor-font-family']
- }
- }
-
- componentDidMount () {
- this.refreshTimer = setInterval(() => this.forceUpdate(), 60 * 1000)
- this.shareDropdownInterceptor = (e) => {
- e.stopPropagation()
- }
-
- ipc.on('detail-delete', this.deleteHandler)
- ipc.on('detail-uncache', this.uncacheHandler)
- ipc.on('detail-title', this.titleHandler)
- ipc.on('detail-edit', this.editHandler)
- ipc.on('detail-preview', this.previewHandler)
- ipc.on('config-apply', this.configApplyHandler)
- }
-
- componentWillUnmount () {
- clearInterval(this.refreshTimer)
-
- ipc.removeListener('detail-delete', this.deleteHandler)
- ipc.removeListener('detail-uncache', this.uncacheHandler)
- ipc.removeListener('detail-title', this.titleHandler)
- ipc.removeListener('detail-edit', this.editHandler)
- ipc.removeListener('detail-preview', this.previewHandler)
- }
-
- componentDidUpdate (prevProps, prevState) {
- if (this.props.activeArticle == null || prevProps.activeArticle == null || this.props.activeArticle.key !== prevProps.activeArticle.key) {
- if (this.refs.editor) this.refs.editor.resetCursorPosition()
- }
-
- if (prevProps.activeArticle == null && this.props.activeArticle) {
-
- }
- }
-
- handleConfigApply (e, config) {
- this.setState({
- fontFamily: config['editor-font-family']
- })
- }
-
- renderEmpty () {
- return (
-
this.handleMouseMove(e)}
+ onMouseUp={(e) => this.handleMouseUp(e)}
>
-
-
-
+
+
+
+
this.handleSlideMouseDown(e)}
+ draggable='false'
+ />
+
+
)
@@ -48,4 +111,4 @@ Main.propTypes = {
repositories: PropTypes.array
}
-export default connect((x) => x)(Main)
+export default connect((x) => x)(CSSModules(Main, styles))
diff --git a/browser/main/Main.styl b/browser/main/Main.styl
new file mode 100644
index 00000000..ef6eddb3
--- /dev/null
+++ b/browser/main/Main.styl
@@ -0,0 +1,25 @@
+.root
+ absolute top left bottom right
+
+.body
+ absolute right
+ bottom $statusBar-height - 1
+ top $topBar-height - 1
+ left $sideNav-width
+
+.body--expanded
+ @extend .body
+ left $sideNav--folded-width
+
+.slider
+ absolute top bottom
+ width 5px
+ background-color $ui-backgroundColor
+ border-width 0 1px 0
+ border-style solid
+ border-color $ui-borderColor
+ cursor ew-resize
+
+.slider--active
+ @extend .slider
+ background-color $ui-button--active-backgroundColor
diff --git a/browser/main/ArticleDetail/ArticleEditor.js b/browser/main/NoteDetail/ArticleEditor.js
similarity index 100%
rename from browser/main/ArticleDetail/ArticleEditor.js
rename to browser/main/NoteDetail/ArticleEditor.js
diff --git a/browser/main/NoteDetail/NoteDetail.styl b/browser/main/NoteDetail/NoteDetail.styl
new file mode 100644
index 00000000..3a641159
--- /dev/null
+++ b/browser/main/NoteDetail/NoteDetail.styl
@@ -0,0 +1,17 @@
+.root
+ absolute top bottom right
+ border-width 1px 0
+ border-style solid
+ border-color $ui-borderColor
+
+.empty
+ height 320px
+ display flex
+ align-items center
+.empty-message
+ width 100%
+ font-size 42px
+ line-height 72px
+ text-align center
+ color $ui-inactive-text-color
+
diff --git a/browser/main/ArticleDetail/ShareButton.js b/browser/main/NoteDetail/ShareButton.js
similarity index 100%
rename from browser/main/ArticleDetail/ShareButton.js
rename to browser/main/NoteDetail/ShareButton.js
diff --git a/browser/main/NoteDetail/index.js b/browser/main/NoteDetail/index.js
new file mode 100644
index 00000000..3d9b7c56
--- /dev/null
+++ b/browser/main/NoteDetail/index.js
@@ -0,0 +1,45 @@
+import React, { PropTypes } from 'react'
+import CSSModules from 'browser/lib/CSSModules'
+import styles from './NoteDetail.styl'
+const electron = require('electron')
+
+const OSX = global.process.platform === 'darwin'
+
+class NoteDetail extends React.Component {
+ componentDidUpdate (prevProps, prevState) {
+ }
+
+ renderEmpty () {
+ return (
+
+
{OSX ? 'Command(⌘)' : 'Ctrl(^)'} + N
to create a new post
+
+ )
+ }
+
+ render () {
+ let isEmpty = true
+ let view = isEmpty
+ ? this.renderEmpty()
+ : null
+ return (
+
+ {view}
+
+ )
+ }
+}
+
+NoteDetail.propTypes = {
+ dispatch: PropTypes.func,
+ repositories: PropTypes.array,
+ style: PropTypes.shape({
+ left: PropTypes.number
+ })
+}
+
+export default CSSModules(NoteDetail, styles)
diff --git a/browser/main/NoteList/NoteList.styl b/browser/main/NoteList/NoteList.styl
new file mode 100644
index 00000000..26643c16
--- /dev/null
+++ b/browser/main/NoteList/NoteList.styl
@@ -0,0 +1,4 @@
+.root
+ absolute top left bottom
+ border-top $ui-border
+ border-bottom $ui-border
diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js
new file mode 100644
index 00000000..e7a05d33
--- /dev/null
+++ b/browser/main/NoteList/index.js
@@ -0,0 +1,150 @@
+import React, { PropTypes } from 'react'
+import CSSModules from 'browser/lib/CSSModules'
+import styles from './NoteList.styl'
+import ReactDOM from 'react-dom'
+import ModeIcon from 'browser/components/ModeIcon'
+import moment from 'moment'
+import _ from 'lodash'
+
+const electron = require('electron')
+const remote = electron.remote
+const ipc = electron.ipcRenderer
+
+class NoteList extends React.Component {
+ constructor (props) {
+ super(props)
+
+ // this.focusHandler = (e) => this.focus()
+ }
+
+ componentDidMount () {
+ // this.refreshTimer = setInterval(() => this.forceUpdate(), 60 * 1000)
+ // ipc.on('list-focus', this.focusHandler)
+ // this.focus()
+ }
+
+ componentWillUnmount () {
+ // clearInterval(this.refreshTimer)
+ // ipc.removeListener('list-focus', this.focusHandler)
+ }
+
+ componentDidUpdate () {
+ // return false
+ // var index = articles.indexOf(null)
+ // var el = ReactDOM.findDOMNode(this)
+ // var li = el.querySelectorAll('.NoteList>div')[index]
+
+ // if (li == null) {
+ // return
+ // }
+
+ // var overflowBelow = el.clientHeight + el.scrollTop < li.offsetTop + li.clientHeight
+ // if (overflowBelow) {
+ // el.scrollTop = li.offsetTop + li.clientHeight - el.clientHeight
+ // }
+ // var overflowAbove = el.scrollTop > li.offsetTop
+ // if (overflowAbove) {
+ // el.scrollTop = li.offsetTop
+ // }
+ }
+
+ focus () {
+ // ReactDOM.findDOMNode(this).focus()
+ }
+
+ // 移動ができなかったらfalseを返す:
+ selectPriorArticle () {
+ let { articles, activeArticle, dispatch } = this.props
+ let targetIndex = articles.indexOf(activeArticle) - 1
+ let targetArticle = articles[targetIndex]
+ return false
+ }
+
+ selectNextArticle () {
+ let { articles, activeArticle, dispatch } = this.props
+ let targetIndex = articles.indexOf(activeArticle) + 1
+ let targetArticle = articles[targetIndex]
+
+ if (targetArticle != null) {
+ dispatch(switchArticle(targetArticle.key))
+ return true
+ }
+ return false
+ }
+
+ handleArticleClick (article) {
+ let { dispatch } = this.props
+ return function (e) {
+ dispatch(switchArticle(article.key))
+ }
+ }
+
+ handleNoteListKeyDown (e) {
+ if (e.metaKey || e.ctrlKey) return true
+
+ if (e.keyCode === 65 && !e.shiftKey) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('top-new-post')
+ }
+
+ if (e.keyCode === 65 && e.shiftKey) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('nav-new-folder')
+ }
+
+ if (e.keyCode === 68) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('detail-delete')
+ }
+
+ if (e.keyCode === 84) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('detail-title')
+ }
+
+ if (e.keyCode === 69) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('detail-edit')
+ }
+
+ if (e.keyCode === 83) {
+ e.preventDefault()
+ remote.getCurrentWebContents().send('detail-save')
+ }
+
+ if (e.keyCode === 38) {
+ e.preventDefault()
+ this.selectPriorArticle()
+ }
+
+ if (e.keyCode === 40) {
+ e.preventDefault()
+ this.selectNextArticle()
+ }
+ }
+
+ render () {
+ let articleElements = []
+
+ return (
+
this.handleNoteListKeyDown(e)}
+ style={this.props.style}
+ >
+ {articleElements}
+
+ )
+ }
+}
+
+NoteList.propTypes = {
+ dispatch: PropTypes.func,
+ repositories: PropTypes.array,
+ style: PropTypes.shape({
+ width: PropTypes.number
+ })
+}
+
+export default CSSModules(NoteList, styles)
diff --git a/browser/main/SideNav/FolderItem.styl b/browser/main/SideNav/FolderItem.styl
index 8cbeb646..bf64366b 100644
--- a/browser/main/SideNav/FolderItem.styl
+++ b/browser/main/SideNav/FolderItem.styl
@@ -86,6 +86,7 @@
margin-left 0
overflow ellipsis
background-color $ui-tooltip-backgroundColor
+ z-index 10
color white
line-height 34px
border-top-right-radius 5px
diff --git a/browser/main/SideNav/RepositorySection.js b/browser/main/SideNav/RepositorySection.js
index 110d3a22..a643d9e8 100644
--- a/browser/main/SideNav/RepositorySection.js
+++ b/browser/main/SideNav/RepositorySection.js
@@ -158,7 +158,7 @@ class RepositorySection extends React.Component {
onContextMenu={(e) => this.handleContextButtonClick(e)}
>
-
+
{repository.name}
diff --git a/browser/main/SideNav/RepositorySection.styl b/browser/main/SideNav/RepositorySection.styl
index e73e9c8c..f9e7e9fe 100644
--- a/browser/main/SideNav/RepositorySection.styl
+++ b/browser/main/SideNav/RepositorySection.styl
@@ -10,10 +10,12 @@
text-align left
font-size 14px
color $ui-inactive-text-color
+ &:hover
+ background-color $ui-button--hover-backgroundColor
&:hover .header-control-button
opacity 1
&:active
- background-color $ui-button--active-backgroundColor !important
+ background-color $ui-button--active-backgroundColor
color $ui-button--active-color
.header-control-button, .header-control-button--show
color white
@@ -22,6 +24,8 @@
@extend .header
background-color $ui-button--active-backgroundColor
color $ui-button--active-color
+ &:hover
+ background-color $ui-button--active-backgroundColor
.header-control-button,
.header-control-button--show
color white
@@ -124,6 +128,7 @@
margin-left 0
overflow ellipsis
background-color $ui-tooltip-backgroundColor
+ z-index 10
color white
line-height 34px
border-top-right-radius 5px
@@ -136,6 +141,7 @@
height 33px
top inherit
bottom inherit
+ z-index 11
left 43px
box-sizing border-box
overflow hidden
@@ -164,6 +170,7 @@
margin-left 0
overflow ellipsis
background-color $ui-tooltip-backgroundColor
+ z-index 10
color white
line-height 34px
border-top-right-radius 5px
diff --git a/browser/main/SideNav/SideNav.styl b/browser/main/SideNav/SideNav.styl
index 8fcab2f6..e4249119 100644
--- a/browser/main/SideNav/SideNav.styl
+++ b/browser/main/SideNav/SideNav.styl
@@ -1,8 +1,9 @@
.root
absolute top left
- bottom $statusBar-height
+ bottom $statusBar-height - 1
width $sideNav-width
border-right $ui-border
+ border-bottom $ui-border
background-color $ui-backgroundColor
user-select none
color $ui-text-color
@@ -88,6 +89,7 @@
margin-left 0
overflow hidden
background-color $ui-tooltip-backgroundColor
+ z-index 10
color white
line-height 34px
border-top-right-radius 5px
@@ -99,6 +101,7 @@
text-align center
&:hover .menu-button-label
width 100px
+ // TODO: extract tooltip style to a mixin
.menu-button-label
position fixed
display inline-block
@@ -110,6 +113,7 @@
margin-left 0
overflow ellipsis
background-color $ui-tooltip-backgroundColor
+ z-index 10
color white
line-height 34px
border-top-right-radius 5px
diff --git a/browser/main/SideNav/index.js b/browser/main/SideNav/index.js
index 025236d6..05411f16 100644
--- a/browser/main/SideNav/index.js
+++ b/browser/main/SideNav/index.js
@@ -74,8 +74,7 @@ class SideNav extends React.Component {
})
return (
-
@@ -83,7 +82,7 @@ class SideNav extends React.Component {
@@ -92,17 +91,13 @@ class SideNav extends React.Component {
@@ -132,7 +127,13 @@ SideNav.contextTypes = {
SideNav.propTypes = {
dispatch: PropTypes.func,
- repositories: PropTypes.array
+ repositories: PropTypes.array,
+ config: PropTypes.shape({
+ isSideNavFolded: PropTypes.bool
+ }),
+ location: PropTypes.shape({
+ pathname: PropTypes.string
+ })
}
export default CSSModules(SideNav, styles)
diff --git a/browser/main/StatusBar/StatusBar.styl b/browser/main/StatusBar/StatusBar.styl
index bdbc431d..7687b112 100644
--- a/browser/main/StatusBar/StatusBar.styl
+++ b/browser/main/StatusBar/StatusBar.styl
@@ -1,7 +1,6 @@
.root
absolute bottom left right
- height $statusBar-height
- border-top $ui-border
+ height $statusBar-height - 1
background-color $ui-backgroundColor
.pathname
diff --git a/browser/main/TopBar/TopBar.styl b/browser/main/TopBar/TopBar.styl
index 570e8912..56ad9c72 100644
--- a/browser/main/TopBar/TopBar.styl
+++ b/browser/main/TopBar/TopBar.styl
@@ -2,14 +2,13 @@
absolute top right
background-color $ui-backgroundColor
left $sideNav-width
- border-bottom $ui-border
- height 60px
+ height $topBar-height -1
clearfix()
.left
float left
- height 59px
- line-height 60px
+ height $topBar-height - 1
+ line-height $topBar-height
.left-search
margin-top 12px
@@ -60,11 +59,12 @@
.left-control-newPostButton-tooltip
position fixed
+ line-height 1.4
background-color $ui-tooltip-backgroundColor
color $ui-tooltip-text-color
font-size 10px
margin-left -35px
- margin-top 12px
+ margin-top 5px
padding 5px
z-index 1
border-radius 5px
@@ -73,7 +73,7 @@
.right
float right
- height 60px
+ height $topBar-height -1
clearfix()
.right-helpButton
diff --git a/browser/main/TopBar/index.js b/browser/main/TopBar/index.js
index 922ccf48..3aa89aee 100644
--- a/browser/main/TopBar/index.js
+++ b/browser/main/TopBar/index.js
@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
+import { connect } from 'react-redux'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TopBar.styl'
import activityRecord from 'browser/lib/activityRecord'
@@ -80,7 +81,7 @@ class TopBar extends React.Component {
onClick={(e) => this.handleNewPostButtonClick(e)}>