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
564 B
Go

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