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

First UI updates #2

Merged
merged 7 commits into from
Sep 26, 2019
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
14 changes: 12 additions & 2 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ offerbook.offerersAcceptedBankSeats=Accepted seat of bank countries (taker):\n {
offerbook.availableOffers=Available offers
offerbook.filterByCurrency=Filter by currency
offerbook.filterByPaymentMethod=Filter by payment method
offerbook.timeSinceSigning=Time since signing
offerbook.timeSinceSigning.help=By trading with a payment account that was verified by an arbitrator or a peer, your account gets signed as well.\n\
30 days later the initial limit of 0.01 BTC gets lifted and after 90 days your account can sign other peers as well.
offerbook.timeSinceSigning.notSigned=Not signed yet
shared.notSigned=This account hasn't been signed yet.

offerbook.nrOffers=No. of offers: {0}
offerbook.volume={0} (min - max)
Expand Down Expand Up @@ -2490,13 +2495,17 @@ popup.dao.launch.cheaperFees.title=Cheaper fees
popup.dao.launch.cheaperFees=Get a 90% discount on trading fees when you use BSQ. Save money and support the project at the same time!\n\n

popup.accountSigning.selectAccounts.headline=Select payment accounts
popup.accountSigning.selectAccounts.description=Based on the payment method, currency and point of time all payment accounts that are connected to a dispute where a payout to the buyer occured will be selected for you to sign.
popup.accountSigning.selectAccounts.description=Based on the payment method and point of time all payment accounts that are connected to a dispute where a payout to the buyer occurred will be selected for you to sign.
popup.accountSigning.selectAccounts.datePicker=Select point of time until which accounts will be signed

popup.accountSigning.confirmSelectedAccounts.headline=Confirm selected payment accounts
popup.accountSigning.confirmSelectedAccounts.description=Based on your input, {0} payment accounts will be selected.
popup.accountSigning.confirmSelectedAccounts.button=Confirm payment accounts
popup.accountSigning.signAccounts.headline=Confirm signing of payment accounts
popup.accountSigning.signAccounts.description=Based on your selection, {0} payment accounts will be signed.
popup.accountSigning.signAccounts.button=Sign payment accounts
popup.accountSigning.signAccounts.ECKey=Private arbitrator key
popup.accountSigning.signAccounts.ECKey=Enter private arbitrator key
popup.accountSigning.signAccounts.ECKey.error=Bad arbitrator ECKey

popup.accountSigning.success.headline=Congratulations
popup.accountSigning.success.description=All {0} payment accounts were successfully signed!
Expand Down Expand Up @@ -2767,6 +2776,7 @@ payment.accepted.banks=Accepted banks (ID)
payment.mobile=Mobile no.
payment.postal.address=Postal address
payment.national.account.id.AR=CBU number
shared.accountSigningState=Account signing status

#new
payment.altcoin.address.dyn={0} address
Expand Down
9 changes: 9 additions & 0 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -2037,3 +2037,12 @@ textfield */
.status-icon {
-fx-text-fill: -fx-faint-focus-color;
}

/********************************************************************************************************************
* *
* Popover *
* *
********************************************************************************************************************/
.popover > .content {
-fx-padding: 10;
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import javafx.scene.control.TableColumn;
import javafx.scene.layout.HBox;

import javafx.geometry.Insets;

import java.util.concurrent.TimeUnit;

public class AutoTooltipTableColumn<S, T> extends TableColumn<S, T> {
Expand Down Expand Up @@ -67,7 +65,6 @@ public void setTitleWithHelpText(String title, String help) {
final Label helpLabel = new Label(help);
helpLabel.setMaxWidth(300);
helpLabel.setWrapText(true);
helpLabel.setPadding(new Insets(10));
showInfoPopOver(helpLabel);
});
helpIcon.setOnMouseExited(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,41 @@

public class InfoAutoTooltipLabel extends AutoTooltipLabel {

public static final int DEFAULT_WIDTH = 300;
private Node textIcon;
private Boolean hidePopover;
private PopOver infoPopover;
private ContentDisplay contentDisplay;

public InfoAutoTooltipLabel(String text, GlyphIcons icon, ContentDisplay contentDisplay, String info) {
super(text);
this.contentDisplay = contentDisplay;

textIcon = getIcon(icon);
addIcon(contentDisplay, info, 300);
setIcon(icon);
positionAndActivateIcon(contentDisplay, info, DEFAULT_WIDTH);
}

public InfoAutoTooltipLabel(String text, AwesomeIcon icon, ContentDisplay contentDisplay, String info, double width) {
super(text);

setIcon(icon);
positionAndActivateIcon(contentDisplay, info, width);
}

public void setIcon(GlyphIcons icon) {
textIcon = getIcon(icon);
}

public void setIcon(GlyphIcons icon, String info) {
setIcon(icon);
positionAndActivateIcon(contentDisplay, info, DEFAULT_WIDTH);
}

public void setIcon(AwesomeIcon icon) {
textIcon = getIcon(icon);
addIcon(contentDisplay, info, width);
}

private void addIcon(ContentDisplay contentDisplay, String info, double width) {
private void positionAndActivateIcon(ContentDisplay contentDisplay, String info, double width) {
textIcon.setOpacity(0.4);

textIcon.setOnMouseEntered(e -> {
Expand Down
19 changes: 15 additions & 4 deletions desktop/src/main/java/bisq/desktop/components/PeerInfoIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,18 @@ private PeerInfoIcon(NodeAddress nodeAddress,

getChildren().addAll(outerBackground, innerBackground, avatarImageView, tagPane, numTradesPane);

addMouseListener(numTrades, privateNotificationManager, offer, preferences, formatter, useDevPrivilegeKeys, isFiatCurrency, peersAccountAge);
//TODO sqrrm: We need these states in here:
// - signed by arbitrator
// - signed by peer
// - signed by peer and limit lifted
// - signed by peer and able to sign
// - not signing necessary for this payment account
// - signing required and not signed
// Additionally we need to have some enum or so how the account signing took place.
// e.g. if in the future we'll also offer the "pay with two different accounts"-signing
String accountSigningState = Res.get("shared.notSigned");

addMouseListener(numTrades, privateNotificationManager, offer, preferences, formatter, useDevPrivilegeKeys, isFiatCurrency, peersAccountAge, accountSigningState);
}

private long getPeersAccountAge(@Nullable Trade trade, @Nullable Offer offer) {
Expand All @@ -268,17 +279,17 @@ protected void addMouseListener(int numTrades,
Preferences preferences,
BSFormatter formatter,
boolean useDevPrivilegeKeys,
boolean isFiatCurrency,
long makersAccountAge) {
boolean isFiatCurrency, long makersAccountAge, String accountSigningState) {
final String accountAgeTagEditor = isFiatCurrency ?
makersAccountAge > -1 ?
DisplayUtils.formatAccountAge(makersAccountAge) :
Res.get("peerInfo.unknownAge") :
null;

setOnMouseClicked(e -> new PeerInfoWithTagEditor(privateNotificationManager, offer, preferences, useDevPrivilegeKeys)
.fullAddress(fullAddress)
.numTrades(numTrades)
.accountAge(accountAgeTagEditor)
.accountAge(accountAgeTagEditor).accountSigningState(accountSigningState)
.position(localToScene(new Point2D(0, 0)))
.onSave(newTag -> {
preferences.setTagForPeer(fullAddress, newTag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ protected void addMouseListener(int numTrades,
Offer offer, Preferences preferences,
BSFormatter formatter,
boolean useDevPrivilegeKeys,
boolean isFiatCurrency,
long makersAccountAge) {
boolean isFiatCurrency, long makersAccountAge, String accountSigningState) {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,29 @@ else if (!paymentAccount.getTradeCurrencies().isEmpty())
paymentAccount, tradeCurrency.getCode(), OfferPayload.Direction.SELL))),
DisplayUtils.formatAccountAge(accountAge));

if (isDisplayForm)
if (isDisplayForm) {
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);

String accountSigningStateText;

if (accountAgeWitnessService.myHasSignedWitness(paymentAccount.getPaymentAccountPayload())) {
//TODO sqrrm: We need four states in here:
// - signed by arbitrator
// - signed by peer
// - signed by peer and limit lifted
// - signed by peer and able to sign
// Additionally we need to have some enum or so how the account signing took place.
// e.g. if in the future we'll also offer the "pay with two different accounts"-signing
accountSigningStateText = "This account was verified and signed by an arbitrator or peer / Time since signing: 3 days";
} else {
//TODO sqrrm: Here we need two states:
// - not signing necessary for this payment account
// - signing required and not signed
accountSigningStateText = Res.get("shared.notSigned");
}

addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.accountSigningState"), accountSigningStateText);
}
else
addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.limitations"), limitationsText);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import bisq.desktop.common.view.ActivatableViewAndModel;
import bisq.desktop.components.AutoTooltipButton;
import bisq.desktop.components.AutoTooltipLabel;
import bisq.desktop.components.InfoAutoTooltipLabel;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.ImageUtil;

Expand All @@ -14,8 +15,11 @@

import bisq.common.UserThread;

import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
Expand Down Expand Up @@ -93,28 +97,39 @@ protected void setPaymentAccountsCellFactory() {
@Override
public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
return new ListCell<>() {
final Label label = new AutoTooltipLabel();
final InfoAutoTooltipLabel label = new InfoAutoTooltipLabel("", MaterialDesignIcon.ALERT_CIRCLE_OUTLINE, ContentDisplay.RIGHT, "");
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final ImageView signed = ImageUtil.getImageViewById("image-update-failed");
final AnchorPane pane = new AnchorPane(label, signed, removeButton);
final AnchorPane pane = new AnchorPane(label, removeButton);

{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
AnchorPane.setRightAnchor(signed, removeButton.getWidth());
}

@Override
public void updateItem(final PaymentAccount item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getAccountName());

if (accountAgeWitnessService.myHasSignedWitness(item.paymentAccountPayload)) {
//TODO sqrrm: We need four states in here:
// - signed by arbitrator
// - signed by peer
// - signed by peer and limit lifted
// - signed by peer and able to sign
// Additionally we need to have some enum or so how the account signing took place.
// e.g. if in the future we'll also offer the "pay with two different accounts"-signing
label.setIcon(MaterialDesignIcon.APPROVAL, "This account was verified and signed by an arbitrator or peer.");
} else {
//TODO sqrrm: Here we need two states:
// - not signing necessary for this payment account
// - signing required and not signed
label.setIcon(MaterialDesignIcon.ALERT_CIRCLE_OUTLINE, Res.get("shared.notSigned"));
}
removeButton.setOnAction(e -> onDeleteAccount(item));
String signedWitnessId = accountAgeWitnessService.myHasSignedWitness(
item.paymentAccountPayload) ? "image-tick" : "rejected";
signed.setId(signedWitnessId);
setGraphic(pane);
} else {
setGraphic(null);
Expand Down
Loading