-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: split ConfirmPage storybook pages by transaction type (#25283)
<!-- 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** - Separate ConfirmPage stories by signature type - Fix issue that caused 404 bug in storybook <!-- 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? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25283?quickstart=1) ## **Related issues** Fixes: #25052 (continuation) Related: #25054 ## **Manual testing steps** 1. `yarn storybook` 2. Go to http://localhost:6006/?path=/docs/pages-confirmation-confirmpage-signatures-permit--docs 3. View other stories in relevant signatures directory ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** ![CleanShot 2024-06-18 at 22 38 56@2x](https://github.com/MetaMask/metamask-extension/assets/20778143/8e0224cf-141a-4d39-a5fd-7a9146feeab4) ## **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
14 changed files
with
188 additions
and
120 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
4 changes: 2 additions & 2 deletions
4
ui/pages/confirmations/components/confirm/row/typed-sign-data-v1/typedSignDataV1.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
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
ui/pages/confirmations/confirm/stories/signatures/personal-sign.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import ConfirmPage from '../../confirm' | ||
import { | ||
ARG_TYPES_SIGNATURE, | ||
CONFIRM_PAGE_DECORATOR, | ||
SignatureStoryTemplate | ||
} from './utils'; | ||
import { signatureRequestSIWE, unapprovedPersonalSignMsg } from '../../../../../../test/data/confirmations/personal_sign'; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is a `personal_sign` signature. | ||
*/ | ||
export default { | ||
title: 'Pages/Confirmations/Confirm/Signatures/PersonalSign', | ||
component: ConfirmPage, | ||
decorators: CONFIRM_PAGE_DECORATOR, | ||
argTypes: ARG_TYPES_SIGNATURE, | ||
}; | ||
|
||
export const DefaultStory = (args) => { | ||
return SignatureStoryTemplate(args, unapprovedPersonalSignMsg); | ||
} | ||
DefaultStory.storyName = 'Default'; | ||
DefaultStory.args = { | ||
msgParams: { ...unapprovedPersonalSignMsg.msgParams }, | ||
}; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is a `personal_sign` signature | ||
* that parses as a valid Sign-in-With-Ethereum (SIWE)(EIP-4361) signature. | ||
*/ | ||
export const SignInWithEthereumStory = (args) => { | ||
return SignatureStoryTemplate(args, signatureRequestSIWE); | ||
} | ||
SignInWithEthereumStory.storyName = 'Sign-in With Ethereum (SIWE)'; | ||
SignInWithEthereumStory.args = { | ||
msgParams: { ...signatureRequestSIWE.msgParams }, | ||
}; |
52 changes: 52 additions & 0 deletions
52
ui/pages/confirmations/confirm/stories/signatures/sign-typed-data-v3-or-v4.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import ConfirmPage from '../../confirm' | ||
import { | ||
ARG_TYPES_SIGNATURE, | ||
CONFIRM_PAGE_DECORATOR, | ||
SignatureStoryTemplate | ||
} from './utils'; | ||
import { permitSignatureMsg, unapprovedTypedSignMsgV3, unapprovedTypedSignMsgV4 } from '../../../../../../test/data/confirmations/typed_sign'; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is either a version | ||
* "V3" or "V4" `eth_signTypedData` signature. The default example is version "V4". | ||
*/ | ||
export default { | ||
title: 'Pages/Confirmations/Confirm/Signatures/SignedTypedDataV3orV4', | ||
component: ConfirmPage, | ||
decorators: CONFIRM_PAGE_DECORATOR, | ||
argTypes: ARG_TYPES_SIGNATURE, | ||
}; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is either a | ||
* "V3" or "V4" `eth_signTypedData` signature that parses as a valid permit signature. | ||
*/ | ||
export const PermitStory = (args) => { | ||
return SignatureStoryTemplate(args, permitSignatureMsg); | ||
}; | ||
PermitStory.storyName = 'Permit'; | ||
PermitStory.args = { | ||
msgParams: { ...permitSignatureMsg.msgParams }, | ||
}; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is a "V3" `eth_signTypedData` signature. | ||
*/ | ||
export const V3Story = (args) => { | ||
return SignatureStoryTemplate(args, unapprovedTypedSignMsgV4); | ||
} | ||
V3Story.storyName = 'V3'; | ||
V3Story.args = { | ||
msgParams: { ...unapprovedTypedSignMsgV3.msgParams }, | ||
}; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is a "V4" `eth_signTypedData` signature. | ||
*/ | ||
export const DefaultStory = (args) => { | ||
return SignatureStoryTemplate(args, unapprovedTypedSignMsgV4); | ||
} | ||
DefaultStory.storyName = 'V4'; | ||
DefaultStory.args = { | ||
msgParams: { ...unapprovedTypedSignMsgV4.msgParams }, | ||
}; |
25 changes: 25 additions & 0 deletions
25
ui/pages/confirmations/confirm/stories/signatures/sign-typed-data.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import ConfirmPage from '../../confirm' | ||
import { | ||
ARG_TYPES_SIGNATURE, | ||
CONFIRM_PAGE_DECORATOR, | ||
SignatureStoryTemplate | ||
} from './utils'; | ||
import { unapprovedTypedSignMsgV1 } from '../../../../../../test/data/confirmations/typed_sign'; | ||
|
||
/** | ||
* The `<ConfirmPage>` that's displayed when the current confirmation is a version "V1" `eth_signTypedData` signature. | ||
*/ | ||
export default { | ||
title: 'Pages/Confirmations/Confirm/Signatures/SignTypedDataV1', | ||
component: ConfirmPage, | ||
decorators: CONFIRM_PAGE_DECORATOR, | ||
argTypes: ARG_TYPES_SIGNATURE, | ||
args: { | ||
msgParams: { ...unapprovedTypedSignMsgV1.msgParams }, | ||
}, | ||
}; | ||
|
||
export const DefaultStory = (args) => { | ||
return SignatureStoryTemplate(args, unapprovedTypedSignMsgV1); | ||
} | ||
DefaultStory.storyName = 'Default'; |
Oops, something went wrong.