1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-12-04 14:46:37 -05:00

Implemented first working selector

This commit is contained in:
マリウス 2023-01-05 12:12:14 -05:00
parent cc65d6bac5
commit a61772e3b0
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
4 changed files with 17 additions and 0 deletions

View File

@ -50,6 +50,10 @@ func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability var caps []adapter.Capability
caps = append(caps, caps = append(caps,
adapter.Capability{
ID: "list:forums",
Name: "List Forums",
},
adapter.Capability{ adapter.Capability{
ID: "list:posts", ID: "list:posts",
Name: "List Posts", Name: "List Posts",

View File

@ -48,6 +48,10 @@ func (sys *System) GetCapabilities() adapter.Capabilities {
var caps []adapter.Capability var caps []adapter.Capability
caps = append(caps, caps = append(caps,
adapter.Capability{
ID: "list:forums",
Name: "List Forums",
},
adapter.Capability{ adapter.Capability{
ID: "list:posts", ID: "list:posts",
Name: "List Posts", Name: "List Posts",

View File

@ -115,6 +115,9 @@ func (sys *System) Load() error {
} }
func (sys *System) ListForums() ([]forum.Forum, error) { func (sys *System) ListForums() ([]forum.Forum, error) {
return []forum.Forum{}, nil
// Not possible to list forums atm
resp, err := sys.client.Communities(context.Background(), types.ListCommunities{ resp, err := sys.client.Communities(context.Background(), types.ListCommunities{
Type: types.NewOptional(types.ListingSubscribed), Type: types.NewOptional(types.ListingSubscribed),
}) })

View File

@ -133,6 +133,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmd.Arg{Name: "items", Value: listItems}, cmd.Arg{Name: "items", Value: listItems},
), ),
) )
return m, tea.Batch(ccmds...) return m, tea.Batch(ccmds...)
case key.Matches(msg, m.keymap.ForumSelect): case key.Matches(msg, m.keymap.ForumSelect):
@ -166,6 +167,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmd.Arg{Name: "items", Value: listItems}, cmd.Arg{Name: "items", Value: listItems},
), ),
) )
return m, tea.Batch(ccmds...) return m, tea.Batch(ccmds...)
default: default:
@ -225,8 +227,10 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case cmd.WinClose: case cmd.WinClose:
switch msg.Target { switch msg.Target {
case postcreate.WIN_ID: case postcreate.WIN_ID:
m.ctx.Logger.Debugln("received WinClose") m.ctx.Logger.Debugln("received WinClose")
case popuplist.WIN_ID: case popuplist.WIN_ID:
selectionIDIf := msg.GetArg("selectionID") selectionIDIf := msg.GetArg("selectionID")
if selectionIDIf == nil { if selectionIDIf == nil {
@ -243,6 +247,8 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.ctx.SetCurrentSystem(selected.SysIDX) m.ctx.SetCurrentSystem(selected.SysIDX)
m.ctx.SetCurrentForum(selected) m.ctx.SetCurrentForum(selected)
} }
return m, cmd.New(cmd.ViewRefreshData, "*").Tea()
} }
case cmd.WMCloseWin: case cmd.WMCloseWin: