66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package app
|
|
|
|
import (
|
|
"git.sr.ht/~rockorager/vaxis"
|
|
"git.sr.ht/~rockorager/vaxis/widgets/list"
|
|
"git.tilde.town/nbsp/neofeels/ui"
|
|
)
|
|
|
|
type Management struct {
|
|
title string
|
|
list list.List
|
|
help string
|
|
}
|
|
|
|
func NewManagement() *Management {
|
|
return &Management{
|
|
title,
|
|
list.New([]string{
|
|
" read over feels ", // TODO
|
|
" modify feels publishing ", // TODO
|
|
" backup your feels ", // TODO
|
|
" import a feels backup ", // TODO
|
|
" bury some feels ", // TODO
|
|
" delete feels by day ", // TODO
|
|
" purge all feels ", // TODO
|
|
" wipe feels account ", // TODO
|
|
}),
|
|
"↑↓/kj move ↵ enter q return",
|
|
}
|
|
}
|
|
|
|
func (management *Management) Event(state *ui.State, event vaxis.Event) (processed bool) {
|
|
if key, ok := event.(vaxis.Key); ok && key.EventType == vaxis.EventPress {
|
|
switch key.String() {
|
|
case "Ctrl+c", "Ctrl+d":
|
|
close(ui.Quit)
|
|
case "Down", "j":
|
|
management.list.Down()
|
|
case "Up", "k":
|
|
management.list.Up()
|
|
case "End", "Shift+g":
|
|
management.list.End()
|
|
case "Home", "g":
|
|
management.list.Home()
|
|
case "q", "h", "Left":
|
|
ui.ViewChange <- NewMainMenu()
|
|
case "Enter", "l", "Right":
|
|
switch management.list.Index() {
|
|
}
|
|
}
|
|
processed = true
|
|
}
|
|
win := state.Window()
|
|
win.New(win.Width/2-10, win.Height/2-8, 20, 5).Print(vaxis.Segment{Text: management.title})
|
|
management.list.Draw(vaxis.Window{
|
|
Vx: win.Vx,
|
|
Parent: nil,
|
|
Column: win.Width/2 - 14,
|
|
Row: win.Height/2 - 2,
|
|
Width: 28,
|
|
Height: 10,
|
|
})
|
|
win.New(win.Width/2-14, win.Height/2+7, 28, 1).Print(vaxis.Segment{Text: management.help})
|
|
return
|
|
}
|