mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-09 13:58:05 -05:00
Focus can now be switched from one primitive to other
This commit is contained in:
18
ui/app.go
18
ui/app.go
@@ -32,6 +32,7 @@ type Application struct {
|
||||
CoverArt *CoverArt
|
||||
Main *interactiveView
|
||||
NavMenu *NavMenu
|
||||
PlaylistNav *PlaylistNav
|
||||
SearchBar *tview.Box
|
||||
ProgressBar *ProgressBar
|
||||
Root *Root
|
||||
@@ -122,7 +123,6 @@ func NewApplication() *Application {
|
||||
AddItem(pBar, 5, 1, false)
|
||||
|
||||
Root.Primitive("Main", MainFlex)
|
||||
App.EnableMouse(true)
|
||||
App.SetRoot(Root.Root, true).SetFocus(playlistNav.Table)
|
||||
|
||||
InitNotifier()
|
||||
@@ -180,10 +180,26 @@ func NewApplication() *Application {
|
||||
}
|
||||
}()
|
||||
|
||||
App.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
|
||||
if e.Rune() == '1' {
|
||||
Ui.App.SetFocus(NavMenu.Table)
|
||||
return nil
|
||||
}
|
||||
if e.Rune() == '2' {
|
||||
Ui.App.SetFocus(playlistNav.Table)
|
||||
return nil
|
||||
}
|
||||
if e.Rune() == '3' {
|
||||
Ui.App.SetFocus(Main.Table)
|
||||
return nil
|
||||
}
|
||||
return e
|
||||
})
|
||||
Ui = &Application{
|
||||
App: App,
|
||||
Main: Main,
|
||||
CoverArt: coverArt,
|
||||
PlaylistNav: playlistNav,
|
||||
NavMenu: NavMenu,
|
||||
SearchBar: searchbar,
|
||||
ProgressBar: pBar,
|
||||
|
||||
8
ui/view_artist.go
Normal file
8
ui/view_artist.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package ui
|
||||
|
||||
import "github.com/zmb3/spotify/v2"
|
||||
|
||||
type ArtistView struct {
|
||||
topTracks []spotify.FullTrack
|
||||
albums []spotify.SimpleAlbum
|
||||
}
|
||||
Reference in New Issue
Block a user