Add GenreStyle

This commit is contained in:
aditya-K2
2023-04-14 23:13:11 +05:30
parent 07a08aa089
commit 00a03de0bc
2 changed files with 25 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ var (
AlbumStyle = tcell.StyleDefault.Foreground(tcell.ColorGreen).Background(tcell.ColorBlack)
ArtistStyle = tcell.StyleDefault.Foreground(tcell.ColorPink).Background(tcell.ColorBlack)
TimeStyle = tcell.StyleDefault.Foreground(tcell.ColorOrange).Background(tcell.ColorBlack)
GenreStyle = tcell.StyleDefault.Foreground(tcell.ColorPaleTurquoise).Background(tcell.ColorBlack)
PlaylistNavStyle = tcell.StyleDefault.Foreground(tcell.ColorCoral).Background(tcell.ColorBlack)
NavStyle = tcell.StyleDefault.Foreground(tcell.ColorPapayaWhip).Background(tcell.ColorBlack)
ContextMenuStyle = tcell.StyleDefault.Foreground(tcell.ColorPink).Background(tcell.ColorDefault).Bold(true)
@@ -107,9 +108,21 @@ func NewApplication() *Application {
tcell.KeyEnter: "openEntry",
tcell.KeyCtrlP: "playEntry",
})
recentlyPlayedView.MapActions(map[tcell.Key]string{
recentlyPlayedView.SetActions(map[string]*Action{
"selectEntry": NewAction(recentlyPlayedView.SelectEntry, pBar),
})
albumsView.SetActions(map[string]*Action{
"openAlbum": NewAction(func(e *tcell.EventKey) *tcell.EventKey {
albumsView.OpenAlbum()
return nil
}, nil),
})
recentlyPlayedView.SetMappings(map[tcell.Key]string{
tcell.KeyEnter: "selectEntry",
})
searchNavFlex := tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(NavMenu.Table, 6, 3, false).
AddItem(playlistNav.Table, 0, 6, false).
@@ -185,6 +198,16 @@ func NewApplication() *Application {
}
}()
topTracksView.SetMappings(map[tcell.Key]string{
tcell.KeyEnter: "openEntry",
tcell.KeyCtrlP: "playEntry",
})
topTracksView.SetActions(map[string]*Action{
"openEntry": NewAction(func(e *tcell.EventKey) *tcell.EventKey { topTracksView.OpenSelectEntry(); return nil }, pBar),
"playEntry": NewAction(func(e *tcell.EventKey) *tcell.EventKey { topTracksView.PlaySelectedEntry(); return nil }, pBar),
})
App.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
if e.Rune() == '1' {
Ui.App.SetFocus(NavMenu.Table)

View File

@@ -42,7 +42,7 @@ func (a *TopTracksView) Content() func() [][]Content {
for _, v := range a.topArtists {
c = append(c, []Content{
{Content: v.Name, Style: ArtistStyle},
{Content: v.Genres[0], Style: AlbumStyle},
{Content: v.Genres[0], Style: GenreStyle},
})
}
c = append(c, []Content{{"Top Tracks:", NotSelectableStyle}})