mirror of
https://github.com/BoostIo/Boostnote
synced 2026-02-18 02:11:01 +00:00
add only unsaved filter
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { PropTypes } from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import ExternalLink from 'browser/components/ExternalLink'
|
||||
import { setSearchFilter, clearSearch, toggleTutorial } from '../actions'
|
||||
import { setSearchFilter, clearSearch, toggleOnlyUnsavedFilter, toggleTutorial } from '../actions'
|
||||
|
||||
const BRAND_COLOR = '#18AF90'
|
||||
|
||||
@@ -105,8 +105,15 @@ export default class ArticleTopBar extends React.Component {
|
||||
this.focusInput()
|
||||
}
|
||||
|
||||
handleOnlyUnsavedChange (e) {
|
||||
let { dispatch } = this.props
|
||||
|
||||
dispatch(toggleOnlyUnsavedFilter())
|
||||
}
|
||||
|
||||
handleTutorialButtonClick (e) {
|
||||
let { dispatch } = this.props
|
||||
console.log(e.target.value)
|
||||
|
||||
dispatch(toggleTutorial())
|
||||
}
|
||||
@@ -142,7 +149,7 @@ export default class ArticleTopBar extends React.Component {
|
||||
</div>
|
||||
|
||||
{status.isTutorialOpen ? searchTutorialElement : null}
|
||||
|
||||
<label className='only-unsaved'><input value={status.onlyUnsaved} onChange={e => this.handleOnlyUnsavedChange(e)} type='checkbox'/> only unsaved</label>
|
||||
</div>
|
||||
<div className='right'>
|
||||
<button onClick={e => this.handleTutorialButtonClick(e)}>?<span className='tooltip'>How to use</span>
|
||||
|
||||
@@ -144,6 +144,10 @@ function remap (state) {
|
||||
let articles = _articles != null ? _articles.data : []
|
||||
let modified = _articles != null ? _articles.modified : []
|
||||
|
||||
if (state.status.onlyUnsaved) {
|
||||
articles = modified.map(modifiedArticle => _.findWhere(articles, {key: modifiedArticle.key}))
|
||||
}
|
||||
|
||||
articles.sort((a, b) => {
|
||||
return new Date(b.updatedAt) - new Date(a.updatedAt)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user