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

Adapt DAO news view for Mainnet #2421

Merged
merged 3 commits into from
Feb 14, 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
24 changes: 24 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ dao.tab.bsqWallet=BSQ wallet
dao.tab.proposals=Governance
dao.tab.bonding=Bonding
dao.tab.proofOfBurn=Asset listing fee/Proof of burn
dao.tab.news=News

dao.paidWithBsq=paid with BSQ
dao.availableBsqBalance=Available
Expand Down Expand Up @@ -1769,6 +1770,29 @@ dao.feeTx.confirm.details={0} fee: {1}\n\
Transaction size: {4} Kb\n\n\
Are you sure you want to publish the {5} transaction?

dao.news.bisqDAO.title=THE BISQ DAO
dao.news.bisqDAO.description=Just as the Bisq exchange is decentralized and censorship-resistant, so is its \
governance model - and the Bisq DAO and BSQ token are the tools that make it possible.
dao.news.bisqDAO.readMoreLink=Learn More About the Bisq DAO

dao.news.pastContribution.title=MADE PAST CONTRIBUTIONS? REQUEST BSQ
dao.news.pastContribution.description=If you have contributed to Bisq please use the BSQ address below and make a \
request for taking part of the BSQ genesis distribution.
dao.news.pastContribution.yourAddress=Your BSQ Wallet Address
dao.news.pastContribution.requestNow=Request now

dao.news.DAOOnTestnet.title=RUN THE BISQ DAO ON TESTNET
dao.news.DAOOnTestnet.description=The main net Bisq DAO is not launched yet but you can learn about the Bisq DAO \
by running it on testnet.
dao.news.DAOOnTestnet.firstSection.title=1. Switch to Testnet Mode
dao.news.DAOOnTestnet.firstSection.content=Switch to testnet from the Settings screen.
dao.news.DAOOnTestnet.secondSection.title=2. Acquire Some BSQ
dao.news.DAOOnTestnet.secondSection.content=Request BSQ on Slack or Buy BSQ on Bisq.
dao.news.DAOOnTestnet.thirdSection.title=3. Participate in a Voting Cycle
dao.news.DAOOnTestnet.thirdSection.content=Making proposals and voting on proposals to change various aspects of Bisq.
dao.news.DAOOnTestnet.fourthSection.title=4. Explore a BSQ Block Explorer
dao.news.DAOOnTestnet.fourthSection.content=Since BSQ is just bitcoin, you can see BSQ transactions on any bitcoin block explorer.
dao.news.DAOOnTestnet.readMoreLink=Read the full documentation

####################################################################
# Windows
Expand Down
42 changes: 42 additions & 0 deletions desktop/src/main/java/bisq/desktop/bisq.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ bg color of non edit textFields: fafafa
src: url("/fonts/IBMPlexSans-Medium.ttf");
}

@font-face {
src: url("/fonts/IBMPlexSans-Light.ttf");
}

@font-face {
src: url("/fonts/IBMPlexMono-Regular.ttf");
}


.root {
-bs-very-dark-grey3: #444; /* 3 usages */
-bs-grey: #666666; /* 8 usages */
Expand Down Expand Up @@ -2007,6 +2012,43 @@ textfield */
-fx-text-fill: -fx-accent;
}

.dao-news-titled-group .titled-group-bg-label-active {
-fx-font-size: 0.923em;
}

.dao-news-teaser {
-fx-font-size: 1.538em;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-news-section-header {
-fx-font-size: 1.923em;
-fx-text-fill: -bs-rd-green-dark;
-fx-font-family: "IBM Plex Sans Light";
}

.dao-news-section-content, .dao-news-content, .dao-news-section-link {
-fx-font-size: 0.923em;
}

.dao-news-section-content {
-fx-text-fill: -bs-rd-black;
}

.dao-news-content, .dao-news-section-link, .dao-news-section-link .hyperlink {
-fx-text-fill: -bs-rd-font-light;
-fx-fill: -bs-rd-font-light;
}

.dao-news-link {
-fx-text-fill: -fx-accent;
-fx-padding: 16 0 0 0;
}

.dao-news-link .hyperlink {
-fx-fill: -fx-accent;
}

/********************************************************************************************************************
* *
* Notifications *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.GlyphIcons;

import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
Expand All @@ -39,7 +40,7 @@ public class AddressWithIconAndDirection extends HBox {
private static final Logger log = LoggerFactory.getLogger(AddressWithIconAndDirection.class);
private final Hyperlink hyperlink;

public AddressWithIconAndDirection(String text, String address, AwesomeIcon awesomeIcon, boolean received) {
public AddressWithIconAndDirection(String text, String address, GlyphIcons icon, boolean received) {
Label directionIcon = new Label();
directionIcon.getStyleClass().add("icon");
directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon");
Expand All @@ -54,7 +55,7 @@ public AddressWithIconAndDirection(String text, String address, AwesomeIcon awes
HBox.setMargin(directionIcon, new Insets(0, 3, 0, 0));
HBox.setHgrow(label, Priority.ALWAYS);

hyperlink = new HyperlinkWithIcon(address, awesomeIcon);
hyperlink = new HyperlinkWithIcon(address, icon);
HBox.setMargin(hyperlink, new Insets(0));
HBox.setHgrow(hyperlink, Priority.SOMETIMES);
// You need to set max width to Double.MAX_VALUE to make HBox.setHgrow working like expected!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,54 @@

package bisq.desktop.components;

import bisq.desktop.util.FormBuilder;

import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.GlyphIcons;

import javafx.scene.Node;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.text.Text;

import javafx.geometry.Insets;

import lombok.Getter;

public class HyperlinkWithIcon extends Hyperlink {
@Getter
private final Label icon;

public HyperlinkWithIcon(String text) {
this(text, AwesomeIcon.INFO_SIGN);
}

public HyperlinkWithIcon(String text, AwesomeIcon awesomeIcon) {

super(text);

icon = new Label();
Label icon = new Label();
AwesomeDude.setIcon(icon, awesomeIcon);
icon.setMinWidth(20);
icon.setOpacity(0.7);
icon.getStyleClass().addAll("hyperlink", "no-underline");
setPadding(new Insets(0));
icon.setPadding(new Insets(0));

setIcon(icon);
}

public HyperlinkWithIcon(String text, GlyphIcons icon) {
super(text);

Text textIcon = FormBuilder.getIcon(icon);
textIcon.setOpacity(0.7);
textIcon.getStyleClass().addAll("hyperlink", "no-underline");
setPadding(new Insets(0));

setIcon(textIcon);
}

private void setIcon(Node icon) {
setGraphic(icon);

setContentDisplay(ContentDisplay.RIGHT);
setGraphicTextGap(7.0);

Expand Down
41 changes: 26 additions & 15 deletions desktop/src/main/java/bisq/desktop/main/dao/DaoView.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import bisq.desktop.main.dao.bonding.BondingView;
import bisq.desktop.main.dao.burnbsq.BurnBsqView;
import bisq.desktop.main.dao.governance.GovernanceView;
import bisq.desktop.main.dao.news.NewsView;
import bisq.desktop.main.dao.wallet.BsqWalletView;
import bisq.desktop.main.dao.wallet.dashboard.BsqDashboardView;
import bisq.desktop.main.overlays.popups.Popup;
Expand All @@ -51,7 +52,7 @@
public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {

@FXML
private Tab bsqWalletTab, proposalsTab, bondingTab, burnBsqTab;
private Tab bsqWalletTab, proposalsTab, bondingTab, burnBsqTab, daoNewsTab;

private Navigation.Listener navigationListener;
private ChangeListener<Tab> tabChangeListener;
Expand Down Expand Up @@ -89,7 +90,11 @@ public void initialize() {
proposalsTab.setDisable(true);
bondingTab.setDisable(true);
burnBsqTab.setDisable(true);
root.getTabs().addAll(bsqWalletTab);
bsqWalletTab.setDisable(true);

daoNewsTab = new Tab(Res.get("dao.tab.news").toUpperCase());

root.getTabs().add(daoNewsTab);
} else {
root.getTabs().addAll(bsqWalletTab, proposalsTab, bondingTab, burnBsqTab);
}
Expand Down Expand Up @@ -122,19 +127,23 @@ public void initialize() {

@Override
protected void activate() {
navigation.addListener(navigationListener);
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);

if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == DaoView.class) {
Tab selectedItem = root.getSelectionModel().getSelectedItem();
if (selectedItem == bsqWalletTab)
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
else if (selectedItem == proposalsTab)
navigation.navigateTo(MainView.class, DaoView.class, GovernanceView.class);
else if (selectedItem == bondingTab)
navigation.navigateTo(MainView.class, DaoView.class, BondingView.class);
else if (selectedItem == burnBsqTab)
navigation.navigateTo(MainView.class, DaoView.class, BurnBsqView.class);
if (DevEnv.isDaoActivated()) {
navigation.addListener(navigationListener);
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);

if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == DaoView.class) {
Tab selectedItem = root.getSelectionModel().getSelectedItem();
if (selectedItem == bsqWalletTab)
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
else if (selectedItem == proposalsTab)
navigation.navigateTo(MainView.class, DaoView.class, GovernanceView.class);
else if (selectedItem == bondingTab)
navigation.navigateTo(MainView.class, DaoView.class, BondingView.class);
else if (selectedItem == burnBsqTab)
navigation.navigateTo(MainView.class, DaoView.class, BurnBsqView.class);
}
} else {
loadView(NewsView.class);
}
}

Expand Down Expand Up @@ -164,6 +173,8 @@ private void loadView(Class<? extends View> viewClass) {
selectedTab = bondingTab;
} else if (view instanceof BurnBsqView) {
selectedTab = burnBsqTab;
} else if (view instanceof NewsView) {
selectedTab = daoNewsTab;
}

selectedTab.setContent(view.getRoot());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

import javax.inject.Inject;

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

import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
Expand Down Expand Up @@ -304,7 +304,7 @@ public void updateItem(final BondListItem item, boolean empty) {

if (item != null && !empty) {
String lockupTxId = item.getLockupTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(lockupTxId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(lockupTxId, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(lockupTxId, preferences));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", lockupTxId)));
setGraphic(hyperlinkWithIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

import com.google.common.base.Charsets;

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

import javafx.scene.control.Button;
import javafx.scene.control.TableCell;
Expand Down Expand Up @@ -393,7 +393,7 @@ public void updateItem(final MyReputationListItem item, boolean empty) {
//noinspection Duplicates
if (item != null && !empty) {
String transactionId = item.getTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(item.getTxId(), preferences));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import javax.inject.Inject;

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

import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
Expand Down Expand Up @@ -171,7 +171,7 @@ public void updateItem(final RolesListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
String link = item.getRole().getLink();
hyperlinkWithIcon = new HyperlinkWithIcon(link, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(link, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openWebPage(link));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("shared.openURL", link)));
setGraphic(hyperlinkWithIcon);
Expand Down Expand Up @@ -240,7 +240,7 @@ public void updateItem(final RolesListItem item, boolean empty) {
if (item != null && !empty) {
String transactionId = item.getBondedRole().getLockupTxId();
if (transactionId != null) {
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(transactionId, preferences));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

import javax.inject.Inject;

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

import javafx.scene.control.Button;
import javafx.scene.control.TableCell;
Expand Down Expand Up @@ -400,7 +400,7 @@ public void updateItem(final MyProofOfBurnListItem item, boolean empty) {
//noinspection Duplicates
if (item != null && !empty) {
String transactionId = item.getTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(item.getTxId(), preferences));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
Expand Down Expand Up @@ -563,7 +563,7 @@ public void updateItem(final ProofOfBurnListItem item, boolean empty) {
//noinspection Duplicates
if (item != null && !empty) {
String transactionId = item.getTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, MaterialDesignIcon.LINK);
hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(item.getTxId(), preferences));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon;

import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
Expand Down Expand Up @@ -690,7 +691,7 @@ public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
final Proposal proposal = item.getProposal();
field = new HyperlinkWithIcon(proposal.getLink(), AwesomeIcon.EXTERNAL_LINK);
field = new HyperlinkWithIcon(proposal.getLink(), MaterialDesignIcon.LINK);
field.setOnAction(event -> GUIUtil.openWebPage(proposal.getLink()));
field.setTooltip(new Tooltip(proposal.getLink()));
setGraphic(field);
Expand Down
27 changes: 27 additions & 0 deletions desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ This file is part of Bisq.
~
~ Bisq is free software: you can redistribute it and/or modify it
~ under the terms of the GNU Affero General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or (at
~ your option) any later version.
~
~ Bisq is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
~ License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with Bisq. If not, see <http://www.gnu.org/licenses/>.
-->

<?import javafx.scene.layout.HBox?>
<?import javafx.geometry.Insets?>
<HBox fx:id="root" fx:controller="bisq.desktop.main.dao.news.NewsView"
xmlns:fx="http://javafx.com/fxml">
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0"/>
</padding>
</HBox>
Loading