mirror of
https://github.com/edouardparis/lntop
synced 2024-11-19 21:25:34 +00:00
f72c5ca099
* config: add Views * refac views channels * fix config default * views: menu * config default: add comment * fix config default * README: enhance config section * fix README * controller: F2 Menu * views: transactions * fix views: set current in layout * fix menu * ft transactions * fix Help * fix controller Menu * view: transaction * refac controller * fix ui controller * try some bold * fix cursor * refac color * focus column transactions * controller: add keyBinding Menu m * help view: add menu * fix cursor: push to the right * refac remove current model * ui: txs and channels sortable * fix focus column * view transaction: transaction dest addresses * fix menu * refac controller * channels: sort * rename current column * refac cursor * refac currentColumnIndex * set cursor if view deleted * remove previous * clean view.View * controller: ToggleView * fix menu * view txs: add config * feat order * fix channels sort * feat transactions sort * feat help: add asc/desc * fix README * color: magenta * fix color * fix views menu * fix views help * network backend: SubscribeTransactions * pubsub: transactions * controller.Listen: refresh transactions * fix controller * fix controller pubsub: no need for wallet ticker * fix models transactions * views channels: column SENT and RECEIVED * update version * fix README * fix README * fix models sort * fix readme and default config * fix readme
81 lines
1.6 KiB
Go
81 lines
1.6 KiB
Go
package views
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/jroimartin/gocui"
|
|
|
|
"github.com/edouardparis/lntop/ui/color"
|
|
)
|
|
|
|
const (
|
|
version = "v0.1.0"
|
|
HELP = "help"
|
|
)
|
|
|
|
type Help struct {
|
|
view *gocui.View
|
|
}
|
|
|
|
func (h Help) Name() string {
|
|
return HELP
|
|
}
|
|
|
|
func (h *Help) Wrap(v *gocui.View) View {
|
|
h.view = v
|
|
return h
|
|
}
|
|
|
|
func (h Help) Delete(g *gocui.Gui) error {
|
|
return g.DeleteView(HELP)
|
|
}
|
|
|
|
func (h Help) Origin() (int, int) {
|
|
return h.view.Origin()
|
|
}
|
|
|
|
func (h Help) Cursor() (int, int) {
|
|
return h.view.Cursor()
|
|
}
|
|
|
|
func (h Help) Speed() (int, int, int, int) {
|
|
return 1, 1, 1, 1
|
|
}
|
|
|
|
func (h *Help) SetCursor(x, y int) error {
|
|
return h.view.SetCursor(x, y)
|
|
}
|
|
|
|
func (h *Help) SetOrigin(x, y int) error {
|
|
return h.view.SetOrigin(x, y)
|
|
}
|
|
|
|
func (h Help) Set(g *gocui.Gui, x0, y0, x1, y1 int) error {
|
|
var err error
|
|
h.view, err = g.SetView(HELP, x0-1, y0, x1, y1)
|
|
if err != nil {
|
|
if err != gocui.ErrUnknownView {
|
|
return err
|
|
}
|
|
}
|
|
h.view.Frame = false
|
|
cyan := color.Cyan()
|
|
fmt.Fprintln(h.view, fmt.Sprintf("lntop %s - (C) 2019 Edouard Paris", version))
|
|
fmt.Fprintln(h.view, "Released under the MIT License")
|
|
fmt.Fprintln(h.view, "")
|
|
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
|
|
cyan("F1 h:"), "show/close this help screen"))
|
|
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
|
|
cyan("F2 m:"), "show/close the menu sidebar"))
|
|
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
|
|
cyan("F10 q:"), "quit"))
|
|
|
|
fmt.Fprintln(h.view, "")
|
|
fmt.Fprintln(h.view, fmt.Sprintf("%6s %s",
|
|
cyan(" a d:"), "apply asc/desc order to the rows according to the selected column value"))
|
|
_, err = g.SetCurrentView(HELP)
|
|
return err
|
|
}
|
|
|
|
func NewHelp() *Help { return &Help{} }
|