@@ -1,8 +1,9 @@
1−package ui
1+package dialog
4 "github.com/charmbracelet/bubbles/v2/key"
4 "github.com/charmbracelet/bubbles/v2/key"
5 tea "github.com/charmbracelet/bubbletea/v2"
5 tea "github.com/charmbracelet/bubbletea/v2"
6+ "github.com/charmbracelet/crush/internal/ui/common"
6 "github.com/charmbracelet/lipgloss/v2"
7 "github.com/charmbracelet/lipgloss/v2"
@@ -46,16 +47,16 @@ func DefaultQuitKeyMap() QuitDialogKeyMap {
49−// QuitDialog represents a confirmation dialog for quitting the application.
50+// Quit represents a confirmation dialog for quitting the application.
50−type QuitDialog struct {
51+type Quit struct {
51− com *Common
52+ com *common.Common
52 keyMap QuitDialogKeyMap
53 keyMap QuitDialogKeyMap
53 selectedNo bool // true if "No" button is selected
54 selectedNo bool // true if "No" button is selected
56−// NewQuitDialog creates a new quit confirmation dialog.
57+// NewQuit creates a new quit confirmation dialog.
57−func NewQuitDialog(com *Common) *QuitDialog {
58+func NewQuit(com *common.Common) *Quit {
58− q := &QuitDialog{
59+ q := &Quit{
60 keyMap: DefaultQuitKeyMap(),
61 keyMap: DefaultQuitKeyMap(),
@@ -63,12 +64,12 @@ func NewQuitDialog(com *Common) *QuitDialog {
65// ID implements [Model].
66// ID implements [Model].
66−func (*QuitDialog) ID() string {
67+func (*Quit) ID() string {
67 return "quit"
68 return "quit"
70// Update implements [Model].
71// Update implements [Model].
71−func (q *QuitDialog) Update(msg tea.Msg) (Dialog, tea.Cmd) {
72+func (q *Quit) Update(msg tea.Msg) (Dialog, tea.Cmd) {
72 switch msg := msg.(type) {
73 switch msg := msg.(type) {
73 case tea.KeyPressMsg:
74 case tea.KeyPressMsg:
@@ -91,7 +92,7 @@ func (q *QuitDialog) Update(msg tea.Msg) (Dialog, tea.Cmd) {
93// View implements [Model].
94// View implements [Model].
94−func (q *QuitDialog) View() string {
95+func (q *Quit) View() string {
95 const question = "Are you sure you want to quit?"
96 const question = "Are you sure you want to quit?"
96 baseStyle := q.com.Styles.Base
97 baseStyle := q.com.Styles.Base
97 yesStyle := q.com.Styles.ButtonSelected
98 yesStyle := q.com.Styles.ButtonSelected
@@ -125,7 +126,7 @@ func (q *QuitDialog) View() string {
127// ShortHelp implements [help.KeyMap].
128// ShortHelp implements [help.KeyMap].
128−func (q *QuitDialog) ShortHelp() []key.Binding {
129+func (q *Quit) ShortHelp() []key.Binding {
129 return []key.Binding{
130 return []key.Binding{
130 q.keyMap.LeftRight,
131 q.keyMap.LeftRight,
131 q.keyMap.EnterSpace,
132 q.keyMap.EnterSpace,
@@ -133,7 +134,7 @@ func (q *QuitDialog) ShortHelp() []key.Binding {
135// FullHelp implements [help.KeyMap].
136// FullHelp implements [help.KeyMap].
136−func (q *QuitDialog) FullHelp() [][]key.Binding {
137+func (q *Quit) FullHelp() [][]key.Binding {
137 return [][]key.Binding{
138 return [][]key.Binding{
138 {q.keyMap.LeftRight, q.keyMap.EnterSpace, q.keyMap.Yes, q.keyMap.No},
139 {q.keyMap.LeftRight, q.keyMap.EnterSpace, q.keyMap.Yes, q.keyMap.No},
139 {q.keyMap.Tab, q.keyMap.Close},
140 {q.keyMap.Tab, q.keyMap.Close},