Skip to content

Commit

Permalink
fix: playlist name in push confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
agukrapo committed Jul 22, 2024
1 parent d08f144 commit 429977b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cmd/gui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ func (a *application) renderResults(target playlists.Target, name string, songs
data := set.New(len(songs))
manager := playlists.NewManager(target, 100)

cnf := dialog.NewConfirm("Create playlist?", "", func(b bool) {
cnf := dialog.NewConfirm("Create playlist?", fmt.Sprintf("name %q", name), func(b bool) {
if !b {
return
}
a.modal.show()
s := data.Slice()
fmt.Println("Creating playlist", name, len(s), s)
if err := manager.Push(context.Background(), name, s); err != nil {

if err := manager.Push(context.Background(), name, data.Slice()); err != nil {
notify(a.window, fmt.Errorf("manager.Push: %w", err))
return
}
a.renderForm()

a.modal.hide()
}, a.window)

Expand Down Expand Up @@ -154,10 +154,7 @@ func (a *application) renderResults(target playlists.Target, name string, songs

s := widget.NewSelect(opts, nil)
s.OnChanged = func(v string) {
si := s.SelectedIndex()
track := matches[si]
fmt.Println("selected", si, v, track.ID, track.Name)

track := matches[s.SelectedIndex()]
if err := data.Add(i, track.ID, track.Name); err != nil {
notify(a.window, err)
}
Expand Down

0 comments on commit 429977b

Please sign in to comment.