Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

refactor: hide percentage bar if portfolio has no balance #2962

Merged
merged 3 commits into from
Oct 10, 2020
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
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,25 @@
"testRunner": "jest-circus/runner"
},
"dependencies": {
"@arkecosystem/platform-sdk": "^0.9.391",
"@arkecosystem/platform-sdk-ada": "^0.9.391",
"@arkecosystem/platform-sdk-ark": "^0.9.391",
"@arkecosystem/platform-sdk-atom": "^0.9.391",
"@arkecosystem/platform-sdk-btc": "^0.9.391",
"@arkecosystem/platform-sdk-crypto": "^0.9.391",
"@arkecosystem/platform-sdk-eos": "^0.9.391",
"@arkecosystem/platform-sdk-eth": "^0.9.391",
"@arkecosystem/platform-sdk-intl": "^0.9.391",
"@arkecosystem/platform-sdk-ipfs": "^0.9.391",
"@arkecosystem/platform-sdk-lsk": "^0.9.391",
"@arkecosystem/platform-sdk-markets": "^0.9.391",
"@arkecosystem/platform-sdk-neo": "^0.9.391",
"@arkecosystem/platform-sdk-news": "^0.9.391",
"@arkecosystem/platform-sdk-profiles": "^0.9.391",
"@arkecosystem/platform-sdk-support": "^0.9.391",
"@arkecosystem/platform-sdk-trx": "^0.9.391",
"@arkecosystem/platform-sdk-xmr": "^0.9.391",
"@arkecosystem/platform-sdk-xrp": "^0.9.391",
"@arkecosystem/platform-sdk": "^0.9.394",
"@arkecosystem/platform-sdk-ada": "^0.9.394",
"@arkecosystem/platform-sdk-ark": "^0.9.394",
"@arkecosystem/platform-sdk-atom": "^0.9.394",
"@arkecosystem/platform-sdk-btc": "^0.9.394",
"@arkecosystem/platform-sdk-crypto": "^0.9.394",
"@arkecosystem/platform-sdk-eos": "^0.9.394",
"@arkecosystem/platform-sdk-eth": "^0.9.394",
"@arkecosystem/platform-sdk-intl": "^0.9.394",
"@arkecosystem/platform-sdk-ipfs": "^0.9.394",
"@arkecosystem/platform-sdk-lsk": "^0.9.394",
"@arkecosystem/platform-sdk-markets": "^0.9.394",
"@arkecosystem/platform-sdk-neo": "^0.9.394",
"@arkecosystem/platform-sdk-news": "^0.9.394",
"@arkecosystem/platform-sdk-profiles": "^0.9.394",
"@arkecosystem/platform-sdk-support": "^0.9.394",
"@arkecosystem/platform-sdk-trx": "^0.9.394",
"@arkecosystem/platform-sdk-xmr": "^0.9.394",
"@arkecosystem/platform-sdk-xrp": "^0.9.394",
"@arkecosystem/utils": "^1.2.0",
"@ledgerhq/devices": "^5.15.0",
"@ledgerhq/hw-transport-node-hid-singleton": "^5.16.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/WalletCard/WalletCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("Wallet Card", () => {
profile = env.profiles().findById(getDefaultProfileId());
wallet = profile.wallets().findById("ac38fe6d-4b67-4ef1-85be-17c5f6841129");
wallet.data().set(WalletFlag.Starred, true);
wallet.data().set(WalletFlag.Ledger, true);
wallet.data().set(WalletFlag.LedgerIndex, true);
});

