refactor(ui,config): flatten embedded literals

This commit is contained in:
ayn2op 2026-08-21 20:04:19 -04:00
parent cf6c343fd5
commit 764a9b3775
3 changed files with 22 additions and 27 deletions

View file

@ -158,23 +158,21 @@ func defaultGuildsTreeKeybinds() GuildsTreeKeybinds {
func defaultMessagesListKeybinds() MessagesListKeybinds {
return MessagesListKeybinds{
SelectionKeybinds: defaultSelectionKeybinds(),
ScrollKeybinds: ScrollKeybinds{
ScrollUp: desc("scr up"),
ScrollDown: desc("scr down"),
ScrollTop: desc("scr top"),
ScrollBottom: desc("scr btm"),
},
SelectReply: desc("sel reply"),
Reply: desc("reply"),
ReplyMention: desc("@reply"),
Cancel: desc("cancel"),
Edit: desc("edit"),
Delete: desc("force delete"),
DeleteConfirm: desc("delete"),
Open: desc("open"),
YankContent: desc("copy text"),
YankURL: desc("copy url"),
YankID: desc("copy id"),
ScrollUp: desc("scr up"),
ScrollDown: desc("scr down"),
ScrollTop: desc("scr top"),
ScrollBottom: desc("scr btm"),
SelectReply: desc("sel reply"),
Reply: desc("reply"),
ReplyMention: desc("@reply"),
Cancel: desc("cancel"),
Edit: desc("edit"),
Delete: desc("force delete"),
DeleteConfirm: desc("delete"),
Open: desc("open"),
YankContent: desc("copy text"),
YankURL: desc("copy url"),
YankID: desc("copy id"),
}
}

View file

@ -122,7 +122,7 @@ func (gt *guildsTree) unreadStyle(indication ningen.UnreadIndication) tcell.Styl
}
func (gt *guildsTree) guildNodeStyle(guildID discord.GuildID) tcell.Style {
indication := gt.state.GuildIsUnread(guildID, ningen.GuildUnreadOpts{UnreadOpts: ningen.UnreadOpts{IncludeMutedCategories: true}})
indication := gt.state.GuildIsUnread(guildID, ningen.GuildUnreadOpts{IncludeMutedCategories: true})
return gt.unreadStyle(indication)
}

View file

@ -10,7 +10,6 @@ import (
"github.com/ayn2op/ningen/v3"
"github.com/ayn2op/tview"
"github.com/ayn2op/tview/grid"
"github.com/ayn2op/tview/list"
"github.com/ayn2op/tview/picker"
)
@ -55,14 +54,12 @@ func ConfigurePicker(model *picker.Model, cfg *config.Config, title string) {
SetThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style).
SetGlyphSet(cfg.Theme.ScrollBar.GlyphSet.GlyphSet))
model.SetKeybinds(picker.Keybinds{
Cancel: cfg.Keybinds.Picker.Cancel.Keybind,
Keybinds: list.Keybinds{
SelectUp: cfg.Keybinds.Picker.SelectUp.Keybind,
SelectDown: cfg.Keybinds.Picker.SelectDown.Keybind,
SelectTop: cfg.Keybinds.Picker.SelectTop.Keybind,
SelectBottom: cfg.Keybinds.Picker.SelectBottom.Keybind,
},
Select: cfg.Keybinds.Picker.Select.Keybind,
Cancel: cfg.Keybinds.Picker.Cancel.Keybind,
SelectUp: cfg.Keybinds.Picker.SelectUp.Keybind,
SelectDown: cfg.Keybinds.Picker.SelectDown.Keybind,
SelectTop: cfg.Keybinds.Picker.SelectTop.Keybind,
SelectBottom: cfg.Keybinds.Picker.SelectBottom.Keybind,
Select: cfg.Keybinds.Picker.Select.Keybind,
})
}