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

chore: removes portfolio button & fixes code fence of receive modal #27286

Merged
merged 9 commits into from
Sep 23, 2024
2 changes: 1 addition & 1 deletion ui/components/app/wallet-overview/coin-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
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';
Expand Down Expand Up @@ -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);
Expand All @@ -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(
'',
Expand All @@ -112,6 +124,7 @@ export const CoinOverview = ({
},
});
}, [isMarketingEnabled, isMetaMetricsEnabled, metaMetricsId, trackEvent]);
///: END:ONLY_INCLUDE_IF

return (
<WalletOverview
Expand Down Expand Up @@ -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
Expand Down
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
Expand Up @@ -34,6 +34,8 @@ const NoteToTrader: React.FC = () => {
getIsNoteToTraderSupported(state, fromChecksumHexAddress),
);

const MAX_LENGTH = 280;
Copy link
Contributor Author

Choose a reason for hiding this comment

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


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

return isNoteToTraderSupported && !isSignature ? (
if (!isNoteToTraderSupported || isSignature) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pedronfigueiredo And here.

return null;
}

return (
<Box
backgroundColor={BackgroundColor.backgroundDefault}
borderRadius={BorderRadius.MD}
Expand All @@ -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
Expand All @@ -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;
Loading