diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-01-13 20:02:10 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-01-14 17:45:35 +0100 |
commit | 84e1d15079ab688d3a7379868c8b6b71a3a6edb1 (patch) | |
tree | 5a2bff2714213033e900660e3db0ee7d1aeaf75e /pkg/gui/context | |
parent | 09a24ee97dfa7fd38706e73e0ff7eaef3457c4e7 (diff) |
Make DisabledReason a struct
This is a pure refactoring, no change in behavior yet. We'll add another field
to the struct in the next commit.
Diffstat (limited to 'pkg/gui/context')
-rw-r--r-- | pkg/gui/context/menu_context.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/gui/context/menu_context.go b/pkg/gui/context/menu_context.go index 1ea0e64c1..d7c982651 100644 --- a/pkg/gui/context/menu_context.go +++ b/pkg/gui/context/menu_context.go @@ -90,7 +90,7 @@ func (self *MenuViewModel) GetDisplayStrings(_ int, _ int) [][]string { return lo.Map(menuItems, func(item *types.MenuItem, _ int) []string { displayStrings := item.LabelColumns - if item.DisabledReason != "" { + if item.DisabledReason != nil { displayStrings[0] = style.FgDefault.SetStrikethrough().Sprint(displayStrings[0]) } @@ -172,8 +172,8 @@ func (self *MenuContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Bin } func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error { - if selectedItem != nil && selectedItem.DisabledReason != "" { - self.c.ErrorToast(self.c.Tr.DisabledMenuItemPrefix + selectedItem.DisabledReason) + if selectedItem != nil && selectedItem.DisabledReason != nil { + self.c.ErrorToast(self.c.Tr.DisabledMenuItemPrefix + selectedItem.DisabledReason.Text) return nil } |