Skip to content

Commit

Permalink
Display news item count in stash view
Browse files Browse the repository at this point in the history
  • Loading branch information
penguwin authored and meowgorithm committed Nov 17, 2020
1 parent 7fb4a43 commit 4782b99
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ui/stash.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,10 @@ func stashHeaderView(m stashModel) string {

localItems := m.countMarkdowns(localMarkdown)
stashedItems := m.countMarkdowns(stashedMarkdown) + m.countMarkdowns(convertedMarkdown)
newsItems := m.countMarkdowns(newsMarkdown)

// Loading's finished and all we have is news.
if !loading && localItems == 0 && stashedItems == 0 {
if !loading && localItems == 0 && stashedItems == 0 && newsItems == 0 {
if m.stashedOnly() {
return common.Subtle("No stashed markdown files found.") + maybeOffline
} else {
Expand All @@ -874,6 +875,18 @@ func stashHeaderView(m stashModel) string {
si := common.Subtle(fmt.Sprintf("%d Stashed", stashedItems))
s += fmt.Sprintf("%s%s", divider, si)
}
if newsItems > 0 {
var divider string
if localItems > 0 || stashedItems > 0 {
divider = dividerDot
}
si := common.Subtle(fmt.Sprintf("%d News", newsItems))
if newsItems == 1 {
si = common.Subtle(fmt.Sprintf("%d New", newsItems))
}

s += fmt.Sprintf("%s%s", divider, si)
}
return common.Subtle(s) + maybeOffline
}

Expand Down

0 comments on commit 4782b99

Please sign in to comment.