Refactored StatusBar - changed into a type, other small fixes

This commit is contained in:
Anis Ahmad
2020-06-08 01:05:17 +06:00
parent 62d04b2963
commit a6af1a617a
9 changed files with 82 additions and 55 deletions

View File

@@ -45,23 +45,6 @@ func parseDateInputOrCurrent(inputText string) time.Time {
return time.Now()
}
func showMessage(text string) {
message.SetText(text)
statusBar.SwitchToPage(messagePage)
go func() {
time.Sleep(time.Second * 5)
app.QueueUpdateDraw(func() {
statusBar.SwitchToPage(shortcutsPage)
})
}()
}
func yetToImplement(feature string) func() {
message := fmt.Sprintf("[yellow]%s is yet to implement. Please Check in next version.", feature)
return func() { showMessage(message) }
}
func makeButton(label string, handler func()) *tview.Button {
btn := tview.NewButton(label).SetSelectedFunc(handler).
SetLabelColor(tcell.ColorWhite)
@@ -75,3 +58,9 @@ func ignoreKeyEvt() bool {
textInputs := []string{"*tview.InputField", "*femto.View"}
return util.InArray(reflect.TypeOf(app.GetFocus()).String(), textInputs)
}
// yetToImplement - to use as callback for unimplemented features
func yetToImplement(feature string) func() {
message := fmt.Sprintf("[yellow]%s is yet to implement. Please Check in next version.", feature)
return func() { statusBar.showForSeconds(message, 5) }
}