trunk
vilmibm 2023-02-23 07:30:03 +00:00
parent 7ecb79793f
commit 7543c2c4cd
2 changed files with 17 additions and 17 deletions

View File

@ -60,18 +60,19 @@ func (r *reviewer) AddNote(s *models.TownSignup, content string) error {
} }
func renderSignup(s models.TownSignup) string { func renderSignup(s models.TownSignup) string {
out := fmt.Sprintf("[-:-:b]submitted:[-:-:-] %s\n", s.Created.Format("2006-01-02 15:04")) out := ""
pairs := map[string]string{ pairs := [][]string{
"e-mail": s.Email, {"submitted", s.Created.Format("2006-01-02 15:04")},
"how found / referral": s.How, {"e-mail", s.Email},
"why like town / what do": s.Why, {"how found / referral", s.How},
"links": s.Links, {"why like town / plans", s.Why},
{"links", s.Links},
} }
for k, v := range pairs { for _, v := range pairs {
out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", k) out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", v[0])
out += strings.TrimSpace(v) out += strings.TrimSpace(v[1])
out += "\n\n" out += "\n\n"
} }
@ -148,12 +149,17 @@ func _main() error {
count := tview.NewTextView() count := tview.NewTextView()
count.SetDynamicColors(true) count.SetDynamicColors(true)
updateCount := func() { updateCount := func() {
count.SetText(fmt.Sprintf("[-:-:b]%d pending signups[-:-:-]", len(signups))) plural := "s"
if len(signups) == 1 {
plural = ""
}
count.SetText(fmt.Sprintf("[-:-:b]%d pending signup%s[-:-:-]", len(signups), plural))
} }
updateCount() updateCount()
notesView := tview.NewTextView() notesView := tview.NewTextView()
notesView.SetDynamicColors(true) notesView.SetDynamicColors(true)
notesView.SetBorder(true).SetBorderColor(tcell.ColorPurple)
bottomFlex := tview.NewFlex() bottomFlex := tview.NewFlex()
bottomFlex.SetDirection(tview.FlexColumn) bottomFlex.SetDirection(tview.FlexColumn)
@ -162,7 +168,7 @@ func _main() error {
innerFlex := tview.NewFlex() innerFlex := tview.NewFlex()
innerFlex.SetDirection(tview.FlexColumn) innerFlex.SetDirection(tview.FlexColumn)
innerFlex.AddItem(appView, 0, 1, true) innerFlex.AddItem(appView, 0, 2, true)
innerFlex.AddItem(notesView, 0, 1, true) innerFlex.AddItem(notesView, 0, 1, true)
mainFlex := tview.NewFlex() mainFlex := tview.NewFlex()

View File

@ -158,12 +158,6 @@ func (s *TownSignup) All(db *sql.DB) ([]*TownSignup, error) {
su.Created = time.Unix(timestamp, 0) su.Created = time.Unix(timestamp, 0)
/* TODO do i need this? refreshing on render
if err = su.RefreshNotes(db); err != nil {
return nil, err
}
*/
out = append(out, su) out = append(out, su)
} }