mirror of https://github.com/miguelmota/cointop
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
464 B
Go
25 lines
464 B
Go
package cointop
|
|
|
|
func (ct *Cointop) toggleFavorite() error {
|
|
coin := ct.highlightedRowCoin()
|
|
if coin == nil {
|
|
return nil
|
|
}
|
|
_, ok := ct.favorites[coin.Symbol]
|
|
if ok {
|
|
delete(ct.favorites, coin.Symbol)
|
|
coin.Favorite = false
|
|
} else {
|
|
ct.favorites[coin.Symbol] = true
|
|
coin.Favorite = true
|
|
}
|
|
ct.updateTable()
|
|
return nil
|
|
}
|
|
|
|
func (ct *Cointop) toggleShowFavorites() error {
|
|
ct.filterByFavorites = !ct.filterByFavorites
|
|
ct.updateTable()
|
|
return nil
|
|
}
|