it("should render", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("WalletListItem", () => {
profile = env.profiles().findById(getDefaultProfileId());
wallet = profile.wallets().findById("ac38fe6d-4b67-4ef1-85be-17c5f6841129");
wallet.data().set(WalletFlag.Starred, true);
wallet.data().set(WalletFlag.Ledger, true);
wallet.data().set(WalletFlag.LedgerIndex, true);
});

it("should render", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/domains/dashboard/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const translations: { [key: string]: any } = {
DASHBOARD_PAGE: {
CHART: {
TITLE: "Portfolio Chart",
PERCENTAGES_LABEL: "Total portfolio",
PERCENTAGES_LABEL: "Total Portfolio",
},
},
};
16 changes: 11 additions & 5 deletions src/domains/dashboard/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,17 @@ export const Dashboard = ({ networks, balances }: DashboardProps) => {
<Section>
<div className="-mb-2 text-4xl font-bold">{t("DASHBOARD.DASHBOARD_PAGE.CHART.TITLE")}</div>
<LineChart height={260} period="22 Jun - 28 Jun" data={balances} lines={chartLines} />
<div className="pt-6 mb-2 border-b border-dotted border-theme-neutral-200" />
<PercentageBar
title={t("DASHBOARD.DASHBOARD_PAGE.CHART.PERCENTAGES_LABEL")}
data={portfolioPercentages}
/>

{!activeProfile.balance().isZero() && (
<>
<div className="pt-6 mb-2 border-b border-dashed border-theme-neutral-300" />

<PercentageBar
title={t("DASHBOARD.DASHBOARD_PAGE.CHART.PERCENTAGES_LABEL")}
data={portfolioPercentages}
/>
</>
)}
</Section>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ exports[`Dashboard should fetch more transactions 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -361,7 +361,7 @@ exports[`Dashboard should fetch more transactions 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -4013,7 +4013,7 @@ exports[`Dashboard should hide transaction view 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -4022,7 +4022,7 @@ exports[`Dashboard should hide transaction view 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -4989,7 +4989,7 @@ exports[`Dashboard should open detail modal on transaction row click 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -4998,7 +4998,7 @@ exports[`Dashboard should open detail modal on transaction row click 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -6521,7 +6521,7 @@ exports[`Dashboard should render 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -6530,7 +6530,7 @@ exports[`Dashboard should render 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -8053,7 +8053,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -8062,7 +8062,7 @@ exports[`Dashboard should render portfolio chart 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -9585,7 +9585,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -9594,7 +9594,7 @@ exports[`Dashboard should render portfolio percentage bar 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -11117,7 +11117,7 @@ exports[`Dashboard should render wallets 1`] = `
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
class="pt-6 mb-2 border-b border-dashed border-theme-neutral-300"
/>
<div>
<div
Expand All @@ -11126,7 +11126,7 @@ exports[`Dashboard should render wallets 1`] = `
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
Total Portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
Expand Down Expand Up @@ -12648,26 +12648,6 @@ exports[`Dashboard should render with no wallets 1`] = `
</div>
<div />
</div>
<div
class="pt-6 mb-2 border-b border-dotted border-theme-neutral-200"
/>
<div>
<div
class="flex space-x-3"
>
<div
class="py-4 text-lg font-bold text-theme-neutral-800"
>
Total portfolio
</div>
<div
class="flex justify-end flex-1 space-x-3"
/>
</div>
<div
class="flex -space-x-1"
/>
</div>
</div>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports[`CreateProfile should not create new profile if profile name exists 1`]
>
<nav
aria-labelledby="main menu"
class="sc-fznJRM joVcmL"
class="sc-fznJRM jLnBRI"
>
<div
class="px-4 sm:px-6 lg:px-10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ exports[`Settings should not update profile if profile name exists 1`] = `
>
<nav
aria-labelledby="main menu"
class="sc-fznxsB iAUYdH"
class="sc-fznxsB jIViHY"
>
<div
class="px-4 sm:px-6 lg:px-10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("AddressRow", () => {
profile = env.profiles().findById(getDefaultProfileId());
wallet = profile.wallets().findById("ac38fe6d-4b67-4ef1-85be-17c5f6841129");
wallet.data().set(WalletFlag.Starred, true);
wallet.data().set(WalletFlag.Ledger, true);
wallet.data().set(WalletFlag.LedgerIndex, true);

blankWallet = await profile.wallets().importByMnemonic(blankWalletPassphrase, "ARK", "ark.devnet");
unvotedWallet = await profile.wallets().importByMnemonic("unvoted wallet", "ARK", "ark.devnet");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/storybook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const generateWallets = async ({

if (!index) {
wallets[index].toggleStarred();
wallets[index].data().set(WalletFlag.Ledger, true);
wallets[index].data().set(WalletFlag.LedgerIndex, true);
}

wallets[index].settings().set(WalletSetting.Alias, `ARK Wallet ${index + 1}`);
Expand Down
Loading