diff options
author | Miguel Mota <hello@miguelmota.com> | 2021-09-13 22:19:39 -0700 |
---|---|---|
committer | Miguel Mota <hello@miguelmota.com> | 2021-09-13 22:19:39 -0700 |
commit | 83a35df5c4b0264fcd6f9f835e08fb825623e52b (patch) | |
tree | 066dc5163309c0e503beadc7645a0b420cd9111c | |
parent | 1d293631851f3af7f4680b5d4209c59a24b0f646 (diff) |
Hide all holding amounts when hidden flag toggled
-rw-r--r-- | cointop/marketbar.go | 11 | ||||
-rw-r--r-- | cointop/portfolio.go | 12 | ||||
-rw-r--r-- | docs/content/faq.md | 2 |
3 files changed, 19 insertions, 6 deletions
diff --git a/cointop/marketbar.go b/cointop/marketbar.go index fb50cd3..3adf857 100644 --- a/cointop/marketbar.go +++ b/cointop/marketbar.go @@ -42,10 +42,6 @@ func (ct *Cointop) UpdateMarketbar() error { totalstr = humanize.Monetaryf(total, 2) } - if ct.State.hidePortfolioBalances { - totalstr = HiddenBalanceChars - } - timeframe := ct.State.selectedChartRange chartname := ct.SelectedCoinName() var charttitle string @@ -85,10 +81,15 @@ func (ct *Cointop) UpdateMarketbar() error { ) } + totalstr = fmt.Sprintf("%s%s", ct.CurrencySymbol(), totalstr) + if ct.State.hidePortfolioBalances { + totalstr = HiddenBalanceChars + } + content = fmt.Sprintf( "%sTotal Portfolio Value: %s • 24H: %s", chartInfo, - ct.colorscheme.MarketBarLabelActive(fmt.Sprintf("%s%s", ct.CurrencySymbol(), totalstr)), + ct.colorscheme.MarketBarLabelActive(totalstr), color24h(fmt.Sprintf("%.2f%%%s", percentChange24H, arrow)), ) } else { diff --git a/cointop/portfolio.go b/cointop/portfolio.go index 1a09560..656bc1e 100644 --- a/cointop/portfolio.go +++ b/cointop/portfolio.go @@ -145,6 +145,9 @@ func (ct *Cointop) GetPortfolioTable() *table.Table { }) case "holdings": text := strconv.FormatFloat(coin.Holdings, 'f', -1, 64) + if ct.State.hidePortfolioBalances { + text = HiddenBalanceChars + } ct.SetTableColumnWidthFromString(header, text) ct.SetTableColumnAlignLeft(header, false) rowCells = append(rowCells, @@ -272,6 +275,9 @@ func (ct *Cointop) GetPortfolioTable() *table.Table { percentHoldings = 0 } text := fmt.Sprintf("%.2f%%", percentHoldings) + if ct.State.hidePortfolioBalances { + text = HiddenBalanceChars + } ct.SetTableColumnWidthFromString(header, text) ct.SetTableColumnAlignLeft(header, false) rowCells = append(rowCells, @@ -773,6 +779,9 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error { } else { item[i] = strconv.FormatFloat(entry.Holdings, 'f', -1, 64) } + if hideBalances { + item[i] = HiddenBalanceChars + } case "balance": if humanReadable { item[i] = fmt.Sprintf("%s%s", symbol, humanize.Monetaryf(entry.Balance, 2)) @@ -794,6 +803,9 @@ func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error { } else { item[i] = fmt.Sprintf("%.2f", percentHoldings) } + if hideBalances { + item[i] = HiddenBalanceChars + } } } records[i] = item diff --git a/docs/content/faq.md b/docs/content/faq.md index feb1a56..a707c29 100644 --- a/docs/content/faq.md +++ b/docs/content/faq.md @@ -185,7 +185,7 @@ draft: false ## How do I hide my portfolio balances (private mode)? - You can run cointop with the `--hide-portfolio-balances` flag to toggle hide/show portfolio balances or use the keyboard shortcut <kbd>Ctrl</kbd>+<kbd>space</kbd> on the portfolio page. + You can run cointop with the `--hide-portfolio-balances` flag to hide portfolio balances or use the keyboard shortcut <kbd>Ctrl</kbd>+<kbd>space</kbd> on the portfolio page to toggle hide/show. ## I'm getting question marks or weird symbols instead of the correct characters. |