Skip to content

Commit

Permalink
feat: Redesigned setApprovalForAll confirmations
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Sep 12, 2024
1 parent 9ce914d commit 93dbee0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ exports[`<SetApprovalForAllInfo /> renders component for approve request 1`] = `
<div
class="mm-box confirm-info-row mm-box--margin-top-2 mm-box--margin-bottom-2 mm-box--padding-right-2 mm-box--padding-left-2 mm-box--display-flex mm-box--flex-direction-row mm-box--flex-wrap-wrap mm-box--justify-content-space-between mm-box--color-text-default mm-box--rounded-lg"
data-testid="gas-fee-details-speed"
style="overflow-wrap: anywhere; min-height: 24px; position: relative; background: transparent;"
style="overflow-wrap: anywhere; min-height: 24px; position: relative;"
>
<div
class="mm-box mm-box--display-flex mm-box--flex-direction-row mm-box--justify-content-center mm-box--align-items-flex-start mm-box--color-info-default"
class="mm-box mm-box--display-flex mm-box--flex-direction-row mm-box--justify-content-center mm-box--align-items-flex-start"
style="align-items: center;"
>
<p
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NameType } from '@metamask/name-controller';
import { TransactionMeta } from '@metamask/transaction-controller';
import React from 'react';
import { ConfirmInfoRow } from '../../../../../../../components/app/confirm/info/row';
import Name from '../../../../../../../components/app/name';
import { Box, Text } from '../../../../../../../components/component-library';
import {
Expand All @@ -24,32 +23,28 @@ export const SetApprovalForAllStaticSimulation = () => {
};

const SetApprovalForAllRow = (
<ConfirmInfoRow label={t('withdrawing')}>
<Box style={{ marginLeft: 'auto', maxWidth: '100%' }}>
<Box display={Display.Flex} alignItems={AlignItems.center}>
<Box
display={Display.Inline}
marginInlineEnd={1}
minWidth={BlockSize.Zero}
>
<Text
data-testid="simulation-token-value"
backgroundColor={BackgroundColor.backgroundAlternative}
borderRadius={BorderRadius.XL}
paddingInline={2}
textAlign={TextAlign.Center}
alignItems={AlignItems.center}
>
{t('all')}
</Text>
</Box>
<Name
value={transactionMeta.txParams.to as string}
type={NameType.ETHEREUM_ADDRESS}
/>
</Box>
<Box display={Display.Flex} alignItems={AlignItems.center}>
<Box
display={Display.Inline}
marginInlineEnd={1}
minWidth={BlockSize.Zero}
>
<Text
data-testid="simulation-token-value"
backgroundColor={BackgroundColor.backgroundAlternative}
borderRadius={BorderRadius.XL}
paddingInline={2}
textAlign={TextAlign.Center}
alignItems={AlignItems.center}
>
{t('all')}
</Text>
</Box>
</ConfirmInfoRow>
<Name
value={transactionMeta.txParams.to as string}
type={NameType.ETHEREUM_ADDRESS}
/>
</Box>
);

const simulationElements = SetApprovalForAllRow;
Expand All @@ -59,6 +54,7 @@ export const SetApprovalForAllStaticSimulation = () => {
title={t('simulationDetailsTitle')}
titleTooltip={t('simulationDetailsTitleTooltip')}
description={t('simulationDetailsSetApprovalForAllDesc')}
simulationHeading={t('withdrawing')}
simulationElements={simulationElements}
/>
);
Expand Down
1 change: 1 addition & 0 deletions ui/pages/confirmations/utils/confirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const REDESIGN_USER_TRANSACTION_TYPES = [

export const REDESIGN_DEV_TRANSACTION_TYPES = [
...REDESIGN_USER_TRANSACTION_TYPES,
TransactionType.tokenMethodApprove,
TransactionType.tokenMethodSetApprovalForAll,
];

Expand Down

0 comments on commit 93dbee0

Please sign in to comment.