1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

[MMI] Added code fences to hide emojis just for MMI build (#20754)

* Added code fences to hide emojis just for MMI build

* Added missing code fences

* Added missing code fences
This commit is contained in:
Albert Olivé 2023-09-06 16:18:07 +02:00 committed by GitHub
parent 38876dc450
commit 6c5f24aa66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 15 deletions

View File

@ -7,7 +7,9 @@ import {
TextColor, TextColor,
TextVariant, TextVariant,
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { PRIORITY_LEVEL_ICON_MAP } from '../../../helpers/constants/gas'; import { PRIORITY_LEVEL_ICON_MAP } from '../../../helpers/constants/gas';
///: END:ONLY_INCLUDE_IN
import { useGasFeeContext } from '../../../contexts/gasFee'; import { useGasFeeContext } from '../../../contexts/gasFee';
import { useI18nContext } from '../../../hooks/useI18nContext'; import { useI18nContext } from '../../../hooks/useI18nContext';
import { useTransactionEventFragment } from '../../../hooks/useTransactionEventFragment'; import { useTransactionEventFragment } from '../../../hooks/useTransactionEventFragment';
@ -35,17 +37,22 @@ export default function EditGasFeeButton({ userAcknowledgedGasMissing }) {
if (!supportsEIP1559 || !estimateUsed || !editEnabled) { if (!supportsEIP1559 || !estimateUsed || !editEnabled) {
return null; return null;
} }
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
let icon = estimateUsed; let icon = estimateUsed;
///: END:ONLY_INCLUDE_IN
let title = estimateUsed; let title = estimateUsed;
if ( if (
estimateUsed === PriorityLevels.high && estimateUsed === PriorityLevels.high &&
editGasMode === EditGasModes.swaps editGasMode === EditGasModes.swaps
) { ) {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon = 'swapSuggested'; icon = 'swapSuggested';
///: END:ONLY_INCLUDE_IN
title = 'swapSuggested'; title = 'swapSuggested';
} else if (estimateUsed === PriorityLevels.tenPercentIncreased) { } else if (estimateUsed === PriorityLevels.tenPercentIncreased) {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon = undefined; icon = undefined;
///: END:ONLY_INCLUDE_IN
title = 'tenPercentIncreased'; title = 'tenPercentIncreased';
} }
@ -66,11 +73,15 @@ export default function EditGasFeeButton({ userAcknowledgedGasMissing }) {
return ( return (
<div className="edit-gas-fee-button"> <div className="edit-gas-fee-button">
<button onClick={openEditGasFeeModal} data-testid="edit-gas-fee-button"> <button onClick={openEditGasFeeModal} data-testid="edit-gas-fee-button">
{icon && ( {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon && (
<span className="edit-gas-fee-button__icon"> <span className="edit-gas-fee-button__icon">
{PRIORITY_LEVEL_ICON_MAP[icon]} {PRIORITY_LEVEL_ICON_MAP[icon]}
</span> </span>
)} )
///: END:ONLY_INCLUDE_IN
}
<span className="edit-gas-fee-button__label">{t(title)}</span> <span className="edit-gas-fee-button__label">{t(title)}</span>
<Icon <Icon
name={IconName.ArrowRight} name={IconName.ArrowRight}

View File

@ -6,7 +6,9 @@ import {
EditGasModes, EditGasModes,
PriorityLevels, PriorityLevels,
} from '../../../../../shared/constants/gas'; } from '../../../../../shared/constants/gas';
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
import { PRIORITY_LEVEL_ICON_MAP } from '../../../../helpers/constants/gas'; import { PRIORITY_LEVEL_ICON_MAP } from '../../../../helpers/constants/gas';
///: END:ONLY_INCLUDE_IN
import { PRIMARY } from '../../../../helpers/constants/common'; import { PRIMARY } from '../../../../helpers/constants/common';
import { toHumanReadableTime } from '../../../../helpers/utils/util'; import { toHumanReadableTime } from '../../../../helpers/utils/util';
import { useGasFeeContext } from '../../../../contexts/gasFee'; import { useGasFeeContext } from '../../../../contexts/gasFee';
@ -21,23 +23,34 @@ import EditGasToolTip from '../edit-gas-tooltip/edit-gas-tooltip';
import { useGasItemFeeDetails } from './useGasItemFeeDetails'; import { useGasItemFeeDetails } from './useGasItemFeeDetails';
const getTitleAndIcon = (priorityLevel, editGasMode) => { const getTitleAndIcon = (priorityLevel, editGasMode) => {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
let icon = priorityLevel; let icon = priorityLevel;
///: END:ONLY_INCLUDE_IN
let title = priorityLevel; let title = priorityLevel;
if (priorityLevel === PriorityLevels.dAppSuggested) { if (priorityLevel === PriorityLevels.dAppSuggested) {
title = 'dappSuggestedShortLabel'; title = 'dappSuggestedShortLabel';
} else if (priorityLevel === PriorityLevels.dappSuggestedHigh) { } else if (priorityLevel === PriorityLevels.dappSuggestedHigh) {
title = 'dappSuggestedHighShortLabel'; title = 'dappSuggestedHighShortLabel';
} else if (priorityLevel === PriorityLevels.tenPercentIncreased) { } else if (priorityLevel === PriorityLevels.tenPercentIncreased) {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon = null; icon = null;
///: END:ONLY_INCLUDE_IN
title = 'tenPercentIncreased'; title = 'tenPercentIncreased';
} else if ( } else if (
priorityLevel === PriorityLevels.high && priorityLevel === PriorityLevels.high &&
editGasMode === EditGasModes.swaps editGasMode === EditGasModes.swaps
) { ) {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon = 'swapSuggested'; icon = 'swapSuggested';
///: END:ONLY_INCLUDE_IN
title = 'swapSuggested'; title = 'swapSuggested';
} }
return { title, icon }; return {
title,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon,
///: END:ONLY_INCLUDE_IN
};
}; };
const EditGasItem = ({ priorityLevel }) => { const EditGasItem = ({ priorityLevel }) => {
@ -100,7 +113,12 @@ const EditGasItem = ({ priorityLevel }) => {
} }
}; };
const { title, icon } = getTitleAndIcon(priorityLevel, editGasMode); const {
title,
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon,
///: END:ONLY_INCLUDE_IN
} = getTitleAndIcon(priorityLevel, editGasMode);
return ( return (
<button <button
@ -115,13 +133,17 @@ const EditGasItem = ({ priorityLevel }) => {
data-testid={`edit-gas-fee-item-${priorityLevel}`} data-testid={`edit-gas-fee-item-${priorityLevel}`}
> >
<span className="edit-gas-item__name"> <span className="edit-gas-item__name">
{icon && ( {
///: BEGIN:ONLY_INCLUDE_IN(build-main,build-beta,build-flask)
icon && (
<span <span
className={`edit-gas-item__icon edit-gas-item__icon-${priorityLevel}`} className={`edit-gas-item__icon edit-gas-item__icon-${priorityLevel}`}
> >
{PRIORITY_LEVEL_ICON_MAP[icon]} {PRIORITY_LEVEL_ICON_MAP[icon]}
</span> </span>
)} )
///: END:ONLY_INCLUDE_IN
}
{t(title)} {t(title)}
</span> </span>
<span <span