Skip to content

Commit

Permalink
Merge pull request #3254 from ripcurlx/improve-mediation-ui
Browse files Browse the repository at this point in the history
Improve mediation ui
  • Loading branch information
ripcurlx authored Sep 13, 2019
2 parents a09557f + 690ceb0 commit 12809a3
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 25 deletions.
12 changes: 10 additions & 2 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,15 @@ portfolio.pending.support.headline.getHelp=Need help?
portfolio.pending.support.text.getHelp=If you have any problems you can try to contact the trade peer in the trade \
chat or ask the Bisq community at https://bisq.community. \
If your issue still isn't resolved, you can request more help from a mediator.
portfolio.pending.support.text.getHelp.arbitrator=If you have any problems you can try to contact the trade peer in the trade \
chat or ask the Bisq community at https://bisq.community. \
If your issue still isn't resolved, you can request more help from an arbitrator.
portfolio.pending.support.button.getHelp=Get support
portfolio.pending.support.popup.info=If your issue with the trade remains unsolved, you can open a support \
ticket to request help from the mediator. If you have not received the payment, please wait until the trade period is over.\n\n\
ticket to request help from a mediator. If you have not received the payment, please wait until the trade period is over.\n\n\
Are you sure you want to open a support ticket?
portfolio.pending.support.popup.info.arbitrator=If your issue with the trade remains unsolved, you can open a support \
ticket to request help from an arbitrator. If you have not received the payment, please wait until the trade period is over.\n\n\
Are you sure you want to open a support ticket?
portfolio.pending.support.popup.button=Open support ticket
portfolio.pending.support.headline.halfPeriodOver=Check payment
Expand Down Expand Up @@ -791,7 +797,7 @@ portfolio.pending.mediationResult.headline=Suggested payout from mediation
portfolio.pending.mediationResult.info.noneAccepted=Complete the trade by accepting the mediator's suggestion for the trade payout.
portfolio.pending.mediationResult.info.selfAccepted=You have accepted the mediator's suggestion. Waiting for peer to accept as well.
portfolio.pending.mediationResult.info.peerAccepted=Your trade peer has accepted the mediator's suggestion. Do you accept as well?
portfolio.pending.mediationResult.button=Accept or reject
portfolio.pending.mediationResult.button=View proposed resolution
portfolio.pending.mediationResult.popup.headline=Mediation result for trade with ID: {0}
portfolio.pending.mediationResult.popup.headline.peerAccepted=Your trade peer has accepted the mediator''s suggestion for trade {0}
portfolio.pending.mediationResult.popup.info=The mediator has suggested the following payout:\n\
Expand Down Expand Up @@ -2197,6 +2203,8 @@ Summary:\n\
Payout amount for BTC buyer: {1}\n\
Payout amount for BTC seller: {2}\n\n\
Summary notes:\n{3}
disputeSummaryWindow.close.nextStepsForMediation=\n\nNext steps:\n
Open ongoing trade and accept or reject the suggested mediation
disputeSummaryWindow.close.closePeer=You need to close also the trading peers ticket!

emptyWalletWindow.headline={0} emergency wallet tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ private void addButtons(Contract contract) {
formatter.formatCoinWithCode(disputeResult.getSellerPayoutAmount()),
disputeResult.summaryNotesProperty().get());

if (dispute.isMediationDispute()) {
text += Res.get("disputeSummaryWindow.close.nextStepsForMediation");
}

getDisputeManager(dispute).sendDisputeResultMessage(disputeResult, dispute, text);

