diff --git a/.eslintrc b/.eslintrc index 9177344c..a1646659 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,5 +12,10 @@ "react/no-find-dom-node": "warn", "react/no-render-return-value": "warn", "react/no-deprecated": "warn" + }, + "globals": { + "FileReader": true, + "localStorage": true, + "fetch": true } } diff --git a/Backers.md b/Backers.md index 582f06c2..18d221bf 100644 --- a/Backers.md +++ b/Backers.md @@ -1,43 +1,72 @@ -Dear all, +

Sponsors & Backers

-Thanks for your using! -Boostnote is used in about 200 countries and regions, it is a awesome developer community. +Boostnote is an open source project. It's an independent project with its ongoing development made possible entirely thanks to the support by these awesome backers. If you'd like to join them, please consider: -To continue supporting this growth, and to satisfy community expectations, -we would like to invest more time in this project. - -If you like this project and see its potential, you can help! - -Thanks, -Boostnote maintainers. - -### >> [Support via OpenCollective](https://opencollective.com/boostnoteio) +- [Become a backer or sponsor on Open Collective.](https://opencollective.com/boostnoteio) --- -## Backers -[Kazz](https://twitter.com/kazup_bot) - $65 +## Backers via OpenCollective -Intense Raiden - $45 +### [Gold Sponsors / $1,000 per month](https://opencollective.com/boostnoteio/order/2259) +- Get your logo on our Readme.md on GitHub and the frontpage of https://boostnote.io/. -ravy22 - $25 +### [Silver Sponsors / $250 per month](https://opencollective.com/boostnoteio/order/2257) +- Get your logo on our Readme.md on GitHub and the frontpage of https://boostnote.io/. -trentpolack - $20 +### [Bronze Sponsors / $50 per month](https://opencollective.com/boostnoteio/order/2258) +- Get your name and Url (or E-mail) on Readme.md on GitHub. -hikariru - $10 +### [Backers3 / $10 per month](https://opencollective.com/boostnoteio/order/2176) +- [Ralph03](https://opencollective.com/ralph03) -kolchan11 - $10 +- [Nikolas Dan](https://opencollective.com/nikolas-dan) -RonWalker22 - $10 +### [Backers2 / $5 per month](https://opencollective.com/boostnoteio/order/2175) +- [Yeojong Kim](https://twitter.com/yeojoy) -hocchuc - $5 +- [Scotia Draven](https://opencollective.com/scotia-draven) -Adam - $5 +- [A. J. Vargas](https://opencollective.com/aj-vargas) -Steve - $5 +### [Backers1](https://opencollective.com/boostnoteio/order/2563) and One-time sponsors +- Ryosuke Tamura - $30 -evmin - $5 +- tatoosh11 - $10 -[@yeojoy](https://twitter.com/yeojoy) - $5 +- Alexander Borovkov - $10 -Scotia Draven - $5 +- spoonhoop - $5 + +- Drew Williams - $2 + +- Andy Shaw - $2 + +- mysafesky -$2 + +--- + +## Backers via Bountysource +https://salt.bountysource.com/teams/boostnote + +- Kuzz - $65 + +- Intense Raiden - $45 + +- ravy22 - $25 + +- trentpolack - $20 + +- hikariru - $10 + +- kolchan11 - $10 + +- RonWalker22 - $10 + +- hocchuc - $5 + +- Adam - $5 + +- Steve - $5 + +- evmin - $5 diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 77aff3da..1323c514 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import _ from 'lodash' import CodeMirror from 'codemirror' import path from 'path' @@ -67,7 +68,7 @@ export default class CodeEditor extends React.Component { if (cm.somethingSelected()) cm.indentSelection('add') else { const tabs = cm.getOption('indentWithTabs') - if (line.trimLeft() === '- ' || line.trimLeft() === '* ' || line.trimLeft() === '+ ') { + if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)\] )?$/)) { cm.execCommand('goLineStart') if (tabs) { cm.execCommand('insertTab') @@ -103,13 +104,14 @@ export default class CodeEditor extends React.Component { this.editor.on('change', this.changeHandler) this.editor.on('paste', this.pasteHandler) - let editorTheme = document.getElementById('editorTheme') + const editorTheme = document.getElementById('editorTheme') editorTheme.addEventListener('load', this.loadStyleHandler) CodeMirror.Vim.defineEx('quit', 'q', this.quitEditor) CodeMirror.Vim.defineEx('q!', 'q!', this.quitEditor) CodeMirror.Vim.defineEx('wq', 'wq', this.quitEditor) CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor) + CodeMirror.Vim.map('ZZ', ':q', 'normal') } quitEditor () { @@ -120,7 +122,7 @@ export default class CodeEditor extends React.Component { this.editor.off('blur', this.blurHandler) this.editor.off('change', this.changeHandler) this.editor.off('paste', this.pasteHandler) - let editorTheme = document.getElementById('editorTheme') + const editorTheme = document.getElementById('editorTheme') editorTheme.removeEventListener('load', this.loadStyleHandler) } @@ -196,7 +198,7 @@ export default class CodeEditor extends React.Component { } setValue (value) { - let cursor = this.editor.getCursor() + const cursor = this.editor.getCursor() this.editor.setValue(value) this.editor.setCursor(cursor) } @@ -213,9 +215,7 @@ export default class CodeEditor extends React.Component { } insertImageMd (imageMd) { - const textarea = this.editor.getInputField() - const cm = this.editor - cm.replaceSelection(`${textarea.value.substr(0, textarea.selectionStart)}${imageMd}${textarea.value.substr(textarea.selectionEnd)}`) + this.editor.replaceSelection(imageMd) } handlePaste (editor, e) { @@ -223,7 +223,7 @@ export default class CodeEditor extends React.Component { if (!dataTransferItem.type.match('image')) return const blob = dataTransferItem.getAsFile() - let reader = new FileReader() + const reader = new FileReader() let base64data reader.readAsDataURL(blob) @@ -243,7 +243,8 @@ export default class CodeEditor extends React.Component { } render () { - let { className, fontFamily, fontSize } = this.props + const { className, fontSize } = this.props + let fontFamily = this.props.className fontFamily = _.isString(fontFamily) && fontFamily.length > 0 ? [fontFamily].concat(defaultEditorFontFamily) : defaultEditorFontFamily diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 65b52f86..d4fa6e89 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -1,11 +1,11 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './MarkdownEditor.styl' import CodeEditor from 'browser/components/CodeEditor' import MarkdownPreview from 'browser/components/MarkdownPreview' import eventEmitter from 'browser/main/lib/eventEmitter' import { findStorage } from 'browser/lib/findStorage' -const _ = require('lodash') class MarkdownEditor extends React.Component { constructor (props) { @@ -70,9 +70,9 @@ class MarkdownEditor extends React.Component { } handleContextMenu (e) { - let { config } = this.props + const { config } = this.props if (config.editor.switchPreview === 'RIGHTCLICK') { - let newStatus = this.state.status === 'PREVIEW' + const newStatus = this.state.status === 'PREVIEW' ? 'CODE' : 'PREVIEW' this.setState({ @@ -91,9 +91,9 @@ class MarkdownEditor extends React.Component { handleBlur (e) { if (this.state.isLocked) return this.setState({ keyPressed: new Set() }) - let { config } = this.props + const { config } = this.props if (config.editor.switchPreview === 'BLUR') { - let cursorPosition = this.refs.code.editor.getCursor() + const cursorPosition = this.refs.code.editor.getCursor() this.setState({ status: 'PREVIEW' }, () => { @@ -109,7 +109,7 @@ class MarkdownEditor extends React.Component { } handlePreviewMouseUp (e) { - let { config } = this.props + const { config } = this.props if (config.editor.switchPreview === 'BLUR' && new Date() - this.previewMouseDownedAt < 200) { this.setState({ status: 'CODE' @@ -123,15 +123,15 @@ class MarkdownEditor extends React.Component { handleCheckboxClick (e) { e.preventDefault() e.stopPropagation() - let idMatch = /checkbox-([0-9]+)/ - let checkedMatch = /\[x\]/i - let uncheckedMatch = /\[ \]/ + const idMatch = /checkbox-([0-9]+)/ + const checkedMatch = /\[x\]/i + const uncheckedMatch = /\[ \]/ if (idMatch.test(e.target.getAttribute('id'))) { - let lineIndex = parseInt(e.target.getAttribute('id').match(idMatch)[1], 10) - 1 - let lines = this.refs.code.value + const lineIndex = parseInt(e.target.getAttribute('id').match(idMatch)[1], 10) - 1 + const lines = this.refs.code.value .split('\n') - let targetLine = lines[lineIndex] + const targetLine = lines[lineIndex] if (targetLine.match(checkedMatch)) { lines[lineIndex] = targetLine.replace(checkedMatch, '[ ]') @@ -163,12 +163,12 @@ class MarkdownEditor extends React.Component { } handleKeyDown (e) { - let { config } = this.props + const { config } = this.props if (this.state.status !== 'CODE') return false const keyPressed = this.state.keyPressed keyPressed.add(e.keyCode) this.setState({ keyPressed }) - let isNoteHandlerKey = (el) => { return keyPressed.has(el) } + const isNoteHandlerKey = (el) => { return keyPressed.has(el) } // These conditions are for ctrl-e and ctrl-w if (keyPressed.size === this.escapeFromEditor.length && !this.state.isLocked && this.state.status === 'CODE' && @@ -207,14 +207,14 @@ class MarkdownEditor extends React.Component { } render () { - let { className, value, config, storageKey } = this.props + const { className, value, config, storageKey } = this.props let editorFontSize = parseInt(config.editor.fontSize, 10) if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14 let editorIndentSize = parseInt(config.editor.indentSize, 10) if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4 - let previewStyle = {} + const previewStyle = {} if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none' const storage = findStorage(storageKey) diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index 6f0846a6..95839ad6 100644 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import markdown from 'browser/lib/markdown' import _ from 'lodash' import CodeMirror from 'codemirror' @@ -33,6 +34,15 @@ function buildStyle (fontFamily, fontSize, codeBlockFontFamily, lineNumber) { font-weight: normal; text-rendering: optimizeLegibility; } +@font-face { + font-family: 'Lato'; + src: url('${appPath}/resources/fonts/Lato-Black.woff2') format('woff2'), /* Modern Browsers */ + url('${appPath}/resources/fonts/Lato-Black.woff') format('woff'), /* Modern Browsers */ + url('${appPath}/resources/fonts/Lato-Black.ttf') format('truetype'); + font-style: normal; + font-weight: 700; + text-rendering: optimizeLegibility; +} ${markdownStyle} body { font-family: '${fontFamily.join("','")}'; @@ -117,10 +127,10 @@ export default class MarkdownPreview extends React.Component { e.preventDefault() e.stopPropagation() - let anchor = e.target.closest('a') - let href = anchor.getAttribute('href') + const anchor = e.target.closest('a') + const href = anchor.getAttribute('href') if (_.isString(href) && href.match(/^#/)) { - let targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length)) + const targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length)) if (targetElement != null) { this.getWindow().scrollTo(0, targetElement.offsetTop) } @@ -242,7 +252,8 @@ export default class MarkdownPreview extends React.Component { } applyStyle () { - let { fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme } = this.props + const { fontSize, lineNumber, codeBlockTheme } = this.props + let { fontFamily, codeBlockFontFamily } = this.props fontFamily = _.isString(fontFamily) && fontFamily.trim().length > 0 ? [fontFamily].concat(defaultFontFamily) : defaultFontFamily @@ -258,7 +269,9 @@ export default class MarkdownPreview extends React.Component { theme = consts.THEMES.some((_theme) => _theme === theme) && theme !== 'default' ? theme : 'elegant' - this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme.split(' ')[0]}.css` + this.getWindow().document.getElementById('codeTheme').href = theme.startsWith('solarized') + ? `${appPath}/node_modules/codemirror/theme/solarized.css` + : `${appPath}/node_modules/codemirror/theme/${theme}.css` } rewriteIframe () { @@ -273,7 +286,8 @@ export default class MarkdownPreview extends React.Component { el.removeEventListener('click', this.linkClickHandler) }) - let { value, theme, indentSize, codeBlockTheme, showCopyNotification, storagePath } = this.props + const { theme, indentSize, showCopyNotification, storagePath } = this.props + let { value, codeBlockTheme } = this.props this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme) @@ -316,7 +330,7 @@ export default class MarkdownPreview extends React.Component { let syntax = CodeMirror.findModeByName(el.className) if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text') CodeMirror.requireMode(syntax.mode, () => { - let content = htmlTextHelper.decodeEntities(el.innerHTML) + const content = htmlTextHelper.decodeEntities(el.innerHTML) const copyIcon = document.createElement('i') copyIcon.innerHTML = '' copyIcon.onclick = (e) => { @@ -341,7 +355,7 @@ export default class MarkdownPreview extends React.Component { }) }) }) - let opts = {} + const opts = {} // if (this.props.theme === 'dark') { // opts['font-color'] = '#DDD' // opts['line-color'] = '#DDD' @@ -351,7 +365,7 @@ export default class MarkdownPreview extends React.Component { _.forEach(this.refs.root.contentWindow.document.querySelectorAll('.flowchart'), (el) => { Raphael.setWindow(this.getWindow()) try { - let diagram = flowchart.parse(htmlTextHelper.decodeEntities(el.innerHTML)) + const diagram = flowchart.parse(htmlTextHelper.decodeEntities(el.innerHTML)) el.innerHTML = '' diagram.drawSVG(el, opts) _.forEach(el.querySelectorAll('a'), (el) => { @@ -367,7 +381,7 @@ export default class MarkdownPreview extends React.Component { _.forEach(this.refs.root.contentWindow.document.querySelectorAll('.sequence'), (el) => { Raphael.setWindow(this.getWindow()) try { - let diagram = SequenceDiagram.parse(htmlTextHelper.decodeEntities(el.innerHTML)) + const diagram = SequenceDiagram.parse(htmlTextHelper.decodeEntities(el.innerHTML)) el.innerHTML = '' diagram.drawSVG(el, {theme: 'simple'}) _.forEach(el.querySelectorAll('a'), (el) => { @@ -390,11 +404,11 @@ export default class MarkdownPreview extends React.Component { } scrollTo (targetRow) { - let blocks = this.getWindow().document.querySelectorAll('body>[data-line]') + const blocks = this.getWindow().document.querySelectorAll('body>[data-line]') for (let index = 0; index < blocks.length; index++) { let block = blocks[index] - let row = parseInt(block.getAttribute('data-line')) + const row = parseInt(block.getAttribute('data-line')) if (row > targetRow || index === blocks.length - 1) { block = blocks[index - 1] block != null && this.getWindow().scrollTo(0, block.offsetTop) @@ -424,7 +438,7 @@ export default class MarkdownPreview extends React.Component { } render () { - let { className, style, tabIndex } = this.props + const { className, style, tabIndex } = this.props return ( \n\n## Docs :memo:\n- [Boostnote | Boost your happiness, productivity and creativity.](https://hackernoon.com/boostnote-boost-your-happiness-productivity-and-creativity-315034efeebe)\n- [Cloud Syncing & Backups](https://github.com/BoostIO/Boostnote/wiki/Cloud-Syncing-and-Backup)\n- [How to sync your data across Desktop and Mobile apps](https://github.com/BoostIO/Boostnote/wiki/Sync-Data-Across-Desktop-and-Mobile-apps)\n- [Convert data from **Evernote** to Boostnote.](https://github.com/BoostIO/Boostnote/wiki/Evernote)\n- [Keyboard Shortcuts](https://github.com/BoostIO/Boostnote/wiki/Keyboard-Shortcuts)\n- [Keymaps in Editor mode](https://github.com/BoostIO/Boostnote/wiki/Keymaps-in-Editor-mode)\n- [How to set syntax highlight in Snippet note](https://github.com/BoostIO/Boostnote/wiki/Syntax-Highlighting)\n\n---\n\n## Article Archive :books:\n- [Reddit English](http://bit.ly/2mOJPu7)\n- [Reddit Spanish](https://www.reddit.com/r/boostnote_es/)\n- [Reddit Chinese](https://www.reddit.com/r/boostnote_cn/)\n- [Reddit Japanese](https://www.reddit.com/r/boostnote_jp/)\n\n---\n\n## Community :beers:\n- [GitHub](http://bit.ly/2AWWzkD)\n- [Twitter](http://bit.ly/2z8BUJZ)\n- [Facebook Group](http://bit.ly/2jcca8t)' }) .then((note) => { store.dispatch({ @@ -184,6 +184,12 @@ class InitModal extends React.Component { }) } + handleKeyDown (e) { + if (e.keyCode === 27) { + this.props.close() + } + } + render () { if (this.state.isLoading) { return
@@ -194,7 +200,7 @@ class InitModal extends React.Component { return (
this.handleKeyDown(e)} >
diff --git a/browser/main/modals/NewNoteModal.js b/browser/main/modals/NewNoteModal.js index 4e794832..346fe920 100644 --- a/browser/main/modals/NewNoteModal.js +++ b/browser/main/modals/NewNoteModal.js @@ -26,7 +26,7 @@ class NewNoteModal extends React.Component { handleMarkdownNoteButtonClick (e) { AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_MARKDOWN') AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE') - let { storage, folder, dispatch, location } = this.props + const { storage, folder, dispatch, location } = this.props dataApi .createNote(storage, { type: 'MARKDOWN_NOTE', @@ -58,7 +58,7 @@ class NewNoteModal extends React.Component { handleSnippetNoteButtonClick (e) { AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_SNIPPET') AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_ALLNOTE') - let { storage, folder, dispatch, location } = this.props + const { storage, folder, dispatch, location } = this.props dataApi .createNote(storage, { diff --git a/browser/main/modals/PreferencesModal/FolderItem.js b/browser/main/modals/PreferencesModal/FolderItem.js index 5bd9d9f1..9d1cd08f 100644 --- a/browser/main/modals/PreferencesModal/FolderItem.js +++ b/browser/main/modals/PreferencesModal/FolderItem.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import ReactDOM from 'react-dom' import styles from './FolderItem.styl' @@ -23,7 +24,7 @@ class FolderItem extends React.Component { } handleEditChange (e) { - let { folder } = this.state + const { folder } = this.state folder.name = this.refs.nameInput.value this.setState({ @@ -36,7 +37,7 @@ class FolderItem extends React.Component { } confirm () { - let { storage, folder } = this.props + const { storage, folder } = this.props dataApi .updateFolder(storage.key, folder.key, { color: this.state.folder.color, @@ -162,7 +163,7 @@ class FolderItem extends React.Component { } handleDeleteConfirmButtonClick (e) { - let { storage, folder } = this.props + const { storage, folder } = this.props dataApi .deleteFolder(storage.key, folder.key) .then((data) => { @@ -197,8 +198,8 @@ class FolderItem extends React.Component { } handleEditButtonClick (e) { - let { folder: propsFolder } = this.props - let { folder: stateFolder } = this.state + const { folder: propsFolder } = this.props + const { folder: stateFolder } = this.state const folder = Object.assign({}, stateFolder, propsFolder) this.setState({ status: 'EDIT', @@ -215,7 +216,7 @@ class FolderItem extends React.Component { } renderIdle () { - let { folder } = this.props + const { folder } = this.props return (
this.handleEditButtonClick(e)} diff --git a/browser/main/modals/PreferencesModal/FolderList.js b/browser/main/modals/PreferencesModal/FolderList.js index 0172dc10..8585f641 100644 --- a/browser/main/modals/PreferencesModal/FolderList.js +++ b/browser/main/modals/PreferencesModal/FolderList.js @@ -1,16 +1,17 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import dataApi from 'browser/main/lib/dataApi' import styles from './FolderList.styl' import store from 'browser/main/store' import FolderItem from './FolderItem' -import { SortableContainer, arrayMove } from 'react-sortable-hoc' +import { SortableContainer } from 'react-sortable-hoc' class FolderList extends React.Component { render () { - let { storage, hostBoundingBox } = this.props + const { storage, hostBoundingBox } = this.props - let folderList = storage.folders.map((folder, index) => { + const folderList = storage.folders.map((folder, index) => { return { - let { storage } = this.props + const { storage } = this.props dataApi .reorderFolder(storage.key, oldIndex, newIndex) .then((data) => { diff --git a/browser/main/modals/PreferencesModal/HotkeyTab.js b/browser/main/modals/PreferencesModal/HotkeyTab.js index 18ac31ff..9a15e79f 100644 --- a/browser/main/modals/PreferencesModal/HotkeyTab.js +++ b/browser/main/modals/PreferencesModal/HotkeyTab.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './ConfigTab.styl' import ConfigManager from 'browser/main/lib/ConfigManager' @@ -41,7 +42,7 @@ class HotkeyTab extends React.Component { } handleSaveButtonClick (e) { - let newConfig = { + const newConfig = { hotkey: this.state.config.hotkey } @@ -61,7 +62,7 @@ class HotkeyTab extends React.Component { } handleHotkeyChange (e) { - let { config } = this.state + const { config } = this.state config.hotkey = { toggleFinder: this.refs.toggleFinder.value, toggleMain: this.refs.toggleMain.value @@ -80,13 +81,13 @@ class HotkeyTab extends React.Component { } render () { - let keymapAlert = this.state.keymapAlert - let keymapAlertElement = keymapAlert != null + const keymapAlert = this.state.keymapAlert + const keymapAlertElement = keymapAlert != null ?

{keymapAlert.message}

: null - let { config } = this.state + const { config } = this.state return (
diff --git a/browser/main/modals/PreferencesModal/InfoTab.js b/browser/main/modals/PreferencesModal/InfoTab.js index 8503cdae..a3c64b35 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.js +++ b/browser/main/modals/PreferencesModal/InfoTab.js @@ -68,7 +68,41 @@ class InfoTab extends React.Component { render () { return (
-
Info
+ +
Community
+ + +
+ +
Info
@@ -81,31 +115,17 @@ class InfoTab extends React.Component {
+ -
+ +
+
Data collection policy
We collect only the number of DAU for Boostnote and **DO NOT collect** any detail information such as your note content.
You can see how it works on this.handleLinkClick(e)}>GitHub.
diff --git a/browser/main/modals/PreferencesModal/InfoTab.styl b/browser/main/modals/PreferencesModal/InfoTab.styl index cefb3abc..4e632682 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.styl +++ b/browser/main/modals/PreferencesModal/InfoTab.styl @@ -42,6 +42,9 @@ color #4E8EC6 text-decoration none +.separate-line + margin 40px 0 + .policy width 100% font-size 20px diff --git a/browser/main/modals/PreferencesModal/StorageItem.js b/browser/main/modals/PreferencesModal/StorageItem.js index 478e4c44..f2092835 100644 --- a/browser/main/modals/PreferencesModal/StorageItem.js +++ b/browser/main/modals/PreferencesModal/StorageItem.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './StorageItem.styl' import consts from 'browser/lib/consts' @@ -19,8 +20,8 @@ class StorageItem extends React.Component { } handleNewFolderButtonClick (e) { - let { storage } = this.props - let input = { + const { storage } = this.props + const input = { name: 'Untitled', color: consts.FOLDER_COLORS[Math.floor(Math.random() * 7) % 7] } @@ -38,12 +39,12 @@ class StorageItem extends React.Component { } handleExternalButtonClick () { - let { storage } = this.props + const { storage } = this.props shell.showItemInFolder(storage.path) } handleUnlinkButtonClick (e) { - let index = dialog.showMessageBox(remote.getCurrentWindow(), { + const index = dialog.showMessageBox(remote.getCurrentWindow(), { type: 'warning', message: 'Unlink Storage', detail: 'Unlinking removes this linked storage from Boostnote. No data is removed, please manually delete the folder from your hard drive if needed.', @@ -51,7 +52,7 @@ class StorageItem extends React.Component { }) if (index === 0) { - let { storage } = this.props + const { storage } = this.props dataApi.removeStorage(storage.key) .then(() => { store.dispatch({ @@ -66,7 +67,7 @@ class StorageItem extends React.Component { } handleLabelClick (e) { - let { storage } = this.props + const { storage } = this.props this.setState({ isLabelEditing: true, name: storage.name @@ -81,7 +82,7 @@ class StorageItem extends React.Component { } handleLabelBlur (e) { - let { storage } = this.props + const { storage } = this.props dataApi .renameStorage(storage.key, this.state.name) .then((_storage) => { @@ -96,7 +97,7 @@ class StorageItem extends React.Component { } render () { - let { storage, hostBoundingBox } = this.props + const { storage, hostBoundingBox } = this.props return (
diff --git a/browser/main/modals/PreferencesModal/StoragesTab.js b/browser/main/modals/PreferencesModal/StoragesTab.js index 641e5e8c..e33bb0fd 100644 --- a/browser/main/modals/PreferencesModal/StoragesTab.js +++ b/browser/main/modals/PreferencesModal/StoragesTab.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './StoragesTab.styl' import dataApi from 'browser/main/lib/dataApi' @@ -8,9 +9,9 @@ const electron = require('electron') const { shell, remote } = electron function browseFolder () { - let dialog = remote.dialog + const dialog = remote.dialog - let defaultPath = remote.app.getPath('home') + const defaultPath = remote.app.getPath('home') return new Promise((resolve, reject) => { dialog.showOpenDialog({ title: 'Select Directory', @@ -56,10 +57,10 @@ class StoragesTab extends React.Component { } renderList () { - let { data, boundingBox } = this.props + const { data, boundingBox } = this.props if (!boundingBox) { return null } - let storageList = data.storageMap.map((storage) => { + const storageList = data.storageMap.map((storage) => { return { if (targetPath.length > 0) { - let { newStorage } = this.state + const { newStorage } = this.state newStorage.path = targetPath this.setState({ newStorage @@ -102,7 +103,7 @@ class StoragesTab extends React.Component { } handleAddStorageChange (e) { - let { newStorage } = this.state + const { newStorage } = this.state newStorage.name = this.refs.addStorageName.value newStorage.path = this.refs.addStoragePath.value this.setState({ @@ -117,7 +118,7 @@ class StoragesTab extends React.Component { path: this.state.newStorage.path }) .then((data) => { - let { dispatch } = this.props + const { dispatch } = this.props dispatch({ type: 'ADD_STORAGE', storage: data.storage, diff --git a/browser/main/modals/PreferencesModal/Tab.styl b/browser/main/modals/PreferencesModal/Tab.styl index 3b722cbf..e5fc48da 100644 --- a/browser/main/modals/PreferencesModal/Tab.styl +++ b/browser/main/modals/PreferencesModal/Tab.styl @@ -13,6 +13,10 @@ $tab--dark-text-color = #E5E5E5 font-size 36px margin-bottom 60px +.header--sub + font-size 36px + margin-bottom 20px + body[data-theme="dark"] .header color $tab--dark-text-color diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index af120b94..eebb2e0c 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import CSSModules from 'browser/lib/CSSModules' import styles from './ConfigTab.styl' import ConfigManager from 'browser/main/lib/ConfigManager' @@ -119,8 +120,8 @@ class UiTab extends React.Component { } render () { - let UiAlert = this.state.UiAlert - let UiAlertElement = UiAlert != null + const UiAlert = this.state.UiAlert + const UiAlertElement = UiAlert != null ?

{UiAlert.message}

@@ -141,7 +142,8 @@ class UiTab extends React.Component { onChange={(e) => this.handleUIChange(e)} ref='uiTheme' > - + +
diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index c47b2754..2fff0364 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react' +import PropTypes from 'prop-types' +import React from 'react' import ReactDOM from 'react-dom' import { connect } from 'react-redux' import HotkeyTab from './HotkeyTab' @@ -42,7 +43,7 @@ class Preferences extends React.Component { renderContent () { const { boundingBox } = this.state - let { dispatch, config, data } = this.props + const { dispatch, config, data } = this.props switch (this.state.currentTab) { case 'INFO': @@ -94,18 +95,18 @@ class Preferences extends React.Component { } render () { - let content = this.renderContent() + const content = this.renderContent() - let tabs = [ + const tabs = [ {target: 'STORAGES', label: 'Storages'}, {target: 'HOTKEY', label: 'Hotkey'}, {target: 'UI', label: 'UI'}, - {target: 'INFO', label: 'Info'}, + {target: 'INFO', label: 'Community / Info'}, {target: 'CROWDFUNDING', label: 'Crowdfunding'} ] - let navButtons = tabs.map((tab) => { - let isActive = this.state.currentTab === tab.target + const navButtons = tabs.map((tab) => { + const isActive = this.state.currentTab === tab.target return (