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

[privacy] mixed & change accounts icons in accounts list & side bar. #3225

Merged
merged 2 commits into from
Feb 16, 2021
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
72 changes: 42 additions & 30 deletions app/components/SideBar/AccountsList/AccountsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,50 @@ import { classNames } from "pi-ui";

const isImported = (accountNumber) => accountNumber === Math.pow(2, 31) - 1;

const AccountsList = ({ isShowingAccounts, balances, accountsListRef }) => (
<div
data-testid="account-list"
className={classNames(
style.extended,
isShowingAccounts && style.showingAccounts
)}>
<div className={style.extendedBottom} ref={accountsListRef}>
{balances.map(
({ hidden, total, accountName, accountNumber }) =>
!hidden && (
<div
className={classNames(
style.extendedBottomAccount,
isImported(accountNumber) && style.imported
)}
key={accountName}>
<div className={style.extendedBottomAccountName}>
{accountName === "default" ? (
<T id="sidebar.accounts.name.default" m="Primary Account" />
) : (
accountName
const AccountsList = ({
isShowingAccounts,
balances,
mixedAccount,
changeAccount,
accountsListRef
}) => {
const isMixed = (accountNumber) => accountNumber === mixedAccount;
const isChange = (accountNumber) => accountNumber === changeAccount;
return (
<div
data-testid="account-list"
className={classNames(
style.extended,
isShowingAccounts && style.showingAccounts
)}>
<div className={style.extendedBottom} ref={accountsListRef}>
{balances.map(
({ hidden, total, accountName, accountNumber }) =>
!hidden && (
<div
className={classNames(
style.account,
isImported(accountNumber) && style.imported,
isMixed(accountNumber) && style.mixed,
isChange(accountNumber) && style.unmixed
)}
key={accountName}>
<div className={style.accountName}>
{accountName === "default" ? (
<T id="sidebar.accounts.name.default" m="Primary Account" />
) : (
accountName
)}
</div>
<div className={style.accountNumber}>
{total ? <Balance hideCurrency amount={total} /> : 0}
</div>
</div>
<div className={style.extendedBottomAccountNumber}>
{total ? <Balance hideCurrency amount={total} /> : 0}
</div>
</div>
)
)}
)
)}
</div>
</div>
</div>
);
);
};

export default AccountsList;
18 changes: 13 additions & 5 deletions app/components/SideBar/AccountsList/AccountsList.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
overflow-y: auto;
}

.extendedBottomAccount {
.account {
height: 44px;
display: flex;
padding-left: 52px;
Expand All @@ -31,25 +31,33 @@
background-position: 19px 0;
}

.extendedBottomAccount.imported {
.account.imported {
background-image: var(--accounts-imported);
}

.extendedBottomAccountName {
.account.mixed {
background-image: var(--mixed-account-icon);
}

.account.unmixed {
background-image: var(--unmixed-account-icon);
}

.accountName {
color: var(--stroke-color-hovered);
font-size: 13px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}

.extendedBottomAccountNumber {
.accountNumber {
font-family: var(--font-family-regular);
color: var(--input-color-default);
font-size: 11pt;
font-weight: 600;
}

.extendedBottomAccountNumber .balanceSmall {
.accountNumber .balanceSmall {
font-size: 11pt;
}
4 changes: 4 additions & 0 deletions app/components/SideBar/SideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const SideBar = () => {
onHideAccounts,
isTestNet,
balances,
mixedAccount,
changeAccount,
currentBlockHeight,
lastBlockTimestamp,
totalBalance,
Expand Down Expand Up @@ -62,6 +64,8 @@ const SideBar = () => {
{...{
isShowingAccounts,
balances,
mixedAccount,
changeAccount,
accountsListRef
}}
/>
Expand Down
5 changes: 4 additions & 1 deletion app/components/SideBar/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export function useSideBar() {

const isTestNet = useSelector(sel.isTestNet);
const balances = useSelector(sel.balances);
const mixedAccount = useSelector(sel.getMixedAccount);
const changeAccount = useSelector(sel.getChangeAccount);
const currentBlockHeight = useSelector(sel.currentBlockHeight);
const lastBlockTimestamp = useSelector(sel.lastBlockTimestamp);
const totalBalance = useSelector(sel.totalBalance);
Expand All @@ -30,7 +32,6 @@ export function useSideBar() {
const uiAnimations = useSelector(sel.uiAnimations);

const dispatch = useDispatch();

const onExpandSideBar = useCallback(() => dispatch(sba.expandSideBar()), [
dispatch
]);
Expand All @@ -44,6 +45,8 @@ export function useSideBar() {
onHideAccounts: () => setIsShowingAccounts(false),
isTestNet,
balances,
mixedAccount,
changeAccount,
currentBlockHeight,
lastBlockTimestamp,
totalBalance,
Expand Down
Loading