fix: make the shelf menus actually work

This commit is contained in:
2024-02-12 19:04:40 -06:00
parent a59702182f
commit 4e301c29fc
7 changed files with 43 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ func NewApp(name, version, host string, logger *zap.Logger) *App {
}
app.assets = assets.NewAssets(logger, app.APIClient)
app.shelves = shelves.NewShelves(logger, app.APIClient)
app.help = help.NewHelp(name, version)

View File

@@ -21,9 +21,11 @@ func (app *App) switchToPreviousScreen() {
var previousScreen string
switch app.currentPage {
case app.help.GetTitle():
previousScreen = app.assets.GetTitle()
previousScreen = app.shelves.GetTitle()
case app.assets.GetTitle():
previousScreen = app.help.GetTitle()
case app.shelves.GetTitle():
previousScreen = app.assets.GetTitle()
}
app.switchToScreen(previousScreen)
}
@@ -34,6 +36,8 @@ func (app *App) switchToNextScreen() {
case app.help.GetTitle():
nextScreen = app.assets.GetTitle()
case app.assets.GetTitle():
nextScreen = app.shelves.GetTitle()
case app.shelves.GetTitle():
nextScreen = app.help.GetTitle()
}
app.switchToScreen(nextScreen)
@@ -45,6 +49,8 @@ func (app *App) setPageFocus(page string) {
app.Application.SetFocus(app.help)
case app.assets.GetTitle():
app.Application.SetFocus(app.assets)
case app.shelves.GetTitle():
app.Application.SetFocus(app.shelves)
}
}
@@ -52,5 +58,7 @@ func (app *App) updatePageData(page string) {
switch page {
case app.assets.GetTitle():
app.assets.UpdateData()
case app.shelves.GetTitle():
app.shelves.UpdateData()
}
}