Show confirmation popup for delete project and clear completed tasks (#35)
This commit is contained in:
22
app/cli.go
22
app/cli.go
@@ -88,9 +88,12 @@ func setKeyboardShortcuts() *tview.Application {
|
||||
switch unicode.ToLower(event.Rune()) {
|
||||
case 'p':
|
||||
app.SetFocus(projectPane)
|
||||
contents.RemoveItem(taskDetailPane)
|
||||
return nil
|
||||
case 'q':
|
||||
case 't':
|
||||
app.SetFocus(taskPane)
|
||||
contents.RemoveItem(taskDetailPane)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -133,3 +136,22 @@ func makeTitleBar() *tview.Flex {
|
||||
AddItem(titleText, 0, 2, false).
|
||||
AddItem(versionInfo, 0, 1, false)
|
||||
}
|
||||
|
||||
func AskYesNo(text string, f func()) {
|
||||
|
||||
modal := tview.NewModal().
|
||||
SetText(text).
|
||||
AddButtons([]string{"Yes", "No"}).
|
||||
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
|
||||
if buttonLabel == "Yes" {
|
||||
f()
|
||||
}
|
||||
pages := tview.NewPages().
|
||||
AddPage("background", layout, true, true)
|
||||
_ = app.SetRoot(pages, true).EnableMouse(true).Run()
|
||||
})
|
||||
pages := tview.NewPages().
|
||||
AddPage("background", layout, true, true).
|
||||
AddPage("modal", modal, true, true)
|
||||
_ = app.SetRoot(pages, true).EnableMouse(true).Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user