Skip to content

Commit

Permalink
Merge pull request #2466 from axpoems/create-independent-delete-buttons
Browse files Browse the repository at this point in the history
Create independent buttons to delete message and an offer
  • Loading branch information
djing-chan authored Jul 23, 2024
2 parents 3f30f0e + 8355b2d commit 65f7c3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public abstract class BubbleMessageBox extends MessageBox {
protected final UserProfileIcon userProfileIcon = new UserProfileIcon(60);
protected final HBox actionsHBox = new HBox(5);
protected final VBox quotedMessageVBox, contentVBox;
protected final BisqMenuItem deleteAction = new BisqMenuItem("delete-t-grey", "delete-t-red");
private Subscription reactMenuPin;
protected ActiveReactionsDisplayBox activeReactionsDisplayHBox;
protected ReactMenuBox reactMenuBox;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import bisq.chat.bisqeasy.offerbook.BisqEasyOfferbookMessage;
import bisq.common.util.StringUtils;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.BisqMenuItem;
import bisq.desktop.main.content.chat.message_container.list.ChatMessageListItem;
import bisq.desktop.main.content.chat.message_container.list.ChatMessagesListController;
import bisq.i18n.Res;
Expand All @@ -38,6 +39,7 @@

public final class MyOfferMessageBox extends BubbleMessageBox {
private final Label myOfferTitle;
private BisqMenuItem removeOffer;

public MyOfferMessageBox(ChatMessageListItem<? extends ChatMessage, ? extends ChatChannel<? extends ChatMessage>> item,
ListView<ChatMessageListItem<? extends ChatMessage, ? extends ChatChannel<? extends ChatMessage>>> list,
Expand All @@ -63,7 +65,7 @@ public MyOfferMessageBox(ChatMessageListItem<? extends ChatMessage, ? extends Ch
messageBgHBox.setMaxWidth(Control.USE_PREF_SIZE);

// Actions
actionsHBox.getChildren().setAll(Spacer.fillHBox(), supportedLanguages, copyAction, deleteAction);
actionsHBox.getChildren().setAll(Spacer.fillHBox(), supportedLanguages, copyAction, removeOffer);

contentVBox.setAlignment(Pos.CENTER_RIGHT);
contentVBox.getChildren().setAll(userNameAndDateHBox, messageBgHBox, actionsHBox);
Expand All @@ -82,15 +84,16 @@ protected void setUpUserNameAndDateTime() {
protected void setUpActions() {
super.setUpActions();

deleteAction.useIconOnly();
deleteAction.setTooltip(Res.get("offer.deleteOffer"));
HBox.setMargin(deleteAction, ACTION_ITEMS_MARGIN);
removeOffer = new BisqMenuItem("delete-t-grey", "delete-t-red");
removeOffer.useIconOnly();
removeOffer.setTooltip(Res.get("offer.deleteOffer"));
HBox.setMargin(removeOffer, ACTION_ITEMS_MARGIN);
}

@Override
protected void addActionsHandlers() {
copyAction.setOnAction(e -> onCopyMessage(String.format("%s\n%s", myOfferTitle.getText(), message.getText())));
deleteAction.setOnAction(e -> controller.onDeleteMessage(item.getChatMessage()));
removeOffer.setOnAction(e -> controller.onDeleteMessage(item.getChatMessage()));
}

private Label createAndGetMyOfferTitle() {
Expand All @@ -111,6 +114,6 @@ private Label createAndGetMyOfferTitle() {
@Override
public void cleanup() {
copyAction.setOnAction(null);
deleteAction.setOnAction(null);
removeOffer.setOnAction(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class MyTextMessageBox extends BubbleMessageBox {
private final Subscription shouldShowTryAgainPin, messageDeliveryStatusNodePin;
private final BisqMenuItem tryAgainMenuItem = item.getTryAgainMenuItem();
private final HBox deliveryStateHBox = new HBox();
private BisqMenuItem editAction;
private BisqMenuItem editAction, deleteAction;
private BisqTextArea editInputField;
private Button saveEditButton, cancelEditButton;
private HBox messageStatusHbox, editButtonsHBox;
Expand Down Expand Up @@ -117,6 +117,7 @@ protected void setUpActions() {
editAction = new BisqMenuItem("edit-grey", "edit-white");
editAction.useIconOnly();
editAction.setTooltip(Res.get("action.edit"));
deleteAction = new BisqMenuItem("delete-t-grey", "delete-t-red");
deleteAction.useIconOnly();
deleteAction.setTooltip(Res.get("action.delete"));
HBox.setMargin(editAction, ACTION_ITEMS_MARGIN);
Expand Down

0 comments on commit 65f7c3b

Please sign in to comment.