diff --git a/app/reducers/navigation.jsx b/app/reducers/navigation.jsx index 704f42c..198b435 100644 --- a/app/reducers/navigation.jsx +++ b/app/reducers/navigation.jsx @@ -12,26 +12,124 @@ import { REFRESH } from '../constants/navigation' +import React from 'react' +import Styles from 'material-ui/lib/styles' +import ActionGrade from 'material-ui/lib/svg-icons/action/grade' +import History from 'material-ui/lib/svg-icons/action/history' +import Folder from 'material-ui/lib/svg-icons/file/folder' +import Delete from 'material-ui/lib/svg-icons/action/delete' + import * as utils from '../utils' import glob from 'glob' import jsfile from 'jsonfile' import path from 'path-extra' +import mkdirp from 'mkdirp' -// Load default selection -utils.createNotebookDir('Entries') +const Colors = Styles.Colors -const initialState = -{ - selection: utils.loadNotebookByName('Entries'), - selectionIndex: 0, - selectionType: MENU_TYPE, - menuItems: [], - notebooks: [], - callback: () => {} -} +const initialState = getInitialState() var emptyFunc = () => {} +function initDefaultNotebookPath(notebook){ + var nbPath = utils.getNotebookPath(notebook) + var dir = mkdirp.sync(nbPath) + + var notePath = utils.getNotebookPath(notebook) + + var meta = { + 'name': notebook.title, + 'uuid': notebook.uuid + } + + var metaPath = path.join(nbPath, 'meta.json') + jsfile.writeFileSync(metaPath, meta) + +} + +function getInitialState(){ + var menuItems = [ + { + 'name': 'Entries', + 'isNotebook': true, + 'icon': , + }, + { + 'name': 'Starred', + 'notes': 0, + 'icon': , + }, + { + 'name': 'Recents', + 'notes': 0, + 'icon': , + 'glob': '*.qvnotebook/*.qvnote', + 'filter': (notes) => { + // Get the 10 most recent notes + notes.sort(utils.compareNotes()) + return notes.slice(0, 10) + } + }, + { + 'name': 'Trash', + 'isNotebook': true, + 'icon': , + }, + { + 'name': 'All Notes', + 'notes': 0, + 'glob': '*.qvnotebook/*.qvnote', + 'icon': , + } + + ] + + for(var i=0; i {} + } + + return state +} + + function findIndexGeneric(array, notebook, type){ for(var i=0; i