From 4782b991546c043588eed80998811c538f3e8b8c Mon Sep 17 00:00:00 2001 From: Nicolas Martin Date: Sun, 25 Oct 2020 04:57:12 +0100 Subject: [PATCH] Display news item count in stash view --- ui/stash.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/stash.go b/ui/stash.go index 340b22d..6ebcdbe 100644 --- a/ui/stash.go +++ b/ui/stash.go @@ -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 { @@ -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 }