From ee861e5426c6522caa5b71e3254761a0babbb2f3 Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Fri, 12 Jan 2024 16:39:36 +0000 Subject: [PATCH] fix(ui): add card title in deletion prompt This commit updates the delete card modal so that the prompt includes the title of the card that is about to be deleted. This is to give the user the confidence that they are deleting the intended card. The modal has also been updated to match the current theme of the application. Resolves apollo/pelican#18 --- internal/ui/ui.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index a116f3c..a457f83 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -147,6 +147,9 @@ func (u *UI) inputCapture() func(event *tcell.EventKey) *tcell.EventKey { } case key == tcell.KeyCtrlD: if u.mode == normal { + card, _ := u.getFocusedCard() + text := fmt.Sprintf("Do you want to delete '%s'?", card.Title) + u.deleteCardModal.SetText(text) u.pages.ShowPage(deleteCardModalPage) u.SetFocus(u.deleteCardModal) } @@ -214,9 +217,12 @@ func (u *UI) initDeleteCardModal() { u.setColumnFocus() } - u.deleteCardModal.SetText("Do you want to delete this card?"). - AddButtons([]string{"Confirm", "Cancel"}). - SetDoneFunc(doneFunc) + u.deleteCardModal.AddButtons([]string{"Confirm", "Cancel"}).SetDoneFunc(doneFunc) + + u.deleteCardModal.SetBorder(true).SetBorderColor(tcell.ColorOrangeRed) + u.deleteCardModal.SetBackgroundColor(tcell.ColorBlack.TrueColor()) + u.deleteCardModal.SetButtonBackgroundColor(tcell.ColorBlueViolet.TrueColor()) + u.deleteCardModal.SetTextColor(tcell.ColorWhite.TrueColor()) } // initQuitModal initialises the quit modal.