@@ 80,20 80,14 @@ func RoomTUI(client *mautrix.Client, roomID id.RoomID, elections *election.Elect
}
L = elections.L[roomID]
Ltime = elections.Ltime
+ list.Clear()
+ list.AddItem("Create Election", "start a new election in this room", '+', nil)
for i, el := range L {
title := el.Title
if title == "" {
title = "<no name>"
}
- var f func(string, string, rune, func()) *tview.List
- if i+1 < list.GetItemCount() {
- f = func(mainText string, secondaryText string, shortcut rune, selected func()) *tview.List {
- return list.InsertItem(i+1, mainText, secondaryText, shortcut, selected)
- }
- } else {
- f = list.AddItem
- }
- f(title, fmt.Sprintf("created by %s, ID: %s", el.Creator, el.CreateEventId), rune('a'+i), nil)
+ list.AddItem(title, fmt.Sprintf("created by %s, ID: %s", el.Creator, el.CreateEventId), rune('a'+i), nil)
i++
}
}