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.
cointop/cointop/favorites.go

27 lines
516 B
Go

package cointop
func (ct *Cointop) toggleFavorite() error {
ct.portfoliovisible = false
coin := ct.highlightedRowCoin()
if coin == nil {
return nil
}
_, ok := ct.favorites[coin.Name]
if ok {
delete(ct.favorites, coin.Name)
coin.Favorite = false
} else {
ct.favorites[coin.Name] = true
coin.Favorite = true
}
ct.updateTable()
return nil
}
func (ct *Cointop) toggleShowFavorites() error {
ct.portfoliovisible = false
ct.filterByFavorites = !ct.filterByFavorites
ct.updateTable()
return nil
}