From 00a03de0bce2ed338b9cd42bbf0682fc2c324690 Mon Sep 17 00:00:00 2001 From: aditya-K2 Date: Fri, 14 Apr 2023 23:13:11 +0530 Subject: [PATCH] Add GenreStyle --- ui/app.go | 25 ++++++++++++++++++++++++- ui/view_top.go | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ui/app.go b/ui/app.go index 99cad77..b25b0fd 100644 --- a/ui/app.go +++ b/ui/app.go @@ -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) diff --git a/ui/view_top.go b/ui/view_top.go index ebe002b..675f503 100644 --- a/ui/view_top.go +++ b/ui/view_top.go @@ -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}})