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
This commit is contained in:
Dan Anglin 2024-01-12 16:39:36 +00:00
parent 3703a7fd88
commit ee861e5426
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638

View file

@ -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.