Skip to content

Commit

Permalink
Merge pull request #2875 from axpoems/imp-rep-popups
Browse files Browse the repository at this point in the history
Imp rep popups
  • Loading branch information
HenrikJannsen authored Sep 29, 2024
2 parents 87483b7 + a8126b0 commit e4c7f43
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,65 +18,79 @@
package bisq.desktop.main.content.reputation.build_reputation;

import bisq.desktop.common.view.View;
import bisq.desktop.components.containers.Spacer;
import bisq.desktop.components.controls.BisqMenuItem;
import bisq.i18n.Res;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BuildReputationView extends View<VBox, BuildReputationModel, BuildReputationController> {
private final Button burnBsqButton, bsqBondButton, accountAgeButton, signedAccountButton;
private final Hyperlink learnMore;
private final BisqMenuItem learnMore;

public BuildReputationView(BuildReputationModel model, BuildReputationController controller) {
super(new VBox(), model, controller);

Label headlineLabel = new Label(Res.get("reputation.headline"));
headlineLabel.getStyleClass().add("bisq-text-headline-5");

Label info = new Label(Res.get("reputation.info"));
info.setWrapText(true);
info.getStyleClass().addAll("bisq-text-13");
info.setMinHeight(220);

burnBsqButton = new Button(Res.get("reputation.burnBsq"));
burnBsqButton.getStyleClass().add("button-reduced-padding");
burnBsqButton.setPrefWidth(140);

bsqBondButton = new Button(Res.get("reputation.bond"));
bsqBondButton.getStyleClass().add("button-reduced-padding");
bsqBondButton.setPrefWidth(130);

signedAccountButton = new Button(Res.get("reputation.signedWitness"));
signedAccountButton.getStyleClass().add("button-reduced-padding");
signedAccountButton.setPrefWidth(230);

accountAgeButton = new Button(Res.get("reputation.accountAge"));
accountAgeButton.getStyleClass().add("button-reduced-padding");
accountAgeButton.setPrefWidth(140);

learnMore = new Hyperlink(Res.get("action.learnMore"));

HBox buttons = new HBox(20, burnBsqButton, bsqBondButton, signedAccountButton, accountAgeButton);

VBox.setMargin(headlineLabel, new Insets(20, 0, 0, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
VBox vBox = new VBox(10, headlineLabel, info, buttons, learnMore);
vBox.getStyleClass().add("bisq-box-2");
vBox.setPadding(new Insets(30, 30, 20, 30));
vBox.setAlignment(Pos.TOP_LEFT);

VBox.setMargin(vBox, new Insets(0, 0, 20, 0));
VBox.setVgrow(vBox, Priority.SOMETIMES);
root.setPadding(new Insets(0, 40, 40, 40));
root.getChildren().addAll(vBox);
root.getStyleClass().add("build-reputation");
Label headlineLabel = new Label(Res.get("reputation.buildReputation.headline"));
headlineLabel.getStyleClass().add("reputation-headline");

Label introLabelPart1 = new Label(Res.get("reputation.buildReputation.intro.part1"));
Label introLabelPart2 = new Label(Res.get("reputation.buildReputation.intro.part2"));

Label title = new Label(Res.get("reputation.buildReputation.title"));
title.getStyleClass().add("reputation-title");

// Burn BSQ
burnBsqButton = new Button(Res.get("reputation.buildReputation.burnBsq.button"));
VBox burnBsqBox = createAndGetBuildReputationMethodBox(
Res.get("reputation.buildReputation.burnBsq.title"),
Res.get("reputation.buildReputation.burnBsq.description"),
burnBsqButton
);

// BSQ Bond
bsqBondButton = new Button(Res.get("reputation.buildReputation.bsqBond.button"));
VBox bsqBondBox = createAndGetBuildReputationMethodBox(
Res.get("reputation.buildReputation.bsqBond.title"),
Res.get("reputation.buildReputation.bsqBond.description"),
bsqBondButton
);

HBox burnAndBondBox = new HBox(20, burnBsqBox, bsqBondBox);

// Signed Account
signedAccountButton = new Button(Res.get("reputation.buildReputation.signedAccount.button"));
VBox signedAccountBox = createAndGetBuildReputationMethodBox(
Res.get("reputation.buildReputation.signedAccount.title"),
Res.get("reputation.buildReputation.signedAccount.description"),
signedAccountButton
);

// Account Age
accountAgeButton = new Button(Res.get("reputation.buildReputation.accountAge.button"));
VBox accountAgeBox = createAndGetBuildReputationMethodBox(
Res.get("reputation.buildReputation.accountAge.title"),
Res.get("reputation.buildReputation.accountAge.description"),
accountAgeButton
);

HBox signedAccountAndAgeBox = new HBox(20, signedAccountBox, accountAgeBox);

learnMore = new BisqMenuItem(Res.get("reputation.buildReputation.readMore"));
learnMore.getStyleClass().add("reputation-learn-more");

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headlineLabel, introLabelPart1, introLabelPart2, title, burnAndBondBox,
signedAccountAndAgeBox, learnMore);
contentBox.getStyleClass().add("bisq-common-bg");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(0, 40, 20, 40));
root.getStyleClass().add("reputation");
}

@Override
Expand All @@ -96,4 +110,17 @@ protected void onViewDetached() {
accountAgeButton.setOnAction(null);
learnMore.setOnAction(null);
}

private VBox createAndGetBuildReputationMethodBox(String title, String description, Button button) {
Label titleLabel = new Label(title);
titleLabel.getStyleClass().add("card-title");
Label descriptionLabel = new Label(description);
button.getStyleClass().addAll("medium-large-button");
button.setMaxWidth(Double.MAX_VALUE);
button.setDefaultButton(true);
VBox vBox = new VBox(20, titleLabel, descriptionLabel, Spacer.fillVBox(), button);
vBox.setFillWidth(true);
vBox.getStyleClass().add("reputation-card-small");
return vBox;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public AccountAgeTab1View(AccountAgeTab1Model model,
AccountAgeTab1Controller controller) {
super(new VBox(), model, controller);

root.setSpacing(20);
root.setAlignment(Pos.TOP_LEFT);

Label headline = new Label(Res.get("reputation.accountAge.infoHeadline"));
headline.getStyleClass().add("bisq-text-headline-2");

Expand All @@ -66,7 +63,12 @@ public AccountAgeTab1View(AccountAgeTab1Model model,
VBox.setMargin(headline, new Insets(10, 0, 0, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
VBox.setMargin(headline2, new Insets(20, 0, 0, 0));
root.getChildren().addAll(headline, info, headline2, info2, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, headline2, info2, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,13 @@ private static class Model implements bisq.desktop.common.view.Model {
}

private static class View extends bisq.desktop.common.view.View<VBox, Model, Controller> {
private static final double MATERIAL_FIELD_WIDTH = 280;

private final AgeSlider simAgeSlider;
private final MaterialTextField simScore;
private final MaterialTextField ageField;

private View(Model model,
Controller controller) {
private View(Model model, Controller controller) {
super(new VBox(10), model, controller);

Label simHeadline = new Label(Res.get("reputation.sim.headline"));
Expand Down Expand Up @@ -137,15 +138,15 @@ protected void onViewDetached() {
private MaterialTextField getField(String description) {
MaterialTextField field = new MaterialTextField(description);
field.setEditable(false);
field.setMinWidth(380);
field.setMaxWidth(380);
field.setMinWidth(MATERIAL_FIELD_WIDTH);
field.setMaxWidth(MATERIAL_FIELD_WIDTH);
return field;
}

private MaterialTextField getInputField(String key) {
MaterialTextField field = new MaterialTextField(Res.get(key), Res.get(key + ".prompt"));
field.setMinWidth(380);
field.setMaxWidth(380);
field.setMinWidth(MATERIAL_FIELD_WIDTH);
field.setMaxWidth(MATERIAL_FIELD_WIDTH);
return field;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public class AccountAgeTab2View extends View<VBox, AccountAgeTab2Model, AccountA
public AccountAgeTab2View(AccountAgeTab2Model model, AccountAgeTab2Controller controller, VBox simulation) {
super(new VBox(), model, controller);

root.setSpacing(20);
root.setAlignment(Pos.TOP_LEFT);

Label headline = new Label(Res.get("reputation.accountAge.score.headline"));
headline.getStyleClass().add("bisq-text-headline-2");

Expand All @@ -68,7 +65,12 @@ public AccountAgeTab2View(AccountAgeTab2Model model, AccountAgeTab2Controller co

VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
VBox.setMargin(headline, new Insets(10, 0, 0, 0));
root.getChildren().addAll(headline, info, hBox, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, hBox, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ public AccountAgeTab3View(AccountAgeTab3Model model,
Pane userProfileSelection) {
super(new VBox(), model, controller);

root.setSpacing(5);
root.setAlignment(Pos.TOP_LEFT);
root.getStyleClass().add("account-age");

VBox stepOne = createAndGetStepOne(userProfileSelection);
VBox stepTwo = createAndGetStepTwo();
VBox stepThree = createAndGetStepThree();
Expand All @@ -69,7 +65,12 @@ public AccountAgeTab3View(AccountAgeTab3Model model,
HBox buttons = new HBox(20, backButton, closeButton, Spacer.fillHBox(), learnMore);
buttons.setAlignment(Pos.BOTTOM_RIGHT);

root.getChildren().addAll(stepOne, stepTwo, stepThree, stepFour, requestCertificateButton, buttons);
VBox contentBox = new VBox(30);
contentBox.getChildren().addAll(stepOne, stepTwo, stepThree, stepFour, requestCertificateButton, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
root.getStyleClass().add("account-age");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public BondedReputationTab1View(BondedReputationTab1Model model,
BondedReputationTab1Controller controller) {
super(new VBox(), model, controller);

root.setSpacing(20);
root.setAlignment(Pos.TOP_LEFT);

Label headline = new Label(Res.get("reputation.bond.infoHeadline"));
headline.getStyleClass().add("bisq-text-headline-2");

Expand All @@ -66,7 +63,12 @@ public BondedReputationTab1View(BondedReputationTab1Model model,
VBox.setMargin(headline, new Insets(10, 0, 0, 0));
VBox.setMargin(headline2, new Insets(20, 0, 0, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
root.getChildren().addAll(headline, info, headline2, info2, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, headline2, info2, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ private static class Model implements bisq.desktop.common.view.Model {
}

private static class View extends bisq.desktop.common.view.View<VBox, Model, Controller> {
private static final double MATERIAL_FIELD_WIDTH = 260;

private final MaterialTextField amount;
private final MaterialTextField score;
private final AgeSlider simAgeSlider;
private final MaterialTextField ageField;

private View(Model model,
Controller controller) {
private View(Model model, Controller controller) {
super(new VBox(10), model, controller);

Label simHeadline = new Label(Res.get("reputation.sim.headline"));
Expand Down Expand Up @@ -153,16 +154,16 @@ protected void onViewDetached() {
private MaterialTextField getField(String description) {
MaterialTextField field = new MaterialTextField(description);
field.setEditable(false);
field.setMinWidth(380);
field.setMaxWidth(380);
field.setMinWidth(MATERIAL_FIELD_WIDTH);
field.setMaxWidth(MATERIAL_FIELD_WIDTH);
return field;
}

private MaterialTextField getInputField(String key) {
MaterialTextField field = new MaterialTextField(Res.get(key), Res.get(key + ".prompt"));
field.setMinWidth(380);
field.setMaxWidth(380);
field.setMinWidth(MATERIAL_FIELD_WIDTH);
field.setMaxWidth(MATERIAL_FIELD_WIDTH);
return field;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public class BondedReputationTab2View extends View<VBox, BondedReputationTab2Mod
public BondedReputationTab2View(BondedReputationTab2Model model, BondedReputationTab2Controller controller, VBox simulation) {
super(new VBox(), model, controller);

root.setSpacing(20);
root.setAlignment(Pos.TOP_LEFT);

Label headline = new Label(Res.get("reputation.bond.score.headline"));
headline.getStyleClass().add("bisq-text-headline-2");

Expand Down Expand Up @@ -70,7 +67,12 @@ public BondedReputationTab2View(BondedReputationTab2Model model, BondedReputatio

VBox.setMargin(headline, new Insets(10, 0, 0, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
root.getChildren().addAll(headline, info, hBox, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, hBox, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

private MaterialTextField getField(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ public BondedReputationTab3View(BondedReputationTab3Model model,
Pane userProfileSelection) {
super(new VBox(), model, controller);

root.setSpacing(20);
root.setAlignment(Pos.TOP_LEFT);

Label headline = new Label(Res.get("reputation.bond.howToHeadline"));
headline.getStyleClass().add("bisq-text-headline-2");

OrderedList info = new OrderedList(Res.get("reputation.bond.howTo"), "bisq-text-13");
OrderedList info = new OrderedList(Res.get("reputation.bond.howTo"), "bisq-text-13", 7, 7);

Label userProfileSelectLabel = new Label(Res.get("user.bondedRoles.userProfile.select").toUpperCase());
userProfileSelectLabel.getStyleClass().add("bisq-text-4");
Expand All @@ -73,12 +70,18 @@ public BondedReputationTab3View(BondedReputationTab3Model model,
VBox.setMargin(userProfileSelectLabel, new Insets(10, 0, -20, 0));
VBox.setMargin(userProfileSelection, new Insets(0, 0, -30, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
root.getChildren().addAll(headline, info, userProfileSelectLabel, userProfileSelection, pubKeyHash, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, userProfileSelectLabel, userProfileSelection, pubKeyHash, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

@Override
protected void onViewAttached() {
pubKeyHash.textProperty().bind(model.getPubKeyHash());

pubKeyHash.getIconButton().setOnAction(e -> controller.onCopyToClipboard(pubKeyHash.getText()));
closeButton.setOnAction(e -> controller.onClose());
backButton.setOnAction(e -> controller.onBack());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ public class BurnBsqTab1View extends View<VBox, BurnBsqTab1Model, BurnBsqTab1Con

public BurnBsqTab1View(BurnBsqTab1Model model,
BurnBsqTab1Controller controller) {
super(new VBox(20), model, controller);

root.setAlignment(Pos.TOP_LEFT);
super(new VBox(), model, controller);

Label headline = new Label(Res.get("reputation.burnedBsq.infoHeadline"));
headline.getStyleClass().add("bisq-text-headline-2");
Expand All @@ -65,7 +63,12 @@ public BurnBsqTab1View(BurnBsqTab1Model model,
VBox.setMargin(headline, new Insets(10, 0, 0, 0));
VBox.setMargin(buttons, new Insets(10, 0, 0, 0));
VBox.setMargin(headline2, new Insets(20, 0, 0, 0));
root.getChildren().addAll(headline, info, headline2, info2, buttons);

VBox contentBox = new VBox(20);
contentBox.getChildren().addAll(headline, info, headline2, info2, buttons);
contentBox.getStyleClass().addAll("bisq-common-bg", "common-line-spacing");
root.getChildren().addAll(contentBox);
root.setPadding(new Insets(20, 0, 0, 0));
}

@Override
Expand Down
Loading

0 comments on commit e4c7f43

Please sign in to comment.