pull/1/head
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 {
out := fmt.Sprintf("[-:-:b]submitted:[-:-:-] %s\n", s.Created.Format("2006-01-02 15:04"))
out := ""
pairs := map[string]string{
"e-mail": s.Email,
"how found / referral": s.How,
"why like town / what do": s.Why,
"links": s.Links,
pairs := [][]string{
{"submitted", s.Created.Format("2006-01-02 15:04")},
{"e-mail", s.Email},
{"how found / referral", s.How},
{"why like town / plans", s.Why},
{"links", s.Links},
}
for k, v := range pairs {
out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", k)
out += strings.TrimSpace(v)
for _, v := range pairs {
out += fmt.Sprintf("[-:-:b]%s[-:-:-]\n", v[0])
out += strings.TrimSpace(v[1])
out += "\n\n"
}
@ -148,12 +149,17 @@ func _main() error {
count := tview.NewTextView()
count.SetDynamicColors(true)
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()
notesView := tview.NewTextView()
notesView.SetDynamicColors(true)
notesView.SetBorder(true).SetBorderColor(tcell.ColorPurple)
bottomFlex := tview.NewFlex()
bottomFlex.SetDirection(tview.FlexColumn)
@ -162,7 +168,7 @@ func _main() error {
innerFlex := tview.NewFlex()
innerFlex.SetDirection(tview.FlexColumn)
innerFlex.AddItem(appView, 0, 1, true)
innerFlex.AddItem(appView, 0, 2, true)
innerFlex.AddItem(notesView, 0, 1, true)
mainFlex := tview.NewFlex()

View File

@ -158,12 +158,6 @@ func (s *TownSignup) All(db *sql.DB) ([]*TownSignup, error) {
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)
}