if (peersDisputeOptional.isPresent() && !peersDisputeOptional.get().isClosed() && !DevEnv.isDevMode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import bisq.desktop.components.TitledGroupBg;

import bisq.core.locale.Res;
import bisq.core.support.dispute.mediation.MediationManager;
import bisq.core.trade.Trade;

import javafx.scene.control.Label;
Expand Down Expand Up @@ -51,7 +52,8 @@ public enum State {
IN_ARBITRATION_SELF_REQUESTED,
IN_ARBITRATION_PEER_REQUESTED,
WARN_HALF_PERIOD,
WARN_PERIOD_OVER
WARN_PERIOD_OVER,
TRADE_COMPLETED
}

private final TitledGroupBg titledGroupBg;
Expand All @@ -62,7 +64,7 @@ public enum State {
private Trade trade;
@Getter
private State state = State.UNDEFINED;
private Supplier<String> fistHalfOverWarnTextSupplier = () -> "";
private Supplier<String> firstHalfOverWarnTextSupplier = () -> "";
private Supplier<String> periodOverWarnTextSupplier = () -> "";

TradeStepInfo(TitledGroupBg titledGroupBg, Label label, AutoTooltipButton button) {
Expand All @@ -84,8 +86,8 @@ public void setOnAction(EventHandler<ActionEvent> e) {
button.setOnAction(e);
}

public void setFistHalfOverWarnTextSupplier(Supplier<String> fistHalfOverWarnTextSupplier) {
this.fistHalfOverWarnTextSupplier = fistHalfOverWarnTextSupplier;
public void setFirstHalfOverWarnTextSupplier(Supplier<String> firstHalfOverWarnTextSupplier) {
this.firstHalfOverWarnTextSupplier = firstHalfOverWarnTextSupplier;
}

public void setPeriodOverWarnTextSupplier(Supplier<String> periodOverWarnTextSupplier) {
Expand All @@ -100,7 +102,8 @@ public void setState(State state) {
case SHOW_GET_HELP_BUTTON:
// grey button
titledGroupBg.setText(Res.get("portfolio.pending.support.headline.getHelp"));
label.setText(Res.get("portfolio.pending.support.text.getHelp"));
label.setText(MediationManager.isMediationActivated() ?
Res.get("portfolio.pending.support.text.getHelp") : Res.get("portfolio.pending.support.text.getHelp.arbitrator"));
button.setText(Res.get("portfolio.pending.support.button.getHelp").toUpperCase());
button.setId(null);
button.getStyleClass().remove("action-button");
Expand Down Expand Up @@ -172,7 +175,7 @@ public void setState(State state) {
case WARN_HALF_PERIOD:
// orange button
titledGroupBg.setText(Res.get("portfolio.pending.support.headline.halfPeriodOver"));
label.setText(fistHalfOverWarnTextSupplier.get());
label.setText(firstHalfOverWarnTextSupplier.get());
button.setText(Res.get("portfolio.pending.openSupport").toUpperCase());
button.setId(null);
button.getStyleClass().remove("action-button");
Expand All @@ -187,6 +190,11 @@ public void setState(State state) {
button.getStyleClass().remove("action-button");
button.setDisable(false);
break;
case TRADE_COMPLETED:
// hide group
titledGroupBg.setVisible(false);
label.setVisible(false);
button.setVisible(false);
}

if (trade != null && trade.getPayoutTx() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import bisq.core.locale.Res;
import bisq.core.support.dispute.Dispute;
import bisq.core.support.dispute.DisputeResult;
import bisq.core.support.dispute.mediation.MediationManager;
import bisq.core.trade.Contract;
import bisq.core.trade.Trade;
import bisq.core.user.DontShowAgainLookup;
Expand Down Expand Up @@ -212,7 +213,8 @@ public void activate() {

if (!isMediationClosedState()) {
tradeStepInfo.setOnAction(e -> {
new Popup<>().attention(Res.get("portfolio.pending.support.popup.info"))
new Popup<>().attention(MediationManager.isMediationActivated() ?
Res.get("portfolio.pending.support.popup.info") : Res.get("portfolio.pending.support.popup.info.arbitrator"))
.actionButtonText(Res.get("portfolio.pending.support.popup.button"))
.onAction(this::openSupportTicket)
.closeButtonText(Res.get("shared.cancel"))
Expand Down Expand Up @@ -339,7 +341,6 @@ protected void addInfoBlock() {
GridPane.setColumnSpan(titledGroupBg, 2);

infoLabel = addMultilineLabel(gridPane, gridRow, "", Layout.COMPACT_FIRST_ROW_AND_COMPACT_GROUP_DISTANCE);
// infoLabel = addMultilineLabel(gridPane, gridRow, "", 0);
GridPane.setColumnSpan(infoLabel, 2);
}

Expand Down Expand Up @@ -380,12 +381,15 @@ private void updateTimeLeft() {
public void setTradeStepInfo(TradeStepInfo tradeStepInfo) {
this.tradeStepInfo = tradeStepInfo;

tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
tradeStepInfo.setPeriodOverWarnTextSupplier(this::getPeriodOverWarnText);
}

protected void hideTradeStepInfo() {
tradeStepInfo.setState(TradeStepInfo.State.TRADE_COMPLETED);
}

protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
return "";
}

Expand All @@ -409,7 +413,7 @@ private void updateDisputeState(Trade.DisputeState disputeState) {
break;
case DISPUTE_REQUESTED:
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
applyOnDisputeOpened();

Expand All @@ -422,7 +426,7 @@ private void updateDisputeState(Trade.DisputeState disputeState) {
break;
case DISPUTE_STARTED_BY_PEER:
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
applyOnDisputeOpened();

Expand All @@ -436,7 +440,7 @@ private void updateDisputeState(Trade.DisputeState disputeState) {
break;
case MEDIATION_REQUESTED:
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
applyOnDisputeOpened();

Expand All @@ -449,7 +453,7 @@ private void updateDisputeState(Trade.DisputeState disputeState) {
break;
case MEDIATION_STARTED_BY_PEER:
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
applyOnDisputeOpened();

Expand Down Expand Up @@ -595,13 +599,13 @@ private void updateTradePeriodState(Trade.TradePeriodState tradePeriodState) {
tradeStepInfo.setState(TradeStepInfo.State.WARN_HALF_PERIOD);
} else if (tradeStepInfo.getState() == TradeStepInfo.State.WARN_HALF_PERIOD) {
tradeStepInfo.setState(TradeStepInfo.State.SHOW_GET_HELP_BUTTON);
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
}
break;
case SECOND_HALF:
if (!trade.isFiatReceived()) {
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getFistHalfOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getFirstHalfOverWarnText);
tradeStepInfo.setState(TradeStepInfo.State.WARN_HALF_PERIOD);
}
} else {
Expand All @@ -610,7 +614,7 @@ private void updateTradePeriodState(Trade.TradePeriodState tradePeriodState) {
break;
case TRADE_PERIOD_OVER:
if (tradeStepInfo != null) {
tradeStepInfo.setFistHalfOverWarnTextSupplier(this::getPeriodOverWarnText);
tradeStepInfo.setFirstHalfOverWarnTextSupplier(this::getPeriodOverWarnText);
tradeStepInfo.setState(TradeStepInfo.State.WARN_PERIOD_OVER);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected String getInfoText() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
return Res.get("portfolio.pending.step1.warn");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ protected void addContent() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
return Res.get("portfolio.pending.step2_buyer.warn",
model.dataModel.getCurrencyCode(),
model.getDateForOpenDispute());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void updateMessageStateInfo() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
String substitute = model.isBlockChainMethod() ?
Res.get("portfolio.pending.step3_buyer.warn.part1a", model.dataModel.getCurrencyCode()) :
Res.get("portfolio.pending.step3_buyer.warn.part1b");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public BuyerStep4View(PendingTradesViewModel model) {
@Override
public void activate() {
super.activate();
// Don't display any trade step info when trade is complete
hideTradeStepInfo();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected String getInfoText() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
return Res.get("portfolio.pending.step1.warn");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected String getInfoText() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
return Res.get("portfolio.pending.step2_seller.warn",
model.dataModel.getCurrencyCode(),
model.getDateForOpenDispute());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ protected String getInfoText() {
///////////////////////////////////////////////////////////////////////////////////////////

@Override
protected String getFistHalfOverWarnText() {
protected String getFirstHalfOverWarnText() {
String substitute = model.isBlockChainMethod() ?
Res.get("portfolio.pending.step3_seller.warn.part1a", model.dataModel.getCurrencyCode()) :
Res.get("portfolio.pending.step3_seller.warn.part1b");
Expand Down

0 comments on commit 12809a3

Please sign in to comment.