-
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: show paymaster address in redesigned contract interaction (#25396)
Display the paymaster address in the contract interaction confirmation. Replace duplicate `Box` usages with new `ConfirmInfoSection` component. Add stories for the full contract interaction confirmation page for easier testing. Create selectors to retrieve paymaster data and address by user operation ID. Rename `AlertRow` to `ConfirmInfoAlertRow`.
- Loading branch information
1 parent
5960ae7
commit 3777882
Showing
36 changed files
with
868 additions
and
754 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
ui/components/app/confirm/info/row/__snapshots__/section.test.tsx.snap
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,21 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ConfirmInfoSection should match snapshot 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" | ||
> | ||
Test Content | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`ConfirmInfoSection should match snapshot without padding 1`] = ` | ||
<div> | ||
<div | ||
class="mm-box mm-box--margin-bottom-4 mm-box--padding-0 mm-box--background-color-background-default mm-box--rounded-md" | ||
> | ||
Test Content | ||
</div> | ||
</div> | ||
`; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import { ConfirmInfoSection } from './section'; | ||
import { ConfirmInfoRow } from './row'; | ||
import { ConfirmInfoRowText } from './text'; | ||
|
||
const ConfirmInfoSectionStory = { | ||
title: 'Components/App/Confirm/InfoSection', | ||
component: ConfirmInfoSection, | ||
|
||
decorators: [ | ||
(story) => ( | ||
<div | ||
style={{ | ||
backgroundColor: 'var(--color-background-alternative)', | ||
padding: 30, | ||
}} | ||
> | ||
{story()} | ||
</div> | ||
), | ||
], | ||
|
||
argTypes: { | ||
noPadding: { | ||
control: 'boolean', | ||
}, | ||
}, | ||
}; | ||
|
||
export const DefaultStory = (args) => ( | ||
<> | ||
<ConfirmInfoSection {...args}> | ||
<ConfirmInfoRow label="Test Label 1"> | ||
<ConfirmInfoRowText text="Test Value 1"></ConfirmInfoRowText> | ||
</ConfirmInfoRow> | ||
<ConfirmInfoRow label="Test Label 2"> | ||
<ConfirmInfoRowText text="Test Value 2"></ConfirmInfoRowText> | ||
</ConfirmInfoRow> | ||
</ConfirmInfoSection> | ||
<ConfirmInfoSection {...args}> | ||
<ConfirmInfoRow label="Test Label 3"> | ||
<ConfirmInfoRowText text="Test Value 3"></ConfirmInfoRowText> | ||
</ConfirmInfoRow> | ||
<ConfirmInfoRow label="Test Label 4"> | ||
<ConfirmInfoRowText text="Test Value 4"></ConfirmInfoRowText> | ||
</ConfirmInfoRow> | ||
</ConfirmInfoSection> | ||
</> | ||
); | ||
|
||
DefaultStory.args = { | ||
noPadding: false, | ||
}; | ||
|
||
export default ConfirmInfoSectionStory; |
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,19 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { ConfirmInfoSection } from './section'; | ||
|
||
describe('ConfirmInfoSection', () => { | ||
it('should match snapshot', () => { | ||
const { container } = render( | ||
<ConfirmInfoSection>Test Content</ConfirmInfoSection>, | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should match snapshot without padding', () => { | ||
const { container } = render( | ||
<ConfirmInfoSection noPadding>Test Content</ConfirmInfoSection>, | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
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,27 @@ | ||
import React from 'react'; | ||
import { Box } from '../../../../component-library'; | ||
import { | ||
BackgroundColor, | ||
BorderRadius, | ||
} from '../../../../../helpers/constants/design-system'; | ||
|
||
export type ConfirmInfoSectionProps = { | ||
children: React.ReactNode | string; | ||
noPadding?: boolean; | ||
}; | ||
|
||
export const ConfirmInfoSection = ({ | ||
children, | ||
noPadding, | ||
}: ConfirmInfoSectionProps) => { | ||
return ( | ||
<Box | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
borderRadius={BorderRadius.MD} | ||
padding={noPadding ? 0 : 2} | ||
marginBottom={4} | ||
> | ||
{children} | ||
</Box> | ||
); | ||
}; |
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.