Merge pull request #5370 from jmacxx/mediation_follow_up_issues2

Disputes UI improvements
This commit is contained in:
Christoph Atteneder 2021-04-13 11:16:38 +02:00 committed by GitHub
commit 64fe6c18a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 11 deletions

View File

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

View File

@ -2003,6 +2003,10 @@ textfield */
-fx-font-size: 0.846em;
}
.dispute-chat-border {
-fx-background-color: -bs-color-blue-5;
}
/********************************************************************************************************************
* *
* DAO *

View File

@ -46,6 +46,8 @@ import javafx.scene.layout.StackPane;
import javafx.beans.value.ChangeListener;
import lombok.Getter;
public class DisputeChatPopup {
public interface ChatCallback {
void onCloseDisputeFromChatWindow(Dispute dispute);
@ -60,6 +62,7 @@ public class DisputeChatPopup {
private double chatPopupStageYPosition = -1;
private ChangeListener<Number> xPositionListener;
private ChangeListener<Number> yPositionListener;
@Getter private Dispute selectedDispute;
DisputeChatPopup(DisputeManager<? extends DisputeList<Dispute>> disputeManager,
CoinFormatter formatter,
@ -78,10 +81,12 @@ public class DisputeChatPopup {
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();
@ -96,7 +101,7 @@ public class DisputeChatPopup {
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"));
@ -106,7 +111,7 @@ public class DisputeChatPopup {
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();

View File

@ -350,7 +350,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
else if (sortedList.size() > 0)
tableView.getSelectionModel().select(0);
GUIUtil.requestFocus(filterTextField);
GUIUtil.requestFocus(tableView);
}
@Override
@ -905,6 +905,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
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);
@ -928,8 +929,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
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));
@ -941,7 +942,11 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
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
}
@ -957,8 +962,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
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);
}
@ -1037,7 +1042,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
return column;
}
private TableColumn<Dispute, Dispute> getChatColumn() {
protected TableColumn<Dispute, Dispute> getChatColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<>(Res.get("support.chat")) {
{
setMaxWidth(40);
@ -1366,6 +1371,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
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);

View File

@ -348,8 +348,9 @@ public abstract class DisputeAgentView extends DisputeView implements MultipleHo
}
@Override
protected void maybeAddProcessColumn() {
protected void maybeAddProcessColumnsForAgent() {
tableView.getColumns().add(getProcessColumn());
tableView.getColumns().add(getChatColumn());
}
@Override

View File

@ -66,6 +66,11 @@ public abstract class DisputeClientView extends DisputeView {
return super.getFilterResult(dispute, filterString);
}
@Override
protected void maybeAddChatColumnForClient() {
tableView.getColumns().add(getChatColumn());
}
@Override
protected boolean senderFlag() {
return false;