diff --git a/atom-lib/finder-window.js b/atom-lib/finder-window.js
index 1038456a..529f33a2 100644
--- a/atom-lib/finder-window.js
+++ b/atom-lib/finder-window.js
@@ -1,7 +1,8 @@
var BrowserWindow = require('browser-window')
+var path = require('path')
var finderWindow = new BrowserWindow({
- width: 600,
+ width: 640,
height: 400,
show: false,
frame: false,
@@ -15,7 +16,9 @@ var finderWindow = new BrowserWindow({
'standard-window': false
})
-finderWindow.loadUrl('file://' + __dirname + '/browser/finder/index.html')
+var url = path.resolve(__dirname, '../browser/finder/index.html')
+
+finderWindow.loadUrl('file://' + url)
finderWindow.on('blur', function () {
finderWindow.hide()
diff --git a/browser/finder/Components/FinderDetail.jsx b/browser/finder/Components/FinderDetail.jsx
deleted file mode 100644
index 3be69f21..00000000
--- a/browser/finder/Components/FinderDetail.jsx
+++ /dev/null
@@ -1,42 +0,0 @@
-var React = require('react')
-
-var CodeViewer = require('../../main/Components/CodeViewer')
-
-var MarkdownPreview = require('../../main/Components/MarkdownPreview')
-
-module.exports = React.createClass({
- propTypes: {
- currentArticle: React.PropTypes.object
- },
- render: function () {
- var article = this.props.currentArticle
-
- if (article != null) {
- if (article.type === 'code') {
- return (
-
-
{article.description}
-
-
-
-
- )
- } else if (article.type === 'note') {
-
- return (
-
-
{article.title}
-
-
-
-
- )
- }
- }
- return (
-
- )
- }
-})
diff --git a/browser/finder/Components/FinderInput.jsx b/browser/finder/Components/FinderInput.jsx
deleted file mode 100644
index 893265c1..00000000
--- a/browser/finder/Components/FinderInput.jsx
+++ /dev/null
@@ -1,15 +0,0 @@
-var React = require('react')
-
-module.exports = React.createClass({
- propTypes: {
- onChange: React.PropTypes.func,
- search: React.PropTypes.string
- },
- render: function () {
- return (
-
-
-
- )
- }
-})
diff --git a/browser/finder/Components/FinderList.jsx b/browser/finder/Components/FinderList.jsx
deleted file mode 100644
index cd704274..00000000
--- a/browser/finder/Components/FinderList.jsx
+++ /dev/null
@@ -1,79 +0,0 @@
-var React = require('react')
-
-module.exports = React.createClass({
- propTypes: {
- articles: React.PropTypes.arrayOf,
- currentArticle: React.PropTypes.shape({
- id: React.PropTypes.number,
- type: React.PropTypes.string
- }),
- selectArticle: React.PropTypes.func
- },
- componentDidUpdate: function () {
- var index = this.props.articles.indexOf(this.props.currentArticle)
- var el = React.findDOMNode(this)
- var li = el.querySelectorAll('li')[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
- }
- },
- handleArticleClick: function (article) {
- return function () {
- this.props.selectArticle(article)
- }.bind(this)
- },
- render: function () {
- var list = this.props.articles.map(function (article) {
- if (article == null) {
- return (
-
- Undefined
-
-
- )
- }
-
- var isActive = this.props.currentArticle != null && (article.type === this.props.currentArticle.type && article.id === this.props.currentArticle.id)
- if (article.type === 'code') {
- return (
-
- {article.description}
-
-
- )
- }
- if (article.type === 'note') {
- return (
-
- {article.title}
-
-
- )
- }
- return (
-
- Undefined
-
-
- )
- }.bind(this))
-
- return (
-
- )
- }
-})
diff --git a/browser/finder/FinderDetail.js b/browser/finder/FinderDetail.js
new file mode 100644
index 00000000..b50392fa
--- /dev/null
+++ b/browser/finder/FinderDetail.js
@@ -0,0 +1,34 @@
+import React, { PropTypes } from 'react'
+import CodeEditor from 'boost/components/CodeEditor'
+import MarkdownPreview from 'boost/components/MarkdownPreview'
+import ModeIcon from 'boost/components/ModeIcon'
+
+export default class FinderDetail extends React.Component {
+ render () {
+ let { activeArticle } = this.props
+
+ if (activeArticle != null) {
+ return (
+
+
+ {activeArticle.title}
+
+ {activeArticle.mode === 'markdown'
+ ?
+ :
+ }
+
+
+ )
+ }
+ return (
+
+ )
+ }
+}
+
+FinderDetail.propTypes = {
+ activeArticle: PropTypes.shape()
+}
diff --git a/browser/finder/FinderInput.js b/browser/finder/FinderInput.js
new file mode 100644
index 00000000..d23fa98d
--- /dev/null
+++ b/browser/finder/FinderInput.js
@@ -0,0 +1,16 @@
+import React, { PropTypes } from 'react'
+
+export default class FinderInput extends React.Component {
+ render () {
+ return (
+
+
+
+ )
+ }
+}
+
+FinderInput.propTypes = {
+ handleSearchChange: PropTypes.func,
+ value: PropTypes.string
+}
diff --git a/browser/finder/FinderList.js b/browser/finder/FinderList.js
new file mode 100644
index 00000000..1833ee4a
--- /dev/null
+++ b/browser/finder/FinderList.js
@@ -0,0 +1,71 @@
+import React, { PropTypes } from 'react'
+import ReactDOM from 'react-dom'
+import ModeIcon from 'boost/components/ModeIcon'
+import { selectArticle } from './actions'
+
+export default class FinderList extends React.Component {
+ componentDidUpdate () {
+ var index = this.props.articles.indexOf(this.props.activeArticle)
+ var el = ReactDOM.findDOMNode(this)
+ var li = el.querySelectorAll('li')[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
+ }
+ }
+
+ handleArticleClick (article) {
+ return (e) => {
+ let { dispatch } = this.props
+ dispatch(selectArticle(article.key))
+ }
+ }
+
+ render () {
+ let articleElements = this.props.articles.map(function (article) {
+ if (article == null) {
+ return (
+
+ Undefined
+
+
+ )
+ }
+
+ var isActive = this.props.activeArticle != null && (article.key === this.props.activeArticle.key)
+ return (
+
+
+ {article.title}
+
+
+ )
+ }.bind(this))
+
+ return (
+
+ )
+ }
+}
+
+FinderList.propTypes = {
+ articles: PropTypes.array,
+ activeArticle: PropTypes.shape({
+ type: PropTypes.string,
+ key: PropTypes.string
+ }),
+ dispatch: PropTypes.func
+}
diff --git a/browser/finder/actions.js b/browser/finder/actions.js
new file mode 100644
index 00000000..616d7953
--- /dev/null
+++ b/browser/finder/actions.js
@@ -0,0 +1,33 @@
+export const SELECT_ARTICLE = 'SELECT_ARTICLE'
+export const SEARCH_ARTICLE = 'SEARCH_ARTICLE'
+export const REFRESH_DATA = 'REFRESH_DATA'
+
+export function selectArticle (key) {
+ return {
+ type: SELECT_ARTICLE,
+ data: { key }
+ }
+}
+
+export function searchArticle (input) {
+ return {
+ type: SEARCH_ARTICLE,
+ data: { input }
+ }
+}
+
+export function refreshData () {
+ console.log('refreshing data')
+ let data = JSON.parse(localStorage.getItem('local'))
+ if (data == null) return null
+
+ let { folders, articles } = data
+
+ return {
+ type: REFRESH_DATA,
+ data: {
+ articles,
+ folders
+ }
+ }
+}
diff --git a/browser/finder/index.html b/browser/finder/index.html
index c8ac50d1..8deba929 100644
--- a/browser/finder/index.html
+++ b/browser/finder/index.html
@@ -6,8 +6,11 @@
-
+
+
+
+
-
-
+