Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
feat(account): improve the empty state
Browse files Browse the repository at this point in the history
Until now, the header in the account page for an empty account (no txs) wasn't
rendered. Because of this, walletconnect button wasn't rendered, you needed
some tokens to see it appears. This commit fixes this, from now, walletconnect
button and receive/buy buttons would be rendered for any empty accounts.
As it is not required to own tokens to use walletconnect, this modification makes
sense to me. Regarding the receive/buy buttons, I think it's better to have them
always available, even for empty accounts (we missed a business opportunity by
hidding the buy button in this case).
  • Loading branch information
qd-qd committed Apr 6, 2022
1 parent d42b9f7 commit 0d49a28
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/renderer/screens/account/AccountHeaderActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const AccountHeaderSettingsButtonComponent = ({ account, parentAccount, openModa
const AccountHeaderActions = ({ account, parentAccount, openModal, t }: Props) => {
const mainAccount = getMainAccount(account, parentAccount);
const contrastText = useTheme("colors.palette.text.shade60");
const isAccountHasToken = useMemo(() => !isAccountEmpty(account), [account.id]);

const decorators = perFamilyAccountActions[mainAccount.currency.family];
const manage = perFamilyManageActions[mainAccount.currency.family];
Expand Down Expand Up @@ -275,21 +276,17 @@ const AccountHeaderActions = ({ account, parentAccount, openModal, t }: Props) =

const ManageActionsHeader = manageActions.map(item => renderAction(item));

const NonEmptyAccountHeader = (
<FadeInButtonsContainer data-test-id="account-buttons-group" show={showButtons}>
{availableOnBuy && BuyHeader}
{availableOnSwap && SwapHeader}
{manageActions.length > 0 && ManageActionsHeader}
{canSend(account, parentAccount) && (
<SendAction account={account} parentAccount={parentAccount} onClick={onSend} />
)}
<ReceiveAction account={account} parentAccount={parentAccount} onClick={onReceive} />
</FadeInButtonsContainer>
);

return (
<Box horizontal alignItems="center" justifyContent="flex-end" flow={2} mt={15}>
{!isAccountEmpty(account) ? NonEmptyAccountHeader : null}
<FadeInButtonsContainer data-test-id="account-buttons-group" show={showButtons}>
{availableOnBuy && BuyHeader}
{isAccountHasToken && availableOnSwap && SwapHeader}
{manageActions.length > 0 && ManageActionsHeader}
{isAccountHasToken && canSend(account, parentAccount) && (
<SendAction account={account} parentAccount={parentAccount} onClick={onSend} />
)}
<ReceiveAction account={account} parentAccount={parentAccount} onClick={onReceive} />
</FadeInButtonsContainer>
</Box>
);
};
Expand Down

1 comment on commit 0d49a28

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint outputs ✅

Tests outputs ✅

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
PASS src/generate-cryptoassets-md.test.js

Test Suites: 1 skipped, 1 passed, 1 of 2 total
Tests: 5 skipped, 1 passed, 6 total
Snapshots: 0 total
Time: 2.822 s
Test results written to: report.json

Diff output ❌

windows

Actual Diff Expected

| confirm-exchange-actual | confirm-exchange-diff | confirm-exchange-expected |
| confirm-exchange-actual | confirm-exchange-diff | confirm-exchange-expected |

Please sign in to comment.