refactor: initialize layout when token is available

This commit is contained in:
ayn2op 2025-03-25 17:28:21 -04:00
parent 1628535b5d
commit 263e4e77bf

View file

@ -14,7 +14,8 @@ import (
type App struct {
*tview.Application
cfg *config.Config
cfg *config.Config
flex *tview.Flex
guildsTree *GuildsTree
messagesText *MessagesText
@ -26,15 +27,14 @@ func newApp(cfg *config.Config) *App {
a := &App{
Application: app,
cfg: cfg,
flex: tview.NewFlex(),
cfg: cfg,
flex: tview.NewFlex(),
guildsTree: newGuildsTree(app, cfg),
messagesText: newMessagesText(app, cfg),
messageInput: newMessageInput(app, cfg),
}
a.init()
a.EnableMouse(cfg.Mouse)
a.SetInputCapture(a.onInputCapture)
a.flex.SetInputCapture(a.onFlexInputCapture)
@ -56,6 +56,7 @@ func (app *App) show(token string) error {
return err
}
app.init()
app.SetRoot(app.flex, true)
}