refactor: changed all models for the tui to be in a proper tree structure

All tui elemnts should now be children models to a parent model where
applicable. This should eliminate the weird key regristration issues
seen before and now adhere to proper bubbletea standards
This commit is contained in:
Slug-Boi
2024-11-11 12:57:14 +01:00
parent 56cf60e071
commit c8e5d87e3f
2 changed files with 81 additions and 85 deletions
+1 -9
View File
@@ -204,15 +204,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case key.Matches(msg, m.keys.tempAdd):
screen.Clear()
screen.MoveTopLeft()
tempAuthr := Entry_TA()
if tempAuthr != "" {
split := strings.Split(tempAuthr, ":")
item_str := split[0] + " - " + split[1]
dupProtect[item_str] = tempAuthr
i := item(item_str)
m.list.InsertItem(len(m.list.Items())+1, i)
selectToggle(i)
}
sub_model = tempAuthorModel(&m)
return m, tea.ClearScreen
case key.Matches(msg, m.keys.createAuthor):