Remove navItems and navigation related functionality
This functionality is now in reducers/navigation which makes the code cleaner.
This commit is contained in:
parent
3f5440ab16
commit
83e9d04ba5
1 changed files with 0 additions and 70 deletions
|
|
@ -51,83 +51,13 @@ export default class LibraryNav extends React.Component {
|
|||
this.state = {
|
||||
open: true,
|
||||
}
|
||||
this.navItems = [
|
||||
{
|
||||
'name': 'Entries',
|
||||
'isNotebook': true,
|
||||
'icon': <img src="images/note.svg"/>,
|
||||
'clicked': this.props.entriesTapped || this.entriesTapped
|
||||
},
|
||||
{
|
||||
'name': 'Starred',
|
||||
'notes': 0,
|
||||
'icon': <ActionGrade color={colors.amberA700}/>,
|
||||
'clicked': this.props.starredTapped || this.starredTapped
|
||||
},
|
||||
{
|
||||
'name': 'Recents',
|
||||
'notes': 0,
|
||||
'icon': <History color="#4BAE4E"/>,
|
||||
'clicked': this.props.recentsTapped || this.recentsTapped
|
||||
},
|
||||
{
|
||||
'name': 'Trash',
|
||||
'isNotebook': true,
|
||||
'icon': <Delete color={colors.grey500}/>,
|
||||
'clicked': this.props.trashTapped || this.trashTapped
|
||||
},
|
||||
{
|
||||
'name': 'All Notes',
|
||||
'notes': 0,
|
||||
'glob': '*.qvnotebook/*.qvnote',
|
||||
'icon': <Folder color="#FFCC5F" />,
|
||||
'clicked': this.props.allNotesTapped || this.allNotesTapped
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
this.loadDefaultNotebooks()
|
||||
this.getNotebooks()
|
||||
|
||||
const { store } = this.context
|
||||
store.subscribe(this.stateChanged)
|
||||
}
|
||||
|
||||
loadDefaultNotebooks = () => {
|
||||
var notebooks = this.navItems
|
||||
for(var i=0; i<notebooks.length; i++){
|
||||
var nb = notebooks[i]
|
||||
if(nb.isNotebook){
|
||||
var temp = {
|
||||
title: nb.name,
|
||||
uuid: nb.name,
|
||||
notes: 0
|
||||
}
|
||||
|
||||
this.initDefaultNotebookPath(temp)
|
||||
|
||||
var loaded = utils.loadNotebookByName(nb.name)
|
||||
|
||||
nb.title = loaded.title
|
||||
nb.uuid = loaded.uuid
|
||||
nb.path = loaded.path
|
||||
nb.notes = loaded.notes
|
||||
}
|
||||
else if(nb.glob){
|
||||
var dataPath = utils.getAppDataPath()
|
||||
var notes = glob.sync(path.join(dataPath, nb.glob))
|
||||
|
||||
nb.title = nb.name
|
||||
nb.uuid = nb.name
|
||||
nb.notes = notes.length
|
||||
}
|
||||
if(i==0){
|
||||
this.props.updateSelection(nb)
|
||||
}
|
||||
this.props.addMenuItem(nb)
|
||||
}
|
||||
};
|
||||
|
||||
getNotebooks = () => {
|
||||
var dataPath = utils.getAppDataPath()
|
||||
var notebooks = glob.sync(path.join(dataPath, '!(Entries|Trash).qvnotebook'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue