2023-01-09 18:54:21 +00:00
|
|
|
package tui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/charmbracelet/bubbles/key"
|
|
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
|
|
"github.com/charmbracelet/lipgloss"
|
|
|
|
"github.com/zmb3/spotify"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
P *tea.Program
|
2023-01-09 18:55:18 +00:00
|
|
|
|
2023-01-09 18:54:21 +00:00
|
|
|
Client *spotify.Client
|
2023-01-09 18:55:18 +00:00
|
|
|
|
2023-01-09 18:54:21 +00:00
|
|
|
WindowSize tea.WindowSizeMsg
|
|
|
|
)
|
|
|
|
|
|
|
|
var DocStyle = lipgloss.NewStyle().Margin(0, 2)
|
|
|
|
|
|
|
|
var HelpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("241")).Render
|
|
|
|
|
|
|
|
var ErrStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#bd534b")).Render
|
|
|
|
|
|
|
|
var AlertStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("62")).Render
|
|
|
|
|
|
|
|
type keymap struct {
|
|
|
|
Radio key.Binding
|
|
|
|
Enter key.Binding
|
|
|
|
Rename key.Binding
|
|
|
|
Delete key.Binding
|
|
|
|
Back key.Binding
|
|
|
|
Quit key.Binding
|
|
|
|
}
|
|
|
|
|
|
|
|
var Keymap = keymap{
|
|
|
|
Radio: key.NewBinding(
|
|
|
|
key.WithKeys("ctrl+r"),
|
2023-01-09 18:55:18 +00:00
|
|
|
key.WithHelp("ctrl+r", "start radio"),
|
2023-01-09 18:54:21 +00:00
|
|
|
),
|
|
|
|
Enter: key.NewBinding(
|
|
|
|
key.WithKeys("enter"),
|
|
|
|
key.WithHelp("enter", "select"),
|
|
|
|
),
|
|
|
|
Back: key.NewBinding(
|
|
|
|
key.WithKeys("esc"),
|
|
|
|
key.WithHelp("esc", "back"),
|
|
|
|
),
|
|
|
|
Quit: key.NewBinding(
|
|
|
|
key.WithKeys("ctrl+c", "q"),
|
|
|
|
key.WithHelp("ctrl+c/q", "quit"),
|
|
|
|
),
|
|
|
|
}
|