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:
parent
cc65d6bac5
commit
a61772e3b0
@ -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",
|
||||||
|
@ -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",
|
||||||
|
@ -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),
|
||||||
})
|
})
|
||||||
|
6
ui/ui.go
6
ui/ui.go
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user