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

fix: move porfolio button next to price amount #26867

Merged
merged 4 commits into from
Sep 4, 2024
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
32 changes: 16 additions & 16 deletions ui/components/app/wallet-overview/coin-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,6 @@ const CoinButtons = ({
///: END:ONLY_INCLUDE_IF
}

<IconButton
className={`${classPrefix}-overview__button`}
data-testid={`${classPrefix}-overview-send`}
Icon={
<Icon
name={IconName.Arrow2UpRight}
color={IconColor.primaryInverse}
/>
}
disabled={!isSigningEnabled}
label={t('send')}
onClick={handleSendOnClick}
tooltipRender={(contents: React.ReactElement) =>
generateTooltip('sendButton', contents)
}
/>
<IconButton
className={`${classPrefix}-overview__button`}
disabled={
Expand Down Expand Up @@ -377,6 +361,22 @@ const CoinButtons = ({
/>
///: END:ONLY_INCLUDE_IF
}
<IconButton
className={`${classPrefix}-overview__button`}
data-testid={`${classPrefix}-overview-send`}
Icon={
<Icon
name={IconName.Arrow2UpRight}
color={IconColor.primaryInverse}
/>
}
disabled={!isSigningEnabled}
label={t('send')}
onClick={handleSendOnClick}
tooltipRender={(contents: React.ReactElement) =>
generateTooltip('sendButton', contents)
}
/>
{
<>
{showReceiveModal && (
Expand Down
51 changes: 29 additions & 22 deletions ui/components/app/wallet-overview/coin-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classnames from 'classnames';
import { zeroAddress } from 'ethereumjs-util';
import { CaipChainId } from '@metamask/utils';
import type { Hex } from '@metamask/utils';
import { Icon, IconName } from '../../component-library';
import { Icon, IconName, IconSize } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import {
Expand Down Expand Up @@ -122,14 +122,6 @@ export const CoinOverview = ({
disabled={!balanceIsCached}
>
<div className={`${classPrefix}-overview__balance`}>
<div
onClick={handlePortfolioOnClick}
className="wallet-overview__portfolio_button"
data-testid="portfolio-link"
>
{t('portfolio')}
<Icon name={IconName.Diagram} color={IconColor.primaryDefault} />
</div>
<div className={`${classPrefix}-overview__primary-container`}>
{balance ? (
<UserPreferencedCurrencyDisplay
Expand Down Expand Up @@ -163,19 +155,34 @@ export const CoinOverview = ({
</span>
)}
</div>
{showFiat && isOriginalNativeSymbol && balance && (
<UserPreferencedCurrencyDisplay
className={classnames({
[`${classPrefix}__cached-secondary-balance`]: balanceIsCached,
[`${classPrefix}__secondary-balance`]: !balanceIsCached,
})}
data-testid={`${classPrefix}-overview__secondary-currency`}
value={balance}
type={SECONDARY}
ethNumberOfDecimals={4}
hideTitle
/>
)}
<div className="wallet-overview__currency-wrapper">
{showFiat && isOriginalNativeSymbol && balance && (
<UserPreferencedCurrencyDisplay
className={classnames({
[`${classPrefix}__cached-secondary-balance`]:
balanceIsCached,
[`${classPrefix}__secondary-balance`]: !balanceIsCached,
})}
data-testid={`${classPrefix}-overview__secondary-currency`}
value={balance}
type={SECONDARY}
ethNumberOfDecimals={4}
hideTitle
/>
)}
<div
onClick={handlePortfolioOnClick}
className="wallet-overview__portfolio_button"
data-testid="portfolio-link"
>
{t('portfolio')}
<Icon
size={IconSize.Sm}
name={IconName.Export}
color={IconColor.primaryDefault}
/>
</div>
</div>
{isEvm && (
<PercentageAndAmountChange
value={tokensMarketData?.[zeroAddress()]?.pricePercentChange1d}
Expand Down
6 changes: 6 additions & 0 deletions ui/components/app/wallet-overview/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
align-items: center;
color: var(--color-primary-default);
}

&__currency-wrapper {
display: flex;
flex-direction: row;
gap: 10px;
}
}

%asset-buttons {
Expand Down
24 changes: 12 additions & 12 deletions ui/pages/asset/components/__snapshots__/asset-page.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -87,58 +87,58 @@ exports[`AssetPage should render a native asset 1`] = `
</p>
</button>
<button
class="icon-button coin-overview__button"
data-testid="coin-overview-send"
class="icon-button coin-overview__button icon-button--disabled"
data-testid="token-overview-button-swap"
disabled=""
>
<div
class="icon-button__circle"
>
<span
class="mm-box mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-primary-inverse"
style="mask-image: url('./images/icons/arrow-2-up-right.svg');"
style="mask-image: url('./images/icons/swap-horizontal.svg');"
/>
</div>
<p
class="mm-box mm-text icon-button__label mm-text--body-sm mm-text--ellipsis mm-box--color-text-default"
>
Send
Swap
</p>
</button>
<button
class="icon-button coin-overview__button icon-button--disabled"
data-testid="token-overview-button-swap"
disabled=""
class="icon-button coin-overview__button"
data-testid="coin-overview-bridge"
>
<div
class="icon-button__circle"
>
<span
class="mm-box mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-primary-inverse"
style="mask-image: url('./images/icons/swap-horizontal.svg');"
style="mask-image: url('./images/icons/bridge.svg');"
/>
</div>
<p
class="mm-box mm-text icon-button__label mm-text--body-sm mm-text--ellipsis mm-box--color-text-default"
>
Swap
Bridge
</p>
</button>
<button
class="icon-button coin-overview__button"
data-testid="coin-overview-bridge"
data-testid="coin-overview-send"
>
<div
class="icon-button__circle"
>
<span
class="mm-box mm-icon mm-icon--size-md mm-box--display-inline-block mm-box--color-primary-inverse"
style="mask-image: url('./images/icons/bridge.svg');"
style="mask-image: url('./images/icons/arrow-2-up-right.svg');"
/>
</div>
<p
class="mm-box mm-text icon-button__label mm-text--body-sm mm-text--ellipsis mm-box--color-text-default"
>
Bridge
Send
</p>
</button>
<button
Expand Down