-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: MMI adds note to trader support to the new Tx confirmation view (
#27214) ## **Description** Adds the MMI transaction "note to trader" functionality to the new transactions redesign, the current one is also kept in order to facilitate backwards compatibility with the current confirmation view (to be removed later). It also adds a few parameters that were missing for MMI like the tx metadata. ![note_to_trader_ss](https://github.com/user-attachments/assets/7a7f123a-f0de-48f9-8646-40aabd5e27b2) ## **Related issues** Fixes: ## **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/develop/.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/develop/.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
Showing
23 changed files
with
355 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
ui/components/institutional/note-to-trader/note-to-trader-tabbed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import React from 'react'; | ||
import { | ||
Display, | ||
FlexDirection, | ||
JustifyContent, | ||
} from '../../../helpers/constants/design-system'; | ||
import { Label, Box, Text } from '../../component-library'; | ||
|
||
type NoteToTraderProps = { | ||
placeholder: string; | ||
maxLength: number; | ||
onChange: (value: string) => void; | ||
noteText: string; | ||
labelText: string; | ||
}; | ||
|
||
const TabbedNoteToTrader: React.FC<NoteToTraderProps> = ({ | ||
placeholder, | ||
maxLength, | ||
onChange, | ||
noteText, | ||
labelText, | ||
}) => { | ||
return ( | ||
<Box className="confirm-page-container-content__data"> | ||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Column} | ||
padding={4} | ||
> | ||
<Box | ||
className="note-header" | ||
display={Display.Flex} | ||
justifyContent={JustifyContent.spaceBetween} | ||
> | ||
<Label htmlFor="transaction-note">{labelText}</Label> | ||
<Text className="note-header__counter"> | ||
{noteText.length}/{maxLength} | ||
</Text> | ||
</Box> | ||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Column} | ||
className="note-field" | ||
> | ||
<textarea | ||
id="transaction-note" | ||
data-testid="transaction-note" | ||
onChange={({ target: { value } }) => onChange(value)} | ||
autoFocus | ||
maxLength={maxLength} | ||
placeholder={placeholder} | ||
value={noteText} | ||
/> | ||
</Box> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default TabbedNoteToTrader; |
14 changes: 14 additions & 0 deletions
14
ui/components/institutional/note-to-trader/note-to-trader.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 17 additions & 10 deletions
27
ui/components/institutional/note-to-trader/note-to-trader.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.