1
0
Fork 0

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
caps = append(caps,
adapter.Capability{
ID: "list:forums",
Name: "List Forums",
},
adapter.Capability{
ID: "list:posts",
Name: "List Posts",

View File

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

View File

@ -115,6 +115,9 @@ func (sys *System) Load() 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{
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},
),
)
return m, tea.Batch(ccmds...)
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},
),
)
return m, tea.Batch(ccmds...)
default:
@ -225,8 +227,10 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case cmd.WinClose:
switch msg.Target {
case postcreate.WIN_ID:
m.ctx.Logger.Debugln("received WinClose")
case popuplist.WIN_ID:
selectionIDIf := msg.GetArg("selectionID")
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.SetCurrentForum(selected)
}
return m, cmd.New(cmd.ViewRefreshData, "*").Tea()
}
case cmd.WMCloseWin: