Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 27114-bug-permit-simulation-spending-cap-…
Browse files Browse the repository at this point in the history
…label-is-no-longer-top-aligned
OGPoyraz authored Sep 23, 2024

Partially verified

This commit is signed with the committer’s verified signature.
gsmet’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
2 parents c05833f + 24f8bf4 commit 0e55852
Showing 3 changed files with 45 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ui/components/app/wallet-overview/coin-buttons.tsx
Original file line number Diff line number Diff line change
@@ -65,8 +65,8 @@ import IconButton from '../../ui/icon-button';
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
import useRamps from '../../../hooks/ramps/useRamps/useRamps';
import useBridging from '../../../hooks/bridge/useBridging';
import { ReceiveModal } from '../../multichain/receive-modal';
///: END:ONLY_INCLUDE_IF
import { ReceiveModal } from '../../multichain/receive-modal';

const CoinButtons = ({
chainId,
51 changes: 34 additions & 17 deletions ui/components/app/wallet-overview/coin-overview.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import React, { useContext, useCallback } from 'react';
import React, {
useContext,
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
useCallback,
///: END:ONLY_INCLUDE_IF
} from 'react';
import { useSelector } from 'react-redux';
import classnames from 'classnames';
import { zeroAddress } from 'ethereumjs-util';
import { CaipChainId } from '@metamask/utils';
import type { Hex } from '@metamask/utils';
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
import { Icon, IconName, IconSize } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system';
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
import { MetaMetricsContext } from '../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { getPortfolioUrl } from '../../../helpers/utils/portfolio';
///: END:ONLY_INCLUDE_IF

import { I18nContext } from '../../../contexts/i18n';
import Tooltip from '../../ui/tooltip';
import UserPreferencedCurrencyDisplay from '../user-preferenced-currency-display';
import { PRIMARY, SECONDARY } from '../../../helpers/constants/common';
import {
getDataCollectionForMarketing,
getMetaMetricsId,
getParticipateInMetaMetrics,
getPreferences,
getTokensMarketData,
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
getDataCollectionForMarketing,
getMetaMetricsId,
getParticipateInMetaMetrics,
SwapsEthToken,
///: END:ONLY_INCLUDE_IF
} from '../../../selectors';
@@ -76,11 +84,14 @@ export const CoinOverview = ({
///: END:ONLY_INCLUDE_IF

const t = useContext(I18nContext);

///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
const trackEvent = useContext(MetaMetricsContext);

const metaMetricsId = useSelector(getMetaMetricsId);
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics);
const isMarketingEnabled = useSelector(getDataCollectionForMarketing);
///: END:ONLY_INCLUDE_IF

const isEvm = useSelector(getMultichainIsEvm);
const showFiat = useSelector(getMultichainShouldShowFiat);
@@ -94,6 +105,7 @@ export const CoinOverview = ({
);
const tokensMarketData = useSelector(getTokensMarketData);

///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
const handlePortfolioOnClick = useCallback(() => {
const url = getPortfolioUrl(
'',
@@ -112,6 +124,7 @@ export const CoinOverview = ({
},
});
}, [isMarketingEnabled, isMetaMetricsEnabled, metaMetricsId, trackEvent]);
///: END:ONLY_INCLUDE_IF

return (
<WalletOverview
@@ -170,18 +183,22 @@ export const CoinOverview = ({
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>
{
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
<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>
///: END:ONLY_INCLUDE_IF
}
</div>
{isEvm && (
<PercentageAndAmountChange
14 changes: 10 additions & 4 deletions ui/components/institutional/note-to-trader/note-to-trader.tsx
Original file line number Diff line number Diff line change
@@ -34,6 +34,8 @@ const NoteToTrader: React.FC = () => {
getIsNoteToTraderSupported(state, fromChecksumHexAddress),
);

const MAX_LENGTH = 280;

useEffect(() => {
const timer = setTimeout(() => {
dispatch(setNoteToTraderMessage(noteText));
@@ -42,7 +44,11 @@ const NoteToTrader: React.FC = () => {
return () => clearTimeout(timer);
}, [noteText]);

return isNoteToTraderSupported && !isSignature ? (
if (!isNoteToTraderSupported || isSignature) {
return null;
}

return (
<Box
backgroundColor={BackgroundColor.backgroundDefault}
borderRadius={BorderRadius.MD}
@@ -61,7 +67,7 @@ const NoteToTrader: React.FC = () => {
>
<Label htmlFor="transaction-note">{t('transactionNote')}</Label>
<Text className="note-header__counter">
{noteText.length}/{280}
{noteText.length}/{MAX_LENGTH}
</Text>
</Box>
<Box
@@ -76,14 +82,14 @@ const NoteToTrader: React.FC = () => {
value={noteText}
height={BlockSize.Full}
width={BlockSize.Full}
maxLength={280}
maxLength={MAX_LENGTH}
placeholder={t('notePlaceholder')}
padding={2}
/>
</Box>
</Box>
</Box>
) : null;
);
};

export default NoteToTrader;

0 comments on commit 0e55852

Please sign in to comment.