Skip to content

Commit

Permalink
Merge pull request #1095 from counterweightoperator/learn_section_con…
Browse files Browse the repository at this point in the history
…tent

Learn section content
  • Loading branch information
alvasw authored Aug 7, 2023
2 parents 306f567 + 2416bb8 commit d1e8293
Show file tree
Hide file tree
Showing 9 changed files with 450 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import javafx.scene.layout.VBox;

public abstract class AcademyView<M extends Model, C extends Controller> extends View<VBox, M, C> {
protected final Label headline, subHeadline, overviewHeadline, overview, contentHeadline, content;
protected final Hyperlink learnMore;
protected final Label headline, subHeadline;
protected Hyperlink learnMore;

public AcademyView(M model, C controller) {
super(new VBox(10), model, controller);
Expand All @@ -46,34 +46,41 @@ public AcademyView(M model, C controller) {
subHeadline.getStyleClass().addAll("font-size-14", "font-light", "text-fill-grey-dimmed");
subHeadline.setWrapText(true);

overviewHeadline = new Label(Res.get("academy.overview"));
overviewHeadline.getStyleClass().addAll("font-size-16", "font-light");
overviewHeadline.setWrapText(true);

overview = new Label(Res.get("academy." + key + ".overview"));
overview.getStyleClass().addAll("font-size-12", "font-light", "bisq-line-spacing-01");
overview.setWrapText(true);
VBox.setMargin(headline, new Insets(0, 0, 0, 0));
root.getChildren().addAll(headline, subHeadline);

}

contentHeadline = new Label(Res.get("academy." + key + ".content.headline"));
contentHeadline.getStyleClass().addAll("font-size-16", "font-light");
contentHeadline.setWrapText(true);
protected Label addHeadlineLabel(String headlineKey) {
Label label = new Label(Res.get("academy." + getKey() + "." + headlineKey));
label.getStyleClass().addAll("font-size-16", "font-light");
label.setWrapText(true);
root.getChildren().add(label);
return label;
}

content = new Label(Res.get("academy." + key + ".content"));
content.getStyleClass().addAll("font-size-12", "font-light", "bisq-line-spacing-01");
content.setWrapText(true);
protected Label addContentLabel(String contentKey) {
Label label = new Label(Res.get("academy." + getKey() + "." + contentKey));
label.getStyleClass().addAll("font-size-12", "font-light", "bisq-line-spacing-01");
label.setWrapText(true);
root.getChildren().add(label);
return label;
}

protected Hyperlink addLearnMoreHyperlink() {
learnMore = new Hyperlink(Res.get("action.learnMore"));
learnMore.getStyleClass().addAll("font-size-12", "text-fill-green");
root.getChildren().add(learnMore);
return learnMore;
}

VBox.setMargin(headline, new Insets(0, 0, 0, 0));
VBox.setMargin(overviewHeadline, new Insets(25, 0, 0, 0));
VBox.setMargin(contentHeadline, new Insets(35, 0, 0, 0));
VBox.setMargin(content, new Insets(0, 0, 15, 0));
root.getChildren().addAll(headline, subHeadline,
overviewHeadline, overview,
contentHeadline, content,
learnMore);
protected void setHeadlineMargin(Label headlineLabel) {
VBox.setMargin(headlineLabel, new Insets(35, 0, 0, 0));
}

protected void setLastLabelMargin(Label lastLabel) {
VBox.setMargin(lastLabel, new Insets(0, 0, 15, 0));
}

protected abstract String getIconId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public BisqAcademyController(ServiceProvider serviceProvider) {
view = new BisqAcademyView(model, this);
}

public boolean useCaching() {
return false;
}
@Override
public void onActivate() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,30 @@
package bisq.desktop.main.content.academy.bisq;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BisqAcademyView extends AcademyView<BisqAcademyModel, BisqAcademyController> {

public BisqAcademyView(BisqAcademyModel model, BisqAcademyController controller) {
super(model, controller);

Label exchangeDecentralizedHeadline = addHeadlineLabel("exchangeDecentralizedHeadline");
Label exchangeDecentralizedContent = addContentLabel("exchangeDecentralizedContent");
Label whyBisqHeadline = addHeadlineLabel("whyBisqHeadline");
Label whyBisqContent = addContentLabel("whyBisqContent");
Label tradeSafelyHeadline = addHeadlineLabel("tradeSafelyHeadline");
Label tradeSafelyContent = addContentLabel("tradeSafelyContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(exchangeDecentralizedHeadline);
setHeadlineMargin(whyBisqHeadline);
setHeadlineMargin(tradeSafelyHeadline);
setLastLabelMargin(tradeSafelyContent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@
package bisq.desktop.main.content.academy.bitcoin;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BitcoinAcademyView extends AcademyView<BitcoinAcademyModel, BitcoinAcademyController> {

public BitcoinAcademyView(BitcoinAcademyModel model, BitcoinAcademyController controller) {
super(model, controller);

Label whatIsBitcoinHeadline = addHeadlineLabel("whatIsBitcoinHeadline");
Label whatIsBitcoinContent = addContentLabel("whatIsBitcoinContent");
Label whyUseBitcoinHeadline = addHeadlineLabel("whyUseBitcoinHeadline");
Label whyUseBitcoinContent = addContentLabel("whyUseBitcoinContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(whatIsBitcoinHeadline);
setHeadlineMargin(whyUseBitcoinHeadline);
setLastLabelMargin(whyUseBitcoinContent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@
package bisq.desktop.main.content.academy.foss;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FossAcademyView extends AcademyView<FossAcademyModel, FossAcademyController> {

public FossAcademyView(FossAcademyModel model, FossAcademyController controller) {
super(model, controller);

Label bitcoinAndFossHeadline = addHeadlineLabel("bitcoinAndFossHeadline");
Label bitcoinAndFossContent = addContentLabel("bitcoinAndFossContent");
Label openSourceBenefitsHeadline = addHeadlineLabel("openSourceBenefitsHeadline");
Label openSourceBenefitsContent = addContentLabel("openSourceBenefitsContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(bitcoinAndFossHeadline);
setHeadlineMargin(openSourceBenefitsHeadline);
setLastLabelMargin(openSourceBenefitsContent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,32 @@
package bisq.desktop.main.content.academy.privacy;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PrivacyAcademyView extends AcademyView<PrivacyAcademyModel, PrivacyAcademyController> {

public PrivacyAcademyView(PrivacyAcademyModel model, PrivacyAcademyController controller) {
super(model, controller);

Label introContent = addContentLabel("introContent");
Label whyPrivacyHeadline = addHeadlineLabel("whyPrivacyHeadline");
Label whyPrivacyContent = addContentLabel("whyPrivacyContent");
Label giveUpPrivacyHeadline = addHeadlineLabel("giveUpPrivacyHeadline");
Label giveUpPrivacyContent = addContentLabel("giveUpPrivacyContent");
Label bisqProtectsPrivacyHeadline = addHeadlineLabel("bisqProtectsPrivacyHeadline");
Label bisqProtectsPrivacyContent = addContentLabel("bisqProtectsPrivacyContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(introContent);
setHeadlineMargin(whyPrivacyHeadline);
setHeadlineMargin(giveUpPrivacyHeadline);
setHeadlineMargin(bisqProtectsPrivacyHeadline);
setLastLabelMargin(bisqProtectsPrivacyContent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,29 @@
package bisq.desktop.main.content.academy.security;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SecurityAcademyView extends AcademyView<SecurityAcademyModel, SecurityAcademyController> {

public SecurityAcademyView(SecurityAcademyModel model, SecurityAcademyController controller) {
super(model, controller);

Label introContent = addContentLabel("introContent");
Label securingYourKeysHeadline = addHeadlineLabel("securingYourKeysHeadline");
Label securingYourKeysContent = addContentLabel("securingYourKeysContent");
Label avoidScamsHeadline = addHeadlineLabel("avoidScamsHeadline");
Label avoidScamsContent = addContentLabel("avoidScamsContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(introContent);
setHeadlineMargin(securingYourKeysHeadline);
setHeadlineMargin(avoidScamsHeadline);
setLastLabelMargin(avoidScamsContent);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,27 @@
package bisq.desktop.main.content.academy.wallets;

import bisq.desktop.main.content.academy.AcademyView;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class WalletsAcademyView extends AcademyView<WalletsAcademyModel, WalletsAcademyController> {

public WalletsAcademyView(WalletsAcademyModel model, WalletsAcademyController controller) {
super(model, controller);

Label whatIsAWalletHeadline = addHeadlineLabel("whatIsAWalletHeadline");
Label whatIsAWalletContent = addContentLabel("whatIsAWalletContent");
Label howToPickHeadline = addHeadlineLabel("howToPickHeadline");
Label howToPickContent = addContentLabel("howToPickContent");
Hyperlink learnMore = addLearnMoreHyperlink();

setHeadlineMargin(whatIsAWalletHeadline);
setHeadlineMargin(howToPickHeadline);
setLastLabelMargin(howToPickContent);
}

@Override
Expand Down
Loading

0 comments on commit d1e8293

Please sign in to comment.