move subtabs to the left with clearer color hierarchy, always show once a multiple account wallet has been opened

This commit is contained in:
Craig Raw 2022-03-22 09:16:28 +02:00
parent 9048d341c6
commit 230a4c5585
5 changed files with 69 additions and 12 deletions

2
drongo

@ -1 +1 @@
Subproject commit 88bd6ada98d98451c580ee4209ec86ec95fa2c94 Subproject commit 74e32bab3d4f229e1b0207c7980c99e04c5115fa

View file

@ -196,6 +196,8 @@ public class AppController implements Initializable {
private Tab previouslySelectedTab; private Tab previouslySelectedTab;
private boolean subTabsVisible;
private final Set<Wallet> loadingWallets = new LinkedHashSet<>(); private final Set<Wallet> loadingWallets = new LinkedHashSet<>();
private final Set<Wallet> emptyLoadingWallets = new LinkedHashSet<>(); private final Set<Wallet> emptyLoadingWallets = new LinkedHashSet<>();
@ -1458,8 +1460,8 @@ public class AppController implements Initializable {
}); });
TabPane subTabs = new TabPane(); TabPane subTabs = new TabPane();
subTabs.setSide(Side.RIGHT); subTabs.setSide(Side.LEFT);
setSubTabsVisible(subTabs, false); setSubTabsVisible(subTabs, areSubTabsVisible());
subTabs.rotateGraphicProperty().set(true); subTabs.rotateGraphicProperty().set(true);
tab.setContent(subTabs); tab.setContent(subTabs);
@ -1468,7 +1470,7 @@ public class AppController implements Initializable {
tab.setUserData(tabData); tab.setUserData(tabData);
tab.setContextMenu(getTabContextMenu(tab)); tab.setContextMenu(getTabContextMenu(tab));
walletForm.lockedProperty().addListener((observable, oldValue, newValue) -> { walletForm.lockedProperty().addListener((observable, oldValue, newValue) -> {
setSubTabsVisible(subTabs, !newValue && subTabs.getTabs().size() > 1); setSubTabsVisible(subTabs, !newValue && areSubTabsVisible());
}); });
subTabs.getSelectionModel().selectedItemProperty().addListener((observable, old_val, selectedTab) -> { subTabs.getSelectionModel().selectedItemProperty().addListener((observable, old_val, selectedTab) -> {
@ -1527,6 +1529,30 @@ public class AppController implements Initializable {
} }
} }
private void setSubTabsVisible(boolean visible) {
for(Tab tab : tabs.getTabs()) {
TabData tabData = (TabData) tab.getUserData();
if(tabData instanceof WalletTabData) {
setSubTabsVisible((TabPane)tab.getContent(), visible);
}
}
}
private boolean areSubTabsVisible() {
if(subTabsVisible) {
return true;
}
for(Wallet wallet : AppServices.get().getOpenWallets().keySet()) {
if(wallet.getChildWallets().stream().anyMatch(childWallet -> !childWallet.isNested())) {
subTabsVisible = true;
return true;
}
}
return false;
}
public WalletForm addWalletSubTab(TabPane subTabs, Storage storage, Wallet wallet) { public WalletForm addWalletSubTab(TabPane subTabs, Storage storage, Wallet wallet) {
try { try {
Tab subTab = new Tab(); Tab subTab = new Tab();
@ -2018,6 +2044,18 @@ public class AppController implements Initializable {
findMixingPartner.setDisable(exportWallet.isDisable() || !SorobanServices.canWalletMix(event.getWallet()) || !AppServices.onlineProperty().get()); findMixingPartner.setDisable(exportWallet.isDisable() || !SorobanServices.canWalletMix(event.getWallet()) || !AppServices.onlineProperty().get());
} }
} }
for(Tab walletTab : tabs.getTabs()) {
TabData tabData = (TabData) walletTab.getUserData();
if(tabData instanceof WalletTabData walletTabData) {
if(walletTabData.getWalletForm().getWalletId().equals(event.getWalletId()) && event.getWallet().isMasterWallet()) {
TabPane subTabs = (TabPane)walletTab.getContent();
Tab masterTab = subTabs.getTabs().stream().filter(tab -> ((WalletTabData)tab.getUserData()).getWallet().isMasterWallet()).findFirst().orElse(subTabs.getTabs().get(0));
Label masterLabel = (Label)masterTab.getGraphic();
masterLabel.setText(event.getWallet().getLabel() != null ? event.getWallet().getLabel() : event.getWallet().getAutomaticName());
}
}
}
} }
@Subscribe @Subscribe
@ -2252,6 +2290,14 @@ public class AppController implements Initializable {
serverToggleStopAnimation(); serverToggleStopAnimation();
} }
@Subscribe
public void walletOpened(WalletOpenedEvent walletOpenedEvent) {
if(!subTabsVisible && walletOpenedEvent.getWallet().getChildWallets().stream().anyMatch(childWallet -> !childWallet.isNested())) {
subTabsVisible = true;
setSubTabsVisible(true);
}
}
@Subscribe @Subscribe
public void walletTabsClosed(WalletTabsClosedEvent event) { public void walletTabsClosed(WalletTabsClosedEvent event) {
event.getClosedWalletTabData().stream().map(WalletTabData::getWallet).forEach(loadingWallets::remove); event.getClosedWalletTabData().stream().map(WalletTabData::getWallet).forEach(loadingWallets::remove);

View file

@ -34,12 +34,19 @@
.master-only > .tab-header-area { .master-only > .tab-header-area {
visibility: hidden; visibility: hidden;
-fx-pref-height: 0;
} }
.wallet-subtabs > .tab-header-area .tab { .wallet-subtabs > .tab-header-area .tab {
-fx-pref-height: 50; -fx-pref-height: 50;
-fx-pref-width: 90; -fx-pref-width: 90;
-fx-alignment: CENTER; -fx-alignment: CENTER;
-fx-background-color: derive(#3da0e3, 32%);
-fx-background-insets: 0 1 0 1,0,0;
}
.wallet-subtabs > .tab-header-area .tab:selected {
-fx-background-color: #3da0e3;
} }
.wallet-subtabs > .tab-header-area .tab-label { .wallet-subtabs > .tab-header-area .tab-label {
@ -49,6 +56,10 @@
-fx-translate-x: -6; -fx-translate-x: -6;
} }
.wallet-subtabs > .tab-header-area .tab-label .label {
-fx-text-fill: #fff;
}
.status-bar .status-label { .status-bar .status-label {
-fx-alignment: center-left; -fx-alignment: center-left;
} }

View file

@ -13,11 +13,11 @@
} }
.list-item:hover { .list-item:hover {
-fx-background-color: #4aa7e5; -fx-background-color: linear-gradient(to right, #3da0e3, derive(#4aa7e5, 10%));
} }
.list-item:selected { .list-item:selected {
-fx-background-color: #1e88cf; -fx-background-color: linear-gradient(to right, #3da0e3, derive(#1e88cf, -10%));
} }
.list-item:disabled { .list-item:disabled {

View file

@ -41,12 +41,7 @@
</graphic> </graphic>
</Label> </Label>
<HBox> <HBox>
<VBox spacing="15"> <TabPane side="LEFT" rotateGraphic="true" styleClass="wallet-subtabs" minWidth="100" minHeight="280">
<Label text="Initiating your first CoinJoin in Sparrow will add three new wallets to your existing wallet: Premix, Postmix and Badbank." wrapText="true" styleClass="content-text" />
<Label text="Premix contains UTXOs that have been split from your deposit UTXOs into equal amounts, waiting for their first mixing round. Postmix contains UTXOs that have been through at least one mixing round. Badbank contains any change from your premix transaction, and should be treated carefully." wrapText="true" styleClass="content-text" />
<Label text="Click on the tabs at the right of the wallet to use these wallets. Note that they will have reduced functionality (for example they will not display receiving addresses)." wrapText="true" styleClass="content-text" />
</VBox>
<TabPane side="RIGHT" rotateGraphic="true" styleClass="wallet-subtabs" minWidth="100" minHeight="280">
<Tab text="" closable="false"> <Tab text="" closable="false">
<graphic> <graphic>
<Label text="Premix" contentDisplay="TOP"> <Label text="Premix" contentDisplay="TOP">
@ -78,6 +73,11 @@
<HBox/> <HBox/>
</Tab> </Tab>
</TabPane> </TabPane>
<VBox spacing="15">
<Label text="Initiating your first CoinJoin in Sparrow will add three new wallets to your existing wallet: Premix, Postmix and Badbank." wrapText="true" styleClass="content-text" />
<Label text="Premix contains UTXOs that have been split from your deposit UTXOs into equal amounts, waiting for their first mixing round. Postmix contains UTXOs that have been through at least one mixing round. Badbank contains any change from your premix transaction, and should be treated carefully." wrapText="true" styleClass="content-text" />
<Label text="Click on the tabs at the right of the wallet to use these wallets. Note that they will have reduced functionality (for example they will not display receiving addresses)." wrapText="true" styleClass="content-text" />
</VBox>
</HBox> </HBox>
</VBox> </VBox>
<VBox fx:id="step3" spacing="15"> <VBox fx:id="step3" spacing="15">