From c7ad06a1f72d6d2098ea6d2f477c1f9a96b1af18 Mon Sep 17 00:00:00 2001 From: Dick Choi Date: Wed, 25 May 2016 02:16:22 +0900 Subject: [PATCH] Update NoteList redirect if no note selected add overflow style of labels in Note item --- browser/main/NoteList/NoteList.styl | 5 ++++- browser/main/NoteList/index.js | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/browser/main/NoteList/NoteList.styl b/browser/main/NoteList/NoteList.styl index 26f3a603..dd4043c6 100644 --- a/browser/main/NoteList/NoteList.styl +++ b/browser/main/NoteList/NoteList.styl @@ -13,7 +13,7 @@ cursor pointer transition background-color 0.15s &:hover - background-color alpha(black, 5%) + background-color alpha($ui-active-color, 10%) .item--active @extend .item @@ -33,9 +33,11 @@ font-size 12px color $ui-inactive-text-color line-height 30px + overflow-y hidden .item-info-left float left + overflow ellipsis .item-info-right float right @@ -52,3 +54,4 @@ font-size 12px line-height 30px color $ui-inactive-text-color + overflow ellipsis diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index eb328e4c..a4896d47 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -29,6 +29,16 @@ class NoteList extends React.Component { } componentDidUpdate () { + let { location } = this.props + if (this.notes.length > 0 && location.query.key == null) { + let { router } = this.context + router.replace({ + pathname: location.pathname, + query: { + key: `${this.notes[0]._repository.key}-${this.notes[0].key}` + } + }) + } // return false // var index = articles.indexOf(null) // var el = ReactDOM.findDOMNode(this) @@ -175,13 +185,13 @@ class NoteList extends React.Component { render () { let { location } = this.props - let notes = this.getNotes() + let notes = this.notes = this.getNotes() let noteElements = notes.map((note) => { let folder = _.find(note._repository.folders, {key: note.folder}) let tagElements = note.tags.map((tag) => { return {tag} }) - let key = `${note._repository.key}/${note.key}` + let key = `${note._repository.key}-${note.key}` let isActive = location.query.key === key return (