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

Disputes UI improvements #5370

Merged
merged 3 commits into from Apr 13, 2021
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
3 changes: 2 additions & 1 deletion core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ portfolio.pending.step2_seller.f2fInfo.headline=Buyer's contact information
portfolio.pending.step2_seller.waitPayment.msg=The deposit transaction has at least one blockchain confirmation.\nYou need to wait until the BTC buyer starts the {0} payment.
portfolio.pending.step2_seller.warn=The BTC buyer still has not done the {0} payment.\nYou need to wait until they have started the payment.\nIf the trade has not been completed on {1} the arbitrator will investigate.
portfolio.pending.step2_seller.openForDispute=The BTC buyer has not started their payment!\nThe max. allowed period for the trade has elapsed.\nYou can wait longer and give the trading peer more time or contact the mediator for assistance.
tradeChat.chatWindowTitle=Chat window for trade with ID ''{0}''
disputeChat.chatWindowTitle=Dispute chat window for trade with ID ''{0}''
tradeChat.chatWindowTitle=Trader Chat window for trade with ID ''{0}''
tradeChat.openChat=Open chat window
tradeChat.rules=You can communicate with your trade peer to resolve potential problems with this trade.\n\
It is not mandatory to reply in the chat.\n\
Expand Down
4 changes: 4 additions & 0 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,10 @@ textfield */
-fx-font-size: 0.846em;
}

.dispute-chat-border {
-fx-background-color: -bs-color-blue-5;
}

/********************************************************************************************************************
* *
* DAO *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

import javafx.beans.value.ChangeListener;

import lombok.Getter;

public class DisputeChatPopup {
public interface ChatCallback {
void onCloseDisputeFromChatWindow(Dispute dispute);
Expand All @@ -60,6 +62,7 @@ public interface ChatCallback {
private double chatPopupStageYPosition = -1;
private ChangeListener<Number> xPositionListener;
private ChangeListener<Number> yPositionListener;
@Getter private Dispute selectedDispute;

DisputeChatPopup(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
CoinFormatter formatter,
Expand All @@ -78,10 +81,12 @@ public boolean isChatShown() {
public void closeChat() {
if (chatPopupStage != null)
chatPopupStage.close();
selectedDispute = null;
}

public void openChat(Dispute selectedDispute, DisputeSession concreteDisputeSession, String counterpartyName) {
closeChat();
this.selectedDispute = selectedDispute;
selectedDispute.getChatMessages().forEach(m -> m.setWasDisplayed(true));
disputeManager.requestPersistence();

Expand All @@ -96,7 +101,7 @@ public void openChat(Dispute selectedDispute, DisputeSession concreteDisputeSess
AnchorPane.setRightAnchor(chatView, 10d);
AnchorPane.setTopAnchor(chatView, -20d);
AnchorPane.setBottomAnchor(chatView, 10d);

pane.getStyleClass().add("dispute-chat-border");
Button closeDisputeButton = null;
if (!selectedDispute.isClosed() && !disputeManager.isTrader(selectedDispute)) {
closeDisputeButton = new AutoTooltipButton(Res.get("support.closeTicket"));
Expand All @@ -106,7 +111,7 @@ public void openChat(Dispute selectedDispute, DisputeSession concreteDisputeSess
chatView.activate();
chatView.scrollToBottom();
chatPopupStage = new Stage();
chatPopupStage.setTitle(Res.get("tradeChat.chatWindowTitle", selectedDispute.getShortTradeId())
chatPopupStage.setTitle(Res.get("disputeChat.chatWindowTitle", selectedDispute.getShortTradeId())
+ " " + selectedDispute.getRoleString());
StackPane owner = MainView.getRootContainer();
Scene rootScene = owner.getScene();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ protected void activate() {
else if (sortedList.size() > 0)
tableView.getSelectionModel().select(0);

GUIUtil.requestFocus(filterTextField);
GUIUtil.requestFocus(tableView);
}

@Override
Expand Down Expand Up @@ -905,6 +905,7 @@ protected void setupTable() {
tableView.getSelectionModel().clearSelection();

tableView.getColumns().add(getContractColumn());
maybeAddProcessColumnsForAgent(); // agent view prefers action buttons on the left

TableColumn<Dispute, Dispute> dateColumn = getDateColumn();
tableView.getColumns().add(dateColumn);
Expand All @@ -928,8 +929,8 @@ protected void setupTable() {
stateColumn = getStateColumn();
tableView.getColumns().add(stateColumn);

maybeAddProcessColumn();
tableView.getColumns().add(getChatColumn());
// client view has the chat button to the right
maybeAddChatColumnForClient();

tradeIdColumn.setComparator(Comparator.comparing(Dispute::getTradeId));
dateColumn.setComparator(Comparator.comparing(Dispute::getOpeningDate));
Expand All @@ -941,7 +942,11 @@ protected void setupTable() {
tableView.getSortOrder().add(dateColumn);
}

protected void maybeAddProcessColumn() {
protected void maybeAddProcessColumnsForAgent() {
// Only relevant client views will impl it
}

protected void maybeAddChatColumnForClient() {
// Only relevant client views will impl it
}

Expand All @@ -957,8 +962,8 @@ protected NodeAddress getAgentNodeAddress(Contract contract) {
private TableColumn<Dispute, Dispute> getContractColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("shared.details")) {
{
setMaxWidth(150);
setMinWidth(80);
setMaxWidth(80);
setMinWidth(65);
getStyleClass().addAll("first-column", "avatar-column");
setSortable(false);
}
Expand Down Expand Up @@ -1037,7 +1042,7 @@ public void updateItem(final Dispute item, boolean empty) {
return column;
}

private TableColumn<Dispute, Dispute> getChatColumn() {
protected TableColumn<Dispute, Dispute> getChatColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.chat")) {
{
setMaxWidth(40);
Expand Down Expand Up @@ -1366,6 +1371,8 @@ public void updateItem(final Dispute item, boolean empty) {
setText(newValue ? Res.get("support.closed") : Res.get("support.open"));
if (getTableRow() != null)
getTableRow().setOpacity(newValue && item.getBadgeCountProperty().get() == 0 ? 0.4 : 1);
if (item.isClosed() && item == chatPopup.getSelectedDispute())
chatPopup.closeChat(); // close the chat popup when the associated ticket is closed
};
closedProperty = item.isClosedProperty();
closedProperty.addListener(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ private String getReportMessage(String report, String subString) {
}

@Override
protected void maybeAddProcessColumn() {
protected void maybeAddProcessColumnsForAgent() {
tableView.getColumns().add(getProcessColumn());
tableView.getColumns().add(getChatColumn());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ protected DisputeView.FilterResult getFilterResult(Dispute dispute, String filte
return super.getFilterResult(dispute, filterString);
}

@Override
protected void maybeAddChatColumnForClient() {
tableView.getColumns().add(getChatColumn());
}

@Override
protected boolean senderFlag() {
return false;
Expand Down