Skip to content

Commit

Permalink
fix: Add origin row to transfer confirmations (#28936)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR adds an origin row as well as a content divider as per the
latest designs (see screenshot below).

Additionally, ConfirmInfoSection has been moved to inside the
SimulationDetails component, to fix a visual bug that showed additional
margin on the UI, even when the SimulationDetails component was not
being rendered.



<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
<img width="371" alt="Screenshot 2024-12-04 at 17 34 20"
src="https://github.com/user-attachments/assets/7bd18e70-7992-454a-b92c-bcbdecb293f6">

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28936?quickstart=1)

## **Related issues**

Fixes: #28928

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
pedronfigueiredo authored Dec 6, 2024
1 parent 90695c5 commit 8de03c0
Show file tree
Hide file tree
Showing 10 changed files with 300 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { TransactionMeta } from '@metamask/transaction-controller';
import React from 'react';

import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { useConfirmContext } from '../../../../context/confirm';
import { SimulationDetails } from '../../../simulation-details';
import { AdvancedDetails } from '../shared/advanced-details/advanced-details';
Expand All @@ -18,13 +16,11 @@ const BaseTransactionInfo = () => {

return (
<>
<ConfirmInfoSection noPadding>
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
/>
</ConfirmInfoSection>
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
/>
<TransactionDetails />
<GasFeesSection />
<AdvancedDetails />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`NativeTransferInfo renders correctly 1`] = `
</div>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
data-testid="confirmation__transaction-flow"
data-testid="confirmation__token-details-section"
>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
Expand Down Expand Up @@ -141,6 +141,53 @@ exports[`NativeTransferInfo renders correctly 1`] = `
</p>
</div>
</div>
<div
style="height: 1px; margin-left: -8px; margin-right: -8px;"
/>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
data-testid="transaction-details-origin-row"
style="overflow-wrap: anywhere; min-height: 24px; position: relative; background: transparent;"
>
<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-text-default"
>
<div
class="mm-box mm-box--display-flex mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md-medium mm-box--color-inherit"
>
Request from
</p>
<div>
<div
aria-describedby="tippy-tooltip-2"
class=""
data-original-title="This is the site asking for your confirmation."
data-tooltipped=""
style="display: flex;"
tabindex="0"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--margin-left-1 mm-box--display-inline-block mm-box--color-icon-muted"
data-testid="transaction-details-origin-row-tooltip"
style="mask-image: url('./images/icons/question.svg');"
/>
</div>
</div>
</div>
</div>
<div
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
>
metamask.github.io
</p>
</div>
</div>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
style="overflow-wrap: anywhere; min-height: 24px; position: relative;"
Expand All @@ -158,7 +205,7 @@ exports[`NativeTransferInfo renders correctly 1`] = `
</p>
<div>
<div
aria-describedby="tippy-tooltip-2"
aria-describedby="tippy-tooltip-3"
class=""
data-original-title="This is the contract you're interacting with. Protect yourself from scammers by verifying the details."
data-tooltipped=""
Expand Down Expand Up @@ -255,7 +302,7 @@ exports[`NativeTransferInfo renders correctly 1`] = `
</p>
<div>
<div
aria-describedby="tippy-tooltip-3"
aria-describedby="tippy-tooltip-4"
class=""
data-original-title="Amount paid to process the transaction on network."
data-tooltipped=""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { TransactionMeta } from '@metamask/transaction-controller';
import React from 'react';
import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { useConfirmContext } from '../../../../context/confirm';
import { SimulationDetails } from '../../../simulation-details';
import { AdvancedDetails } from '../shared/advanced-details/advanced-details';
Expand All @@ -19,16 +18,12 @@ const NativeTransferInfo = () => {
<>
<NativeSendHeading />
<TransactionFlowSection />
{
<ConfirmInfoSection noPadding>
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
metricsOnly={isWalletInitiated}
/>
</ConfirmInfoSection>
}
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
metricsOnly={isWalletInitiated}
/>
<TokenDetailsSection />
<GasFeesSection />
<AdvancedDetails />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ exports[`NFTTokenTransferInfo renders correctly 1`] = `
</div>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
data-testid="confirmation__transaction-flow"
data-testid="confirmation__token-details-section"
>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
Expand Down Expand Up @@ -169,6 +169,53 @@ exports[`NFTTokenTransferInfo renders correctly 1`] = `
</p>
</div>
</div>
<div
style="height: 1px; margin-left: -8px; margin-right: -8px;"
/>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
data-testid="transaction-details-origin-row"
style="overflow-wrap: anywhere; min-height: 24px; position: relative; background: transparent;"
>
<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-text-default"
>
<div
class="mm-box mm-box--display-flex mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md-medium mm-box--color-inherit"
>
Request from
</p>
<div>
<div
aria-describedby="tippy-tooltip-2"
class=""
data-original-title="This is the site asking for your confirmation."
data-tooltipped=""
style="display: flex;"
tabindex="0"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--margin-left-1 mm-box--display-inline-block mm-box--color-icon-muted"
data-testid="transaction-details-origin-row-tooltip"
style="mask-image: url('./images/icons/question.svg');"
/>
</div>
</div>
</div>
</div>
<div
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
>
metamask.github.io
</p>
</div>
</div>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
style="overflow-wrap: anywhere; min-height: 24px; position: relative;"
Expand All @@ -186,7 +233,7 @@ exports[`NFTTokenTransferInfo renders correctly 1`] = `
</p>
<div>
<div
aria-describedby="tippy-tooltip-2"
aria-describedby="tippy-tooltip-3"
class=""
data-original-title="This is the contract you're interacting with. Protect yourself from scammers by verifying the details."
data-tooltipped=""
Expand Down Expand Up @@ -283,7 +330,7 @@ exports[`NFTTokenTransferInfo renders correctly 1`] = `
</p>
<div>
<div
aria-describedby="tippy-tooltip-3"
aria-describedby="tippy-tooltip-4"
class=""
data-original-title="Amount paid to process the transaction on network."
data-tooltipped=""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { TransactionMeta } from '@metamask/transaction-controller';
import React from 'react';
import { ConfirmInfoSection } from '../../../../../../components/app/confirm/info/row/section';
import { useConfirmContext } from '../../../../context/confirm';
import { SimulationDetails } from '../../../simulation-details';
import { AdvancedDetails } from '../shared/advanced-details/advanced-details';
Expand All @@ -19,16 +18,12 @@ const NFTTokenTransferInfo = () => {
<>
<NFTSendHeading />
<TransactionFlowSection />
{
<ConfirmInfoSection noPadding>
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
metricsOnly={isWalletInitiated}
/>
</ConfirmInfoSection>
}
<SimulationDetails
transaction={transactionMeta}
isTransactionsRedesign
enableMetrics
metricsOnly={isWalletInitiated}
/>
<TokenDetailsSection />
<GasFeesSection />
<AdvancedDetails />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`TokenDetailsSection renders correctly 1`] = `
<div>
<div
class="mm-box mm-box--margin-bottom-4 mm-box--padding-2 mm-box--background-color-background-default mm-box--rounded-md"
data-testid="confirmation__transaction-flow"
data-testid="confirmation__token-details-section"
>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
Expand Down Expand Up @@ -38,6 +38,53 @@ exports[`TokenDetailsSection renders correctly 1`] = `
</p>
</div>
</div>
<div
style="height: 1px; margin-left: -8px; margin-right: -8px;"
/>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
data-testid="transaction-details-origin-row"
style="overflow-wrap: anywhere; min-height: 24px; position: relative; background: transparent;"
>
<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-text-default"
>
<div
class="mm-box mm-box--display-flex mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md-medium mm-box--color-inherit"
>
Request from
</p>
<div>
<div
aria-describedby="tippy-tooltip-1"
class=""
data-original-title="This is the site asking for your confirmation."
data-tooltipped=""
style="display: flex;"
tabindex="0"
>
<span
class="mm-box mm-icon mm-icon--size-sm mm-box--margin-left-1 mm-box--display-inline-block mm-box--color-icon-muted"
data-testid="transaction-details-origin-row-tooltip"
style="mask-image: url('./images/icons/question.svg');"
/>
</div>
</div>
</div>
</div>
<div
class="mm-box mm-box--display-flex mm-box--gap-2 mm-box--flex-wrap-wrap mm-box--align-items-center"
>
<p
class="mm-box mm-text mm-text--body-md mm-box--color-inherit"
>
metamask.github.io
</p>
</div>
</div>
<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--align-items-flex-start mm-box--color-text-default mm-box--rounded-lg"
style="overflow-wrap: anywhere; min-height: 24px; position: relative;"
Expand All @@ -55,7 +102,7 @@ exports[`TokenDetailsSection renders correctly 1`] = `
</p>
<div>
<div
aria-describedby="tippy-tooltip-1"
aria-describedby="tippy-tooltip-2"
class=""
data-original-title="This is the contract you're interacting with. Protect yourself from scammers by verifying the details."
data-tooltipped=""
Expand Down
Loading

0 comments on commit 8de03c0

Please sign in to comment.