1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 18:26:26 +00:00

Merge pull request #231 from sota1235/master

[Refactor] Use ESLint instead of StandarJS and add settings for TravisCI
This commit is contained in:
Sota Sugiura
2017-01-12 00:48:05 +09:00
committed by GitHub
53 changed files with 123 additions and 134 deletions

3
.eslintignore Normal file
View File

@@ -0,0 +1,3 @@
node_modules/
compiled/
dist/

6
.eslintrc Normal file
View File

@@ -0,0 +1,6 @@
{
"extends": ["standard", "standard-jsx"],
"rules": {
"no-useless-escape": 0
}
}

6
.travis.yml Normal file
View File

@@ -0,0 +1,6 @@
language: node_js
node_js:
- 'stable'
- 'lts/*'
script: npm run lint && npm run test

View File

@@ -75,8 +75,8 @@ const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteCont
: <i styleName='item-title-icon' className='fa fa-fw fa-file-text-o' /> : <i styleName='item-title-icon' className='fa fa-fw fa-file-text-o' />
} }
{note.isStarred ? {note.isStarred
<i styleName='item-star' className='fa fa-star' /> : '' ? <i styleName='item-star' className='fa fa-star' /> : ''
} }
</div> </div>
</div> </div>
@@ -91,10 +91,10 @@ NoteItem.propTypes = {
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
title: PropTypes.string.isrequired, title: PropTypes.string.isrequired,
tags: PropTypes.array, tags: PropTypes.array,
isStarred: PropTypes.bool.isRequired, isStarred: PropTypes.bool.isRequired
}), }),
handleNoteClick: PropTypes.func.isRequired, handleNoteClick: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired, handleNoteContextMenu: PropTypes.func.isRequired
} }
export default CSSModules(NoteItem, styles) export default CSSModules(NoteItem, styles)

View File

@@ -40,10 +40,10 @@ NoteItemSimple.propTypes = {
storage: PropTypes.string.isRequired, storage: PropTypes.string.isRequired,
key: PropTypes.string.isRequired, key: PropTypes.string.isRequired,
type: PropTypes.string.isRequired, type: PropTypes.string.isRequired,
title: PropTypes.string.isrequired, title: PropTypes.string.isrequired
}), }),
handleNoteClick: PropTypes.func.isRequired, handleNoteClick: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired, handleNoteContextMenu: PropTypes.func.isRequired
} }
export default CSSModules(NoteItemSimple, styles) export default CSSModules(NoteItemSimple, styles)

View File

@@ -12,7 +12,7 @@ export default class ProfileImage extends React.Component {
className={className} className={className}
width={this.props.size} width={this.props.size}
height={this.props.size} height={this.props.size}
src={src}/> src={src} />
) )
} }
} }

View File

@@ -17,17 +17,17 @@ const SideNavFilter = ({
isFolded, isHomeActive, handleAllNotesButtonClick, isFolded, isHomeActive, handleAllNotesButtonClick,
isStarredActive, handleStarredButtonClick isStarredActive, handleStarredButtonClick
}) => ( }) => (
<div styleName={ isFolded ? 'menu--folded' : 'menu' }> <div styleName={isFolded ? 'menu--folded' : 'menu'}>
<button styleName={isHomeActive ? 'menu-button--active' : 'menu-button'} <button styleName={isHomeActive ? 'menu-button--active' : 'menu-button'}
onClick={handleAllNotesButtonClick} onClick={handleAllNotesButtonClick}
> >
<i className='fa fa-book fa-fw'/> <i className='fa fa-book fa-fw' />
<span styleName='menu-button-label'>All Notes</span> <span styleName='menu-button-label'>All Notes</span>
</button> </button>
<button styleName={isStarredActive ? 'menu-button--active' : 'menu-button'} <button styleName={isStarredActive ? 'menu-button--active' : 'menu-button'}
onClick={handleStarredButtonClick} onClick={handleStarredButtonClick}
> >
<i className='fa fa-star fa-fw'/> <i className='fa fa-star fa-fw' />
<span styleName='menu-button-label'>Starred</span> <span styleName='menu-button-label'>Starred</span>
</button> </button>
</div> </div>
@@ -38,7 +38,7 @@ SideNavFilter.propTypes = {
isHomeActive: PropTypes.bool.isRequired, isHomeActive: PropTypes.bool.isRequired,
handleAllNotesButtonClick: PropTypes.func.isRequired, handleAllNotesButtonClick: PropTypes.func.isRequired,
isStarredActive: PropTypes.bool.isRequired, isStarredActive: PropTypes.bool.isRequired,
handleStarredButtonClick: PropTypes.func.isRequired, handleStarredButtonClick: PropTypes.func.isRequired
} }
export default CSSModules(SideNavFilter, styles) export default CSSModules(SideNavFilter, styles)

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './SnippetTab.styl' import styles from './SnippetTab.styl'
import context from 'browser/lib/context' import context from 'browser/lib/context'
@@ -117,7 +117,7 @@ class SnippetTab extends React.Component {
<button styleName='deleteButton' <button styleName='deleteButton'
onClick={(e) => this.handleDeleteButtonClick(e)} onClick={(e) => this.handleDeleteButtonClick(e)}
> >
<i className='fa fa-times'/> <i className='fa fa-times' />
</button> </button>
} }
</div> </div>

View File

@@ -27,8 +27,8 @@ const StorageItem = ({
onClick={handleButtonClick} onClick={handleButtonClick}
onContextMenu={handleContextMenu} onContextMenu={handleContextMenu}
> >
<span styleName={isFolded ? <span styleName={isFolded
'folderList-item-name--folded' : 'folderList-item-name' ? 'folderList-item-name--folded' : 'folderList-item-name'
} }
style={{borderColor: folderColor}} style={{borderColor: folderColor}}
> >
@@ -52,7 +52,7 @@ StorageItem.propTypes = {
folderName: PropTypes.string.isRequired, folderName: PropTypes.string.isRequired,
folderColor: PropTypes.string, folderColor: PropTypes.string,
isFolded: PropTypes.bool.isRequired, isFolded: PropTypes.bool.isRequired,
noteCount: PropTypes.number, noteCount: PropTypes.number
} }
export default CSSModules(StorageItem, styles) export default CSSModules(StorageItem, styles)

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './NoteDetail.styl' import styles from './NoteDetail.styl'
import MarkdownPreview from 'browser/components/MarkdownPreview' import MarkdownPreview from 'browser/components/MarkdownPreview'
@@ -97,9 +97,7 @@ class NoteDetail extends React.Component {
let { note, config } = this.props let { note, config } = this.props
if (note == null) { if (note == null) {
return ( return (
<div styleName='root'> <div styleName='root' />
</div>
) )
} }

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import NoteItem from 'browser/components/NoteItem' import NoteItem from 'browser/components/NoteItem'
import moment from 'moment' import moment from 'moment'
@@ -54,12 +54,11 @@ class NoteList extends React.Component {
} }
render () { render () {
let { storageMap, notes, index } = this.props let { notes, index } = this.props
let notesList = notes let notesList = notes
.slice(0, 10 + 10 * this.state.range) .slice(0, 10 + 10 * this.state.range)
.map((note, _index) => { .map((note, _index) => {
const isActive = (index === _index) const isActive = (index === _index)
const key = `${note.storage}-${note.key}` const key = `${note.storage}-${note.key}`
const dateDisplay = moment(note.updatedAt).fromNow() const dateDisplay = moment(note.updatedAt).fromNow()

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './StorageSection.styl' import styles from './StorageSection.styl'
import StorageItem from 'browser/components/StorageItem' import StorageItem from 'browser/components/StorageItem'

View File

@@ -2,7 +2,6 @@ import React, { PropTypes } from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { connect, Provider } from 'react-redux' import { connect, Provider } from 'react-redux'
import _ from 'lodash' import _ from 'lodash'
import ipc from './ipcClient'
import store from './store' import store from './store'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './FinderMain.styl' import styles from './FinderMain.styl'
@@ -351,7 +350,7 @@ function refreshData () {
ReactDOM.render(( ReactDOM.render((
<Provider store={store}> <Provider store={store}>
<Finder/> <Finder />
</Provider> </Provider>
), document.getElementById('content'), function () { ), document.getElementById('content'), function () {
refreshData() refreshData()

View File

@@ -1,4 +1,3 @@
import CodeMirror from 'codemirror' import CodeMirror from 'codemirror'
import _ from 'lodash'
CodeMirror.modeInfo.push({name: 'Stylus', mime: 'text/x-styl', mode: 'stylus', ext: ['styl'], alias: ['styl']}) CodeMirror.modeInfo.push({name: 'Stylus', mime: 'text/x-styl', mode: 'stylus', ext: ['styl'], alias: ['styl']})

View File

@@ -1,17 +1,17 @@
/** /**
* @fileoverview Formatting date string. * @fileoverview Formatting date string.
*/ */
import moment from 'moment'; import moment from 'moment'
/** /**
* @description Return date string. For example, 'Sep.9, 2016 12:00'. * @description Return date string. For example, 'Sep.9, 2016 12:00'.
* @param {mixed} * @param {mixed}
* @return {string} * @return {string}
*/ */
export function getLastUpdated(date) { export function getLastUpdated (date) {
const m = moment(date) const m = moment(date)
if (!m.isValid()) { if (!m.isValid()) {
throw Error('Invalid argument.'); throw Error('Invalid argument.')
} }
return m.format('MMM D, gggg H:mm') return m.format('MMM D, gggg H:mm')

View File

@@ -58,7 +58,7 @@ md.use(math, {
}) })
md.use(require('markdown-it-footnote')) md.use(require('markdown-it-footnote'))
// Override task item // Override task item
md.block.ruler.at('paragraph', function (state, startLine/*, endLine*/) { md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
let content, terminate, i, l, token let content, terminate, i, l, token
let nextLine = startLine + 1 let nextLine = startLine + 1
let terminatorRules = state.md.block.ruler.getRules('paragraph') let terminatorRules = state.md.block.ruler.getRules('paragraph')

View File

@@ -128,8 +128,8 @@ class FolderSelect extends React.Component {
} }
nextOption () { nextOption () {
let { storages } = this.props
let { optionIndex } = this.state let { optionIndex } = this.state
let { folders } = this.props
optionIndex++ optionIndex++
if (optionIndex >= folders.length) optionIndex = 0 if (optionIndex >= folders.length) optionIndex = 0
@@ -268,7 +268,7 @@ class FolderSelect extends React.Component {
<span styleName='idle-label-name-surfix'>in {currentOption.storage.name}</span> <span styleName='idle-label-name-surfix'>in {currentOption.storage.name}</span>
</span> </span>
</div> </div>
<i styleName='idle-caret' className='fa fa-fw fa-caret-down'/> <i styleName='idle-caret' className='fa fa-fw fa-caret-down' />
</div> </div>
} }

View File

@@ -21,7 +21,7 @@ const LastUpdatedString = ({ date }) => {
} }
LastUpdatedString.propTypes = { LastUpdatedString.propTypes = {
date: PropTypes.string, date: PropTypes.string
} }
export default CSSModules(LastUpdatedString, styles) export default CSSModules(LastUpdatedString, styles)

View File

@@ -205,7 +205,7 @@ class MarkdownNoteDetail extends React.Component {
} }
render () { render () {
let { data, config } = this.props let { config } = this.props
let { note } = this.state let { note } = this.state
return ( return (

View File

@@ -14,6 +14,7 @@ import SnippetTab from 'browser/components/SnippetTab'
import StatusBar from '../StatusBar' import StatusBar from '../StatusBar'
import context from 'browser/lib/context' import context from 'browser/lib/context'
import ConfigManager from 'browser/main/lib/ConfigManager' import ConfigManager from 'browser/main/lib/ConfigManager'
import _ from 'lodash'
function pass (name) { function pass (name) {
switch (name) { switch (name) {
@@ -459,7 +460,7 @@ class SnippetNoteDetail extends React.Component {
} }
render () { render () {
let { data, config } = this.props let { config } = this.props
let { note } = this.state let { note } = this.state
let editorFontSize = parseInt(config.editor.fontSize, 10) let editorFontSize = parseInt(config.editor.fontSize, 10)
@@ -538,7 +539,7 @@ class SnippetNoteDetail extends React.Component {
<button styleName='info-right-button' <button styleName='info-right-button'
onClick={(e) => this.handleContextButtonClick(e)} onClick={(e) => this.handleContextButtonClick(e)}
> >
<i className='fa fa-ellipsis-v'/> <i className='fa fa-ellipsis-v' />
</button> </button>
</div> </div>
</div> </div>
@@ -563,7 +564,7 @@ class SnippetNoteDetail extends React.Component {
<button styleName='plusButton' <button styleName='plusButton'
onClick={(e) => this.handleTabPlusButtonClick(e)} onClick={(e) => this.handleTabPlusButtonClick(e)}
> >
<i className='fa fa-plus'/> <i className='fa fa-plus' />
</button> </button>
</div> </div>
{viewList} {viewList}
@@ -577,19 +578,19 @@ class SnippetNoteDetail extends React.Component {
? 'Select Syntax...' ? 'Select Syntax...'
: this.state.note.snippets[this.state.snippetIndex].mode : this.state.note.snippets[this.state.snippetIndex].mode
}&nbsp; }&nbsp;
<i className='fa fa-caret-down'/> <i className='fa fa-caret-down' />
</button> </button>
<button <button
onClick={(e) => this.handleIndentTypeButtonClick(e)} onClick={(e) => this.handleIndentTypeButtonClick(e)}
> >
Indent: {config.editor.indentType}&nbsp; Indent: {config.editor.indentType}&nbsp;
<i className='fa fa-caret-down'/> <i className='fa fa-caret-down' />
</button> </button>
<button <button
onClick={(e) => this.handleIndentSizeButtonClick(e)} onClick={(e) => this.handleIndentSizeButtonClick(e)}
> >
size: {config.editor.indentSize}&nbsp; size: {config.editor.indentSize}&nbsp;
<i className='fa fa-caret-down'/> <i className='fa fa-caret-down' />
</button> </button>
</div> </div>

View File

@@ -8,7 +8,7 @@ class TagSelect extends React.Component {
super(props) super(props)
this.state = { this.state = {
newTag: '', newTag: ''
} }
} }
@@ -111,7 +111,7 @@ class TagSelect extends React.Component {
<button styleName='tag-removeButton' <button styleName='tag-removeButton'
onClick={(e) => this.handleTagRemoveButtonClick(tag)(e)} onClick={(e) => this.handleTagRemoveButtonClick(tag)(e)}
> >
<i className='fa fa-times fa-fw tag-removeButton-icon'/> <i className='fa fa-times fa-fw tag-removeButton-icon' />
</button> </button>
</span> </span>
) )

View File

@@ -112,7 +112,7 @@ class Main extends React.Component {
ConfigManager.set({ navWidth }) ConfigManager.set({ navWidth })
dispatch({ dispatch({
type: 'SET_NAV_WIDTH', type: 'SET_NAV_WIDTH',
navWidth, navWidth
}) })
}) })
} }
@@ -169,7 +169,7 @@ class Main extends React.Component {
onMouseDown={(e) => this.handleLeftSlideMouseDown(e)} onMouseDown={(e) => this.handleLeftSlideMouseDown(e)}
draggable='false' draggable='false'
> >
<div styleName='slider-hitbox'/> <div styleName='slider-hitbox' />
</div> </div>
} }
<div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'} <div styleName={config.isSideNavFolded ? 'body--expanded' : 'body'}

View File

@@ -324,8 +324,8 @@ class NoteList extends React.Component {
const isDefault = config.listStyle === 'DEFAULT' const isDefault = config.listStyle === 'DEFAULT'
const isActive = location.query.key === note.storage + '-' + note.key const isActive = location.query.key === note.storage + '-' + note.key
const dateDisplay = moment( const dateDisplay = moment(
config.sortBy === 'CREATED_AT' ? config.sortBy === 'CREATED_AT'
note.createdAt : note.updatedAt ? note.createdAt : note.updatedAt
).fromNow() ).fromNow()
const key = `${note.storage}-${note.key}` const key = `${note.storage}-${note.key}`
@@ -376,7 +376,7 @@ class NoteList extends React.Component {
} }
onClick={(e) => this.handleListStyleButtonClick(e, 'DEFAULT')} onClick={(e) => this.handleListStyleButtonClick(e, 'DEFAULT')}
> >
<i className='fa fa-th-large'/> <i className='fa fa-th-large' />
</button> </button>
<button styleName={config.listStyle === 'SMALL' <button styleName={config.listStyle === 'SMALL'
? 'control-button--active' ? 'control-button--active'
@@ -384,7 +384,7 @@ class NoteList extends React.Component {
} }
onClick={(e) => this.handleListStyleButtonClick(e, 'SMALL')} onClick={(e) => this.handleListStyleButtonClick(e, 'SMALL')}
> >
<i className='fa fa-list-ul'/> <i className='fa fa-list-ul' />
</button> </button>
</div> </div>
<div styleName='list' <div styleName='list'

View File

@@ -181,7 +181,7 @@ class StorageItem extends React.Component {
<button styleName='header-addFolderButton' <button styleName='header-addFolderButton'
onClick={(e) => this.handleAddFolderButtonClick(e)} onClick={(e) => this.handleAddFolderButtonClick(e)}
> >
<i className='fa fa-plus'/> <i className='fa fa-plus' />
</button> </button>
} }

View File

@@ -7,9 +7,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import StorageItem from './StorageItem' import StorageItem from './StorageItem'
import SideNavFilter from 'browser/components/SideNavFilter' import SideNavFilter from 'browser/components/SideNavFilter'
const electron = require('electron')
const { remote } = electron
class SideNav extends React.Component { class SideNav extends React.Component {
// TODO: should not use electron stuff v0.7 // TODO: should not use electron stuff v0.7
handleMenuButtonClick (e) { handleMenuButtonClick (e) {
@@ -65,7 +62,7 @@ class SideNav extends React.Component {
<button styleName='top-menu' <button styleName='top-menu'
onClick={(e) => this.handleMenuButtonClick(e)} onClick={(e) => this.handleMenuButtonClick(e)}
> >
<i className='fa fa-navicon fa-fw'/> <i className='fa fa-navicon fa-fw' />
<span styleName='top-menu-label'>Menu</span> <span styleName='top-menu-label'>Menu</span>
</button> </button>
</div> </div>
@@ -87,8 +84,8 @@ class SideNav extends React.Component {
onClick={(e) => this.handleToggleButtonClick(e)} onClick={(e) => this.handleToggleButtonClick(e)}
> >
{isFolded {isFolded
? <i className='fa fa-angle-double-right'/> ? <i className='fa fa-angle-double-right' />
: <i className='fa fa-angle-double-left'/> : <i className='fa fa-angle-double-left' />
} }
</button> </button>
</div> </div>

View File

@@ -59,9 +59,9 @@ class StatusBar extends React.Component {
</button> </button>
: null : null
} }
{/*<button styleName='help'> {/* <button styleName='help'>
<i className='fa fa-info-circle' /> <i className='fa fa-info-circle' />
</button>*/} </button> */}
<button styleName='zoom' <button styleName='zoom'
onClick={(e) => this.handleZoomButtonClick(e)} onClick={(e) => this.handleZoomButtonClick(e)}
> >

View File

@@ -10,8 +10,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import dataApi from 'browser/main/lib/dataApi' import dataApi from 'browser/main/lib/dataApi'
const OSX = window.process.platform === 'darwin' const OSX = window.process.platform === 'darwin'
const { remote } = require('electron')
const { Menu, MenuItem } = remote
class TopBar extends React.Component { class TopBar extends React.Component {
constructor (props) { constructor (props) {
@@ -71,10 +69,10 @@ class TopBar extends React.Component {
break break
} }
} }
if (storage == null) alert('No storage to create a note') if (storage == null) window.alert('No storage to create a note')
let folder = _.find(storage.folders, {key: params.folderKey}) let folder = _.find(storage.folders, {key: params.folderKey})
if (folder == null) folder = storage.folders[0] if (folder == null) folder = storage.folders[0]
if (folder == null) alert('No folder to create a note') if (folder == null) window.alert('No folder to create a note')
return { return {
storage, storage,
@@ -262,8 +260,8 @@ class TopBar extends React.Component {
<span styleName='control-search-optionList-item-folder-surfix'>in {storage.name}</span> <span styleName='control-search-optionList-item-folder-surfix'>in {storage.name}</span>
</div> </div>
{note.type === 'SNIPPET_NOTE' {note.type === 'SNIPPET_NOTE'
? <i styleName='control-search-optionList-item-type' className='fa fa-code'/> ? <i styleName='control-search-optionList-item-type' className='fa fa-code' />
: <i styleName='control-search-optionList-item-type' className='fa fa-file-text-o'/> : <i styleName='control-search-optionList-item-type' className='fa fa-file-text-o' />
}&nbsp; }&nbsp;
{note.title} {note.title}
</div> </div>
@@ -276,7 +274,7 @@ class TopBar extends React.Component {
> >
<div styleName='control'> <div styleName='control'>
<div styleName='control-search'> <div styleName='control-search'>
<i styleName='control-search-icon' className='fa fa-search fa-fw'/> <i styleName='control-search-icon' className='fa fa-search fa-fw' />
<div styleName='control-search-input' <div styleName='control-search-input'
onFocus={(e) => this.handleSearchFocus(e)} onFocus={(e) => this.handleSearchFocus(e)}
onBlur={(e) => this.handleSearchBlur(e)} onBlur={(e) => this.handleSearchBlur(e)}
@@ -303,14 +301,14 @@ class TopBar extends React.Component {
<button styleName='left-search-clearButton' <button styleName='left-search-clearButton'
onClick={(e) => this.handleSearchClearButton(e)} onClick={(e) => this.handleSearchClearButton(e)}
> >
<i className='fa fa-times'/> <i className='fa fa-times' />
</button> </button>
} }
</div> </div>
<button styleName='control-newPostButton' <button styleName='control-newPostButton'
onClick={(e) => this.handleNewPostButtonClick(e)}> onClick={(e) => this.handleNewPostButtonClick(e)}>
<i className='fa fa-plus'/> <i className='fa fa-plus' />
<span styleName='control-newPostButton-tooltip'> <span styleName='control-newPostButton-tooltip'>
Make a Note {OSX ? '⌘' : '^'} + n Make a Note {OSX ? '⌘' : '^'} + n
</span> </span>

View File

@@ -20,10 +20,10 @@ class ModalBase extends React.Component {
render () { render () {
return ( return (
<div className={'ModalBase' + (this.state.isHidden ? ' hide' : '')}> <div className={'ModalBase' + (this.state.isHidden ? ' hide' : '')}>
<div onClick={(e) => this.close(e)} className='modalBack'/> <div onClick={(e) => this.close(e)} className='modalBack' />
{this.state.component == null ? null : ( {this.state.component == null ? null : (
<Provider store={store}> <Provider store={store}>
<this.state.component {...this.state.componentProps} close={this.close}/> <this.state.component {...this.state.componentProps} close={this.close} />
</Provider> </Provider>
)} )}
</div> </div>
@@ -33,7 +33,7 @@ class ModalBase extends React.Component {
let el = document.createElement('div') let el = document.createElement('div')
document.body.appendChild(el) document.body.appendChild(el)
let modalBase = ReactDOM.render(<ModalBase/>, el) let modalBase = ReactDOM.render(<ModalBase />, el)
export function openModal (component, props) { export function openModal (component, props) {
if (modalBase == null) { return } if (modalBase == null) { return }

View File

@@ -33,13 +33,13 @@ export default class DeleteArticleModal extends React.Component {
render () { render () {
return ( return (
<div className='DeleteArticleModal modal'> <div className='DeleteArticleModal modal'>
<div className='title'><i className='fa fa-fw fa-trash'/> Delete an article.</div> <div className='title'><i className='fa fa-fw fa-trash' /> Delete an article.</div>
<div className='message'>Do you really want to delete?</div> <div className='message'>Do you really want to delete?</div>
<div className='control'> <div className='control'>
<button ref='no' onClick={(e) => this.handleNoButtonClick(e)}><i className='fa fa-fw fa-close'/> No</button> <button ref='no' onClick={(e) => this.handleNoButtonClick(e)}><i className='fa fa-fw fa-close' /> No</button>
<button ref='yes' onClick={(e) => this.handleYesButtonClick(e)} className='danger'><i className='fa fa-fw fa-check'/> Yes</button> <button ref='yes' onClick={(e) => this.handleYesButtonClick(e)} className='danger'><i className='fa fa-fw fa-check' /> Yes</button>
</div> </div>
</div> </div>
) )

View File

@@ -1,11 +1,10 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './InitModal.styl' import styles from './InitModal.styl'
import dataApi from 'browser/main/lib/dataApi' import dataApi from 'browser/main/lib/dataApi'
import store from 'browser/main/store' import store from 'browser/main/store'
import { hashHistory } from 'react-router' import { hashHistory } from 'react-router'
import _ from 'lodash' import _ from 'lodash'
import keygen from 'browser/lib/keygen'
const CSON = require('@rokt33r/season') const CSON = require('@rokt33r/season')
const path = require('path') const path = require('path')
@@ -197,7 +196,7 @@ class InitModal extends React.Component {
render () { render () {
if (this.state.isLoading) { if (this.state.isLoading) {
return <div styleName='root--loading'> return <div styleName='root--loading'>
<i styleName='spinner' className='fa fa-spin fa-spinner'/> <i styleName='spinner' className='fa fa-spin fa-spinner' />
<div styleName='loadingMessage'>Preparing initialization...</div> <div styleName='loadingMessage'>Preparing initialization...</div>
</div> </div>
} }
@@ -235,7 +234,7 @@ class InitModal extends React.Component {
{this.state.legacyStorageExists && {this.state.legacyStorageExists &&
<div styleName='body-migration'> <div styleName='body-migration'>
<label><input type='checkbox' checked={this.state.migrationRequested} onChange={(e) => this.handleMigrationRequestedChange(e)}/> Migrate old data from the legacy app v0.5</label> <label><input type='checkbox' checked={this.state.migrationRequested} onChange={(e) => this.handleMigrationRequestedChange(e)} /> Migrate old data from the legacy app v0.5</label>
</div> </div>
} }
@@ -247,7 +246,7 @@ class InitModal extends React.Component {
> >
{this.state.isSending {this.state.isSending
? <span> ? <span>
<i className='fa fa-spin fa-spinner'/> Loading... <i className='fa fa-spin fa-spinner' /> Loading...
</span> </span>
: 'Let\'s Go!' : 'Let\'s Go!'
} }

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './NewNoteModal.styl' import styles from './NewNoteModal.styl'
import dataApi from 'browser/main/lib/dataApi' import dataApi from 'browser/main/lib/dataApi'
@@ -114,8 +114,8 @@ class NewNoteModal extends React.Component {
> >
<i styleName='control-button-icon' <i styleName='control-button-icon'
className='fa fa-file-text-o' className='fa fa-file-text-o'
/><br/> /><br />
<span styleName='control-button-label'>Markdown Note</span><br/> <span styleName='control-button-label'>Markdown Note</span><br />
<span styleName='control-button-description'>It is good for any type of documents. Check List, Code block and Latex block are available.</span> <span styleName='control-button-description'>It is good for any type of documents. Check List, Code block and Latex block are available.</span>
</button> </button>
@@ -126,14 +126,14 @@ class NewNoteModal extends React.Component {
> >
<i styleName='control-button-icon' <i styleName='control-button-icon'
className='fa fa-code' className='fa fa-code'
/><br/> /><br />
<span styleName='control-button-label'>Snippet Note</span><br/> <span styleName='control-button-label'>Snippet Note</span><br />
<span styleName='control-button-description'>This format is specialized on managing snippets like Gist. Multiple snippets can be grouped as a note. <span styleName='control-button-description'>This format is specialized on managing snippets like Gist. Multiple snippets can be grouped as a note.
</span> </span>
</button> </button>
</div> </div>
<div styleName='description'><i className='fa fa-arrows-h'/> Tab to switch format</div> <div styleName='description'><i className='fa fa-arrows-h' /> Tab to switch format</div>
</div> </div>
) )

View File

@@ -7,8 +7,6 @@ import store from 'browser/main/store'
const electron = require('electron') const electron = require('electron')
const ipc = electron.ipcRenderer const ipc = electron.ipcRenderer
const OSX = global.process.platform === 'darwin'
class HotkeyTab extends React.Component { class HotkeyTab extends React.Component {
constructor (props) { constructor (props) {
super(props) super(props)
@@ -150,7 +148,7 @@ class HotkeyTab extends React.Component {
} }
HotkeyTab.propTypes = { HotkeyTab.propTypes = {
dispatch: PropTypes.func, dispatch: PropTypes.func
} }
export default CSSModules(HotkeyTab, styles) export default CSSModules(HotkeyTab, styles)

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react' import React from 'react'
import CSSModules from 'browser/lib/CSSModules' import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoTab.styl' import styles from './InfoTab.styl'
@@ -26,7 +26,7 @@ class InfoTab extends React.Component {
<div styleName='top'> <div styleName='top'>
<div styleName='icon-space'> <div styleName='icon-space'>
<img styleName='icon' src='../resources/app.png' width='92' height='92'/> <img styleName='icon' src='../resources/app.png' width='92' height='92' />
<div styleName='icon-right'> <div styleName='icon-right'>
<div styleName='appId'>Boostnote {appVersion}</div> <div styleName='appId'>Boostnote {appVersion}</div>
<div styleName='description'> <div styleName='description'>
@@ -34,7 +34,7 @@ class InfoTab extends React.Component {
</div> </div>
</div> </div>
</div> </div>
<div styleName='clear'></div> <div styleName='clear' />
<div styleName='madeBy'>Made by&nbsp; <div styleName='madeBy'>Made by&nbsp;
<a href='http://maisin.co/' <a href='http://maisin.co/'
onClick={(e) => this.handleLinkClick(e)} onClick={(e) => this.handleLinkClick(e)}

View File

@@ -106,7 +106,10 @@ class UnstyledFolderItem extends React.Component {
const popover = { position: 'absolute', zIndex: 2 } const popover = { position: 'absolute', zIndex: 2 }
const cover = { const cover = {
position: 'fixed', position: 'fixed',
top: 0, right: 0, bottom: 0, left: 0 top: 0,
right: 0,
bottom: 0,
left: 0
} }
const pickerStyle = Object.assign({}, { const pickerStyle = Object.assign({}, {
position: 'absolute' position: 'absolute'
@@ -137,7 +140,7 @@ class UnstyledFolderItem extends React.Component {
</div> </div>
: null : null
} }
<i className='fa fa-square'/> <i className='fa fa-square' />
</button> </button>
<input styleName='folderList-item-left-nameInput' <input styleName='folderList-item-left-nameInput'
value={this.state.folder.name} value={this.state.folder.name}
@@ -368,17 +371,17 @@ class StorageItem extends React.Component {
: <div styleName='header-label' : <div styleName='header-label'
onClick={(e) => this.handleLabelClick(e)} onClick={(e) => this.handleLabelClick(e)}
> >
<i className='fa fa-folder-open'/>&nbsp; <i className='fa fa-folder-open' />&nbsp;
{storage.name}&nbsp; {storage.name}&nbsp;
<span styleName='header-label-path'>({storage.path})</span>&nbsp; <span styleName='header-label-path'>({storage.path})</span>&nbsp;
<i styleName='header-label-editButton' className='fa fa-pencil'/> <i styleName='header-label-editButton' className='fa fa-pencil' />
</div> </div>
} }
<div styleName='header-control'> <div styleName='header-control'>
<button styleName='header-control-button' <button styleName='header-control-button'
onClick={(e) => this.handleNewFolderButtonClick(e)} onClick={(e) => this.handleNewFolderButtonClick(e)}
> >
<i className='fa fa-plus'/> <i className='fa fa-plus' />
<span styleName='header-control-button-tooltip' <span styleName='header-control-button-tooltip'
style={{left: -20}} style={{left: -20}}
>Add Folder</span> >Add Folder</span>
@@ -386,7 +389,7 @@ class StorageItem extends React.Component {
<button styleName='header-control-button' <button styleName='header-control-button'
onClick={(e) => this.handleExternalButtonClick(e)} onClick={(e) => this.handleExternalButtonClick(e)}
> >
<i className='fa fa-external-link'/> <i className='fa fa-external-link' />
<span styleName='header-control-button-tooltip' <span styleName='header-control-button-tooltip'
style={{left: -50}} style={{left: -50}}
>Open Storage folder</span> >Open Storage folder</span>
@@ -394,7 +397,7 @@ class StorageItem extends React.Component {
<button styleName='header-control-button' <button styleName='header-control-button'
onClick={(e) => this.handleUnlinkButtonClick(e)} onClick={(e) => this.handleUnlinkButtonClick(e)}
> >
<i className='fa fa-unlink'/> <i className='fa fa-unlink' />
<span styleName='header-control-button-tooltip' <span styleName='header-control-button-tooltip'
style={{left: -10}} style={{left: -10}}
>Unlink</span> >Unlink</span>

View File

@@ -72,7 +72,7 @@ class StoragesTab extends React.Component {
<button styleName='list-control-addStorageButton' <button styleName='list-control-addStorageButton'
onClick={(e) => this.handleAddStorageButton(e)} onClick={(e) => this.handleAddStorageButton(e)}
> >
<i className='fa fa-plus'/> Add Storage <i className='fa fa-plus' /> Add Storage
</button> </button>
</div> </div>
</div> </div>

View File

@@ -5,9 +5,6 @@ import ConfigManager from 'browser/main/lib/ConfigManager'
import store from 'browser/main/store' import store from 'browser/main/store'
import consts from 'browser/lib/consts' import consts from 'browser/lib/consts'
const electron = require('electron')
const ipc = electron.ipcRenderer
const OSX = global.process.platform === 'darwin' const OSX = global.process.platform === 'darwin'
class UiTab extends React.Component { class UiTab extends React.Component {

View File

@@ -43,7 +43,7 @@ class Preferences extends React.Component {
switch (this.state.currentTab) { switch (this.state.currentTab) {
case 'INFO': case 'INFO':
return <InfoTab/> return <InfoTab />
case 'HOTKEY': case 'HOTKEY':
return ( return (
<HotkeyTab <HotkeyTab

View File

@@ -5,16 +5,16 @@ const packager = require('electron-packager')
const WIN = process.platform === 'win32' const WIN = process.platform === 'win32'
module.exports = function (grunt) { module.exports = function (grunt) {
var auth_code var authCode
try { try {
auth_code = grunt.file.readJSON('secret/auth_code.json') authCode = grunt.file.readJSON('secret/auth_code.json')
} catch (e) { } catch (e) {
if (e.origError.code === 'ENOENT') { if (e.origError.code === 'ENOENT') {
console.warn('secret/auth_code.json is not found. CodeSigning is not available.') console.warn('secret/auth_code.json is not found. CodeSigning is not available.')
} }
} }
const OSX_COMMON_NAME = auth_code != null ? auth_code.OSX_COMMON_NAME : '' const OSX_COMMON_NAME = authCode != null ? authCode.OSX_COMMON_NAME : ''
const WIN_CERT_PASSWORD = auth_code != null ? auth_code.WIN_CERT_PASSWORD : '' const WIN_CERT_PASSWORD = authCode != null ? authCode.WIN_CERT_PASSWORD : ''
var initConfig = { var initConfig = {
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),

View File

@@ -1,19 +1,10 @@
const electron = require('electron') const electron = require('electron')
const app = electron.app const app = electron.app
const Menu = electron.Menu
var finderWindow = null
app.on('ready', function () { app.on('ready', function () {
if (process.platform === 'darwin') { if (process.platform === 'darwin') {
app.dock.hide() app.dock.hide()
} }
// var template = require('./finder-menu')
// var menu = Menu.buildFromTemplate(template)
// Menu.setApplicationMenu(menu)
finderWindow = require('./finder-window')
}) })
module.exports = app module.exports = app

View File

@@ -2,7 +2,6 @@ const electron = require('electron')
const app = electron.app const app = electron.app
const Menu = electron.Menu const Menu = electron.Menu
const ipc = electron.ipcMain const ipc = electron.ipcMain
const autoUpdater = electron.autoUpdater
const path = require('path') const path = require('path')
const ChildProcess = require('child_process') const ChildProcess = require('child_process')
const _ = require('lodash') const _ = require('lodash')
@@ -11,9 +10,8 @@ const GhReleases = require('electron-gh-releases')
var ipcServer = null var ipcServer = null
var mainWindow = null var mainWindow = null
var finderWindow = null
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { var shouldQuit = app.makeSingleInstance(function (commandLine, workingDirectory) {
if (mainWindow) { if (mainWindow) {
if (process.platform === 'win32') { if (process.platform === 'win32') {
mainWindow.minimize() mainWindow.minimize()
@@ -26,12 +24,8 @@ var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory)
if (shouldQuit) { if (shouldQuit) {
app.quit() app.quit()
return
} }
var version = app.getVersion()
var versionText = (version == null || version.length === 0) ? 'DEV version' : 'v' + version
var isUpdateReady = false var isUpdateReady = false
var ghReleasesOpts = { var ghReleasesOpts = {
@@ -108,14 +102,9 @@ app.on('ready', function () {
Menu.setApplicationMenu(menu) Menu.setApplicationMenu(menu)
break break
case 'win32': case 'win32':
finderWindow = require('./finder-window')
mainWindow.setMenu(menu) mainWindow.setMenu(menu)
break break
case 'linux': case 'linux':
// Finder is available on cinnamon only.
if (process.env.DESKTOP_SESSION === 'cinnamon') {
finderWindow = require('./finder-window')
}
Menu.setApplicationMenu(menu) Menu.setApplicationMenu(menu)
mainWindow.setMenu(menu) mainWindow.setMenu(menu)
} }

View File

@@ -9,7 +9,9 @@
"hot": "electron ./index.js --hot", "hot": "electron ./index.js --hot",
"webpack": "webpack-dev-server --hot --inline --config webpack.config.js", "webpack": "webpack-dev-server --hot --inline --config webpack.config.js",
"compile": "grunt compile", "compile": "grunt compile",
"test": "PWD=$(pwd) NODE_ENV=test ava" "test": "PWD=$(pwd) NODE_ENV=test ava",
"fix": "npm run lint --fix",
"lint": "eslint ./**/*.js"
}, },
"config": { "config": {
"electron-version": "1.2.8" "electron-version": "1.2.8"
@@ -87,6 +89,9 @@
"dom-storage": "^2.0.2", "dom-storage": "^2.0.2",
"electron-packager": "^6.0.0", "electron-packager": "^6.0.0",
"electron-prebuilt": "^1.2.8", "electron-prebuilt": "^1.2.8",
"eslint": "^3.13.1",
"eslint-config-standard": "^6.2.1",
"eslint-config-standard-jsx": "^3.2.0",
"faker": "^3.1.0", "faker": "^3.1.0",
"grunt": "^0.4.5", "grunt": "^0.4.5",
"grunt-electron-installer": "^1.2.0", "grunt-electron-installer": "^1.2.0",
@@ -119,7 +124,7 @@
}, },
"ava": { "ava": {
"files": [ "files": [
"tests/**/*.js" "tests/**/*-test.js"
], ],
"require": [ "require": [
"babel-register" "babel-register"

View File

@@ -10,6 +10,8 @@
<h5 align="center">Built with Electron, React + Redux, Webpack and CSSModules</h5> <h5 align="center">Built with Electron, React + Redux, Webpack and CSSModules</h5>
<h1> </h1> <h1> </h1>
[![Build Status](https://travis-ci.org/BoostIO/Boostnote.svg?branch=master)](https://travis-ci.org/BoostIO/Boostnote)
> We launched our [Boostnote store](https://boostnote.paintory.com/)!! :tada: Also, you can support us via [Patreon](https://www.patreon.com/boostnote) and [Open collective](https://opencollective.com/boostnote)! > We launched our [Boostnote store](https://boostnote.paintory.com/)!! :tada: Also, you can support us via [Patreon](https://www.patreon.com/boostnote) and [Open collective](https://opencollective.com/boostnote)!
![Boostnote app screenshot](./resources/repository/top.png) ![Boostnote app screenshot](./resources/repository/top.png)

View File

@@ -36,7 +36,7 @@ test.beforeEach((t) => {
}) })
test.serial('Initialize All Storages', (t) => { test.serial('Initialize All Storages', (t) => {
const { v1StorageData, legacyStorageData, emptyStorageData } = t.context const { v1StorageData, legacyStorageData } = t.context
return Promise.resolve() return Promise.resolve()
.then(function test () { .then(function test () {
return init() return init()

View File

@@ -12,7 +12,6 @@ const TestDummy = require('../fixtures/TestDummy')
const sander = require('sander') const sander = require('sander')
const os = require('os') const os = require('os')
const CSON = require('@rokt33r/season') const CSON = require('@rokt33r/season')
const faker = require('faker')
const storagePath = path.join(os.tmpdir(), 'test/move-note') const storagePath = path.join(os.tmpdir(), 'test/move-note')
const storagePath2 = path.join(os.tmpdir(), 'test/move-note2') const storagePath2 = path.join(os.tmpdir(), 'test/move-note2')