WIP on notating signups

trunk
vilmibm 2023-02-17 06:06:37 +00:00
parent 41e5463756
commit e7ff5606f1
1 changed files with 20 additions and 11 deletions

View File

@ -173,16 +173,24 @@ func _main() error {
pages.SwitchToPage("main") pages.SwitchToPage("main")
}) })
notate := tview.NewForm()
notate.AddTextArea("note", "", 80, 10, 1000, func(string) {})
notate.AddButton("submit", func() {
// TODO add note; this will require re-serializing and saving the file
pages.SwitchToPage("main")
})
notate.AddButton("cancel", func() {
pages.SwitchToPage("main")
})
pages.AddPage("main", mainFlex, true, true) pages.AddPage("main", mainFlex, true, true)
pages.AddPage("error", errorModal, false, false) pages.AddPage("error", errorModal, false, false)
// TODO page for textarea to notate pages.AddPage("notate", notate, true, false)
app := tview.NewApplication() app := tview.NewApplication()
app.SetRoot(pages, true) app.SetRoot(pages, true)
// TODO count of pending signups somewhere // TODO replace imperative shit with a signupManager
// TODO replace imperative shit with signupManager
advanceSignup := func() { advanceSignup := func() {
if len(signups) == 0 { if len(signups) == 0 {
appView.SetText("no signups found.") appView.SetText("no signups found.")
@ -229,10 +237,10 @@ func _main() error {
if err != nil { if err != nil {
errorModal.SetText(fmt.Sprintf("error! failed to approve '%s': %s", signup.Filename, err.Error())) errorModal.SetText(fmt.Sprintf("error! failed to approve '%s': %s", signup.Filename, err.Error()))
pages.SwitchToPage("error") pages.SwitchToPage("error")
} else { return nil
}
removeSignup(signup) removeSignup(signup)
updateCount() updateCount()
}
case 'R': case 'R':
if len(signups) == 0 { if len(signups) == 0 {
return nil return nil
@ -242,15 +250,16 @@ func _main() error {
if err != nil { if err != nil {
errorModal.SetText(fmt.Sprintf("error! failed to reject '%s': %s", signup.Filename, err.Error())) errorModal.SetText(fmt.Sprintf("error! failed to reject '%s': %s", signup.Filename, err.Error()))
pages.SwitchToPage("error") pages.SwitchToPage("error")
} else { return nil
}
removeSignup(signup) removeSignup(signup)
updateCount() updateCount()
}
case 'N': case 'N':
if len(signups) == 0 { if len(signups) == 0 {
return nil return nil
} }
// TODO notate pages.SwitchToPage("notate")
return nil
case 'Q': case 'Q':
app.Stop() app.Stop()
} }