From e7ff5606f18f91a8dcfbdcfb0d40cab30fb26ffd Mon Sep 17 00:00:00 2001 From: vilmibm Date: Fri, 17 Feb 2023 06:06:37 +0000 Subject: [PATCH] WIP on notating signups --- cmd/review/main.go | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/cmd/review/main.go b/cmd/review/main.go index 0b039e2..85372ed 100644 --- a/cmd/review/main.go +++ b/cmd/review/main.go @@ -173,16 +173,24 @@ func _main() error { 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("error", errorModal, false, false) - // TODO page for textarea to notate + pages.AddPage("notate", notate, true, false) app := tview.NewApplication() app.SetRoot(pages, true) - // TODO count of pending signups somewhere - - // TODO replace imperative shit with signupManager + // TODO replace imperative shit with a signupManager advanceSignup := func() { if len(signups) == 0 { appView.SetText("no signups found.") @@ -229,10 +237,10 @@ func _main() error { if err != nil { errorModal.SetText(fmt.Sprintf("error! failed to approve '%s': %s", signup.Filename, err.Error())) pages.SwitchToPage("error") - } else { - removeSignup(signup) - updateCount() + return nil } + removeSignup(signup) + updateCount() case 'R': if len(signups) == 0 { return nil @@ -242,15 +250,16 @@ func _main() error { if err != nil { errorModal.SetText(fmt.Sprintf("error! failed to reject '%s': %s", signup.Filename, err.Error())) pages.SwitchToPage("error") - } else { - removeSignup(signup) - updateCount() + return nil } + removeSignup(signup) + updateCount() case 'N': if len(signups) == 0 { return nil } - // TODO notate + pages.SwitchToPage("notate") + return nil case 'Q': app.Stop() }