Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create independent buttons to delete message and an offer #2466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading