mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 06:55:08 +01:00
Improve layout
This commit is contained in:
parent
4c46b3865b
commit
ff21c916fa
4 changed files with 50 additions and 15 deletions
|
@ -2075,6 +2075,17 @@ textfield */
|
|||
-fx-text-fill: -bs-rd-error-red;
|
||||
}
|
||||
|
||||
.dao-kpi-big {
|
||||
-fx-font-size: 1.923em;
|
||||
-fx-text-fill: -bs-rd-black;
|
||||
-fx-font-family: "IBM Plex Sans Light";
|
||||
}
|
||||
|
||||
.dao-kpi-subtext {
|
||||
-fx-text-fill: -bs-rd-font-light;
|
||||
-fx-font-size: 0.923em;
|
||||
}
|
||||
|
||||
/********************************************************************************************************************
|
||||
* *
|
||||
* Notifications *
|
||||
|
|
|
@ -19,7 +19,6 @@ package bisq.desktop.main.dao.economy.dashboard;
|
|||
|
||||
import bisq.desktop.common.view.ActivatableView;
|
||||
import bisq.desktop.common.view.FxmlView;
|
||||
import bisq.desktop.components.TitledGroupBg;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
|
||||
import bisq.core.dao.DaoFacade;
|
||||
|
@ -75,9 +74,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelWithSubText;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField;
|
||||
import static bisq.desktop.util.Layout.FIRST_ROW_DISTANCE;
|
||||
|
||||
|
||||
|
||||
|
@ -103,7 +101,8 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
|
|||
private XYChart.Series<Number, Number> seriesBSQAdded, seriesBSQBurnt;
|
||||
private XYChart.Series<Number, Number> seriesBSQPrice;
|
||||
|
||||
private TextField marketCapTextField, priceTextField, availableAmountTextField;
|
||||
private TextField marketCapTextField, availableAmountTextField;
|
||||
private Label marketPriceLabel;
|
||||
|
||||
private Coin availableAmount;
|
||||
|
||||
|
@ -143,14 +142,11 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
|
|||
|
||||
private void createKPIs() {
|
||||
|
||||
TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 5, Res.get("dao.factsAndFigures.dashboard.marketPrice"));
|
||||
titledGroupBg.getStyleClass().add("last");
|
||||
Tuple3<Label, Label, VBox> marketPriceBox = addLabelWithSubText(root, gridRow++, "0.004000 BSQ/BTC", "Latest BSQ/BTC trade price (in Bisq)");
|
||||
marketPriceLabel = marketPriceBox.first;
|
||||
marketPriceLabel.getStyleClass().add("dao-kpi-big");
|
||||
|
||||
Tuple3<Label, TextField, VBox> marketPriceTuple = addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.factsAndFigures.dashboard.price"),
|
||||
FIRST_ROW_DISTANCE);
|
||||
priceTextField = marketPriceTuple.second;
|
||||
|
||||
GridPane.setColumnSpan(marketPriceTuple.third, 2);
|
||||
marketPriceBox.second.getStyleClass().add("dao-kpi-subtext");
|
||||
|
||||
marketCapTextField = addTopLabelReadOnlyTextField(root, ++gridRow,
|
||||
Res.get("dao.factsAndFigures.dashboard.marketCap")).second;
|
||||
|
@ -258,6 +254,7 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
|
|||
|
||||
GridPane.setRowIndex(chartPane, ++gridRow);
|
||||
GridPane.setColumnSpan(chartPane, 2);
|
||||
GridPane.setMargin(chartPane, new Insets(10, 0, 0, 0));
|
||||
|
||||
root.getChildren().addAll(chartPane);
|
||||
}
|
||||
|
@ -310,13 +307,16 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
|
|||
Optional<Price> optionalBsqPrice = priceFeedService.getBsqPrice();
|
||||
if (optionalBsqPrice.isPresent()) {
|
||||
Price bsqPrice = optionalBsqPrice.get();
|
||||
priceTextField.setText(bsqFormatter.formatPrice(bsqPrice) + " BSQ/BTC");
|
||||
marketPriceLabel.setText(bsqFormatter.formatPrice(bsqPrice) + " BSQ/BTC");
|
||||
|
||||
marketCapTextField.setText(bsqFormatter.formatMarketCap(priceFeedService.getMarketPrice("BSQ"),
|
||||
priceFeedService.getMarketPrice(preferences.getPreferredTradeCurrency().getCode()),
|
||||
availableAmount));
|
||||
|
||||
updateChartData();
|
||||
|
||||
} else {
|
||||
priceTextField.setText(Res.get("shared.na"));
|
||||
marketPriceLabel.setText(Res.get("shared.na"));
|
||||
marketCapTextField.setText(Res.get("shared.na"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
daoFacade.addBsqStateListener(this);
|
||||
|
||||
updateWithBsqBlockChainData();
|
||||
updateBSQTokenData();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -258,6 +257,7 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
|
||||
GridPane.setColumnSpan(chartPane, 2);
|
||||
GridPane.setRowIndex(chartPane, ++gridRow);
|
||||
GridPane.setMargin(chartPane, new Insets(10, 0, 0, 0));
|
||||
|
||||
root.getChildren().add(chartPane);
|
||||
}
|
||||
|
@ -282,9 +282,11 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
|
|||
totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount));
|
||||
totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount));
|
||||
totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount));
|
||||
|
||||
updateCharts();
|
||||
}
|
||||
|
||||
private void updateBSQTokenData() {
|
||||
private void updateCharts() {
|
||||
seriesBSQIssued.getData().clear();
|
||||
seriesBSQBurnt.getData().clear();
|
||||
|
||||
|
|
|
@ -141,6 +141,28 @@ public class FormBuilder {
|
|||
return label;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + Subtext
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, Label, VBox> addLabelWithSubText(GridPane gridPane, int rowIndex, String title, String description) {
|
||||
return addLabelWithSubText(gridPane, rowIndex, title, description, 0);
|
||||
}
|
||||
|
||||
public static Tuple3<Label, Label, VBox> addLabelWithSubText(GridPane gridPane, int rowIndex, String title, String description, double top) {
|
||||
Label label = new AutoTooltipLabel(title);
|
||||
Label subText = new AutoTooltipLabel(description);
|
||||
|
||||
VBox vBox = new VBox();
|
||||
vBox.getChildren().setAll(label, subText);
|
||||
|
||||
GridPane.setRowIndex(vBox, rowIndex);
|
||||
GridPane.setMargin(vBox, new Insets(top, 0, 0, 0));
|
||||
gridPane.getChildren().add(vBox);
|
||||
|
||||
return new Tuple3<>(label, subText, vBox);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Multiline Label
|
||||
|
|
Loading…
Add table
Reference in a new issue