feat: Add delete button to book editing keyboard

This commit is contained in:
2025-02-16 21:48:20 +03:00
parent e284a52401
commit 82b63c8ab3
2 changed files with 17 additions and 7 deletions
@@ -183,15 +183,25 @@ public class KeyboardHelper {
.callbackData("BOOK_EDIT_DATE")
.build()
);
// navRow.add(
// InlineKeyboardButton.builder()
// .text("Отмена ❌")
// .callbackData("BOOK_EDIT_CANCEL")
// .build()
// );
rows.add(navRow);
// Новая строка с кнопкой удаления
InlineKeyboardRow actionRow = new InlineKeyboardRow();
actionRow.add(
InlineKeyboardButton.builder()
.text("Удалить книгу \uD83D\uDDD1")
.callbackData("BOOK_DELETE")
.build()
);
actionRow.add(
InlineKeyboardButton.builder()
.text("Отмена ❌")
.callbackData("BOOK_EDIT_CANCEL")
.build()
);
rows.add(actionRow);
return new InlineKeyboardMarkup(rows);
}
@@ -45,7 +45,7 @@ public class BookEditingServiceImpl implements BookEditingService {
book.ifPresentOrElse(
b -> {
log.info("Found book with id {}", bookId);
telegramClientService.sendMessage(user, "Выберите поле для редактирования:", getEditOptions(user));
telegramClientService.sendMessage(user, "Выберите поле для редактирования или удалите книгу:", getEditOptions(user));
},
() -> telegramClientService.sendMessage(user, Constants.ERROR_BOOK_NOT_FOUND)
);