1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

Add storage labels to 'All Notes'

Added storage labelings to 'All Notes' in Default and Compressed views
This commit is contained in:
pfftdammitchris
2018-02-19 10:17:36 -08:00
parent 46a733ba5b
commit 129ef6766b
5 changed files with 96 additions and 32 deletions

View File

@@ -46,7 +46,17 @@ const TagElementList = (tags) => {
* @param {Function} handleDragStart * @param {Function} handleDragStart
* @param {string} dateDisplay * @param {string} dateDisplay
*/ */
const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteContextMenu, handleDragStart, pathname }) => ( const NoteItem = ({
isActive,
isAllNotesView,
note,
dateDisplay,
handleNoteClick,
handleNoteContextMenu,
handleDragStart,
pathname,
storage
}) => (
<div styleName={isActive <div styleName={isActive
? 'item--active' ? 'item--active'
: 'item' : 'item'
@@ -68,24 +78,35 @@ const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteCont
: <span styleName='item-title-empty'>Empty</span> : <span styleName='item-title-empty'>Empty</span>
} }
</div> </div>
{isAllNotesView && <div styleName='item-middle'>
<div styleName='item-middle-time'>{dateDisplay}</div>
<div styleName='item-middle-app-meta'>
<div style={{display: 'inline-block'}}>
<span styleName='item-middle-app-meta-label'>
{storage.name}
</span>
</div>
</div>
</div>}
<div styleName='item-bottom-time'>{dateDisplay}</div> <div styleName='item-bottom'>
<div styleName='item-bottom-tagList'>
{note.tags.length > 0
? TagElementList(note.tags)
: <span style={{ fontStyle: 'italic', opacity: 0.5 }} styleName='item-bottom-tagList-empty'>No tags</span>
}
</div>
<div>
{note.isStarred {note.isStarred
? <img styleName='item-star' src='../resources/icon/icon-starred.svg' /> : '' ? <img styleName='item-star' src='../resources/icon/icon-starred.svg' /> : ''
} }
{note.isPinned && !pathname.match(/\/starred|\/trash/) {note.isPinned && !pathname.match(/\/home|\/starred|\/trash/)
? <i styleName='item-pin' className='fa fa-thumb-tack' /> : '' ? <i styleName='item-pin' className='fa fa-thumb-tack' /> : ''
} }
{note.type === 'MARKDOWN_NOTE' {note.type === 'MARKDOWN_NOTE'
? <TodoProcess todoStatus={getTodoStatus(note.content)} /> ? <TodoProcess todoStatus={getTodoStatus(note.content)} />
: '' : ''
} }
<div styleName='item-bottom'>
<div styleName='item-bottom-tagList'>
{note.tags.length > 0
? TagElementList(note.tags)
: <span styleName='item-bottom-tagList-empty' />
}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -90,6 +90,25 @@ $control-height = 30px
font-weight normal font-weight normal
color $ui-inactive-text-color color $ui-inactive-text-color
.item-middle
font-size 13px
padding-left 2px
padding-bottom 2px
.item-middle-time
color $ui-inactive-text-color
display inline-block
.item-middle-app-meta
display inline-block
float right
opacity 0.8
.item-middle-app-meta-label
color $ui-inactive-text-color
opacity 0.6
padding 0 3px
.item-bottom .item-bottom
position relative position relative
bottom 0px bottom 0px
@@ -124,9 +143,7 @@ $control-height = 30px
padding-bottom 2px padding-bottom 2px
.item-star .item-star
position absolute position relative
right -6px
bottom 23px
width 16px width 16px
height 16px height 16px
color alpha($ui-favorite-star-button-color, 60%) color alpha($ui-favorite-star-button-color, 60%)
@@ -135,9 +152,7 @@ $control-height = 30px
border-radius 17px border-radius 17px
.item-pin .item-pin
position absolute position relative
right 0px
bottom 2px
width 34px width 34px
height 34px height 34px
color #E54D42 color #E54D42

View File

@@ -14,7 +14,16 @@ import styles from './NoteItemSimple.styl'
* @param {Function} handleNoteContextMenu * @param {Function} handleNoteContextMenu
* @param {Function} handleDragStart * @param {Function} handleDragStart
*/ */
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart, pathname }) => ( const NoteItemSimple = ({
isActive,
isAllNotesView,
note,
handleNoteClick,
handleNoteContextMenu,
handleDragStart,
pathname,
storage
}) => (
<div styleName={isActive <div styleName={isActive
? 'item-simple--active' ? 'item-simple--active'
: 'item-simple' : 'item-simple'
@@ -38,6 +47,11 @@ const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu
? note.title ? note.title
: <span styleName='item-simple-title-empty'>Empty</span> : <span styleName='item-simple-title-empty'>Empty</span>
} }
{isAllNotesView && <div styleName='item-simple-right'>
<span styleName='item-simple-right-storageName'>
{storage.name}
</span>
</div>}
</div> </div>
</div> </div>
) )

View File

@@ -207,3 +207,8 @@ body[data-theme="solarized-dark"]
color #c0392b color #c0392b
.item-simple-bottom-tagList-item .item-simple-bottom-tagList-item
background-color alpha(#fff, 20%) background-color alpha(#fff, 20%)
.item-simple-right
float right
.item-simple-right-storageName
padding-left 4px
opacity 0.4

View File

@@ -66,6 +66,7 @@ class NoteList extends React.Component {
this.deleteNote = this.deleteNote.bind(this) this.deleteNote = this.deleteNote.bind(this)
this.focusNote = this.focusNote.bind(this) this.focusNote = this.focusNote.bind(this)
this.pinToTop = this.pinToTop.bind(this) this.pinToTop = this.pinToTop.bind(this)
this.getNoteStorage = this.getNoteStorage.bind(this)
// TODO: not Selected noteKeys but SelectedNote(for reusing) // TODO: not Selected noteKeys but SelectedNote(for reusing)
this.state = { this.state = {
@@ -691,6 +692,10 @@ class NoteList extends React.Component {
}) })
} }
getNoteStorage (note) { // note.storage = storage key
return this.props.data.storageMap.toJS()[note.storage]
}
render () { render () {
const { location, config } = this.props const { location, config } = this.props
let { notes } = this.props let { notes } = this.props
@@ -745,6 +750,7 @@ class NoteList extends React.Component {
return ( return (
<NoteItem <NoteItem
isActive={isActive} isActive={isActive}
isAllNotesView={location.pathname === '/home'}
note={note} note={note}
dateDisplay={dateDisplay} dateDisplay={dateDisplay}
key={uniqueKey} key={uniqueKey}
@@ -752,6 +758,7 @@ class NoteList extends React.Component {
handleNoteClick={this.handleNoteClick.bind(this)} handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)} handleDragStart={this.handleDragStart.bind(this)}
pathname={location.pathname} pathname={location.pathname}
storage={this.getNoteStorage(note)}
/> />
) )
} }
@@ -759,12 +766,14 @@ class NoteList extends React.Component {
return ( return (
<NoteItemSimple <NoteItemSimple
isActive={isActive} isActive={isActive}
isAllNotesView={location.pathname === '/home'}
note={note} note={note}
key={uniqueKey} key={uniqueKey}
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)} handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
handleNoteClick={this.handleNoteClick.bind(this)} handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)} handleDragStart={this.handleDragStart.bind(this)}
pathname={location.pathname} pathname={location.pathname}
storage={this.getNoteStorage(note)}
/> />
) )
}) })