This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk): allow to retry with metamask if failed to send via gsn
- Loading branch information
Showing
16 changed files
with
234 additions
and
43 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
11 changes: 11 additions & 0 deletions
11
packages/extension/src/ui/components/ErrorBlock/error.scss
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,11 @@ | ||
@import '../../styles/variables'; | ||
|
||
$block-radius: map-get($rounded-corner-map, 'm'); | ||
|
||
.left-button { | ||
border-radius: 0 0 0 $block-radius !important; | ||
} | ||
|
||
.right-button { | ||
border-radius: 0 0 $block-radius 0 !important; | ||
} |
110 changes: 110 additions & 0 deletions
110
packages/extension/src/ui/components/ErrorBlock/index.jsx
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,110 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classnames from 'classnames'; | ||
import { | ||
FlexBox, | ||
Block, | ||
Text, | ||
Icon, | ||
} from '@aztec/guacamole-ui'; | ||
import i18n from '~/ui/helpers/i18n'; | ||
import EntityBlock from '~/ui/components/AnimatedBlocks/EntityBlock'; | ||
import Button from '~/ui/components/Button'; | ||
import styles from './error.scss'; | ||
|
||
const ErrorBlock = ({ | ||
className, | ||
message, | ||
leftButtonText, | ||
onClickLeftButton, | ||
rightButtonText, | ||
onClickRightButton, | ||
}) => { | ||
const buttonNode = ( | ||
<FlexBox | ||
align="center" | ||
direction="row" | ||
valing="center" | ||
nowrap | ||
expand | ||
> | ||
{!!(leftButtonText && onClickLeftButton) && ( | ||
<Button | ||
testId="button-step-previous" | ||
className={styles['left-button']} | ||
theme="white" | ||
size="m" | ||
text={leftButtonText} | ||
onSubmit={onClickLeftButton} | ||
expand | ||
/> | ||
)} | ||
{!!(rightButtonText && onClickRightButton) && ( | ||
<Button | ||
testId="button-step-next" | ||
className={styles['right-button']} | ||
theme="secondary" | ||
size="m" | ||
text={rightButtonText} | ||
onSubmit={onClickRightButton} | ||
expand | ||
/> | ||
)} | ||
</FlexBox> | ||
); | ||
|
||
return ( | ||
<EntityBlock | ||
className={classnames( | ||
className, | ||
styles.block, | ||
)} | ||
title={( | ||
<Text | ||
text={i18n.t('transaction.error')} | ||
color="red" | ||
size="xs" | ||
weight="semibold" | ||
/> | ||
)} | ||
titleFootnote={( | ||
<Icon | ||
name="warning" | ||
color="red" | ||
size="m" | ||
/> | ||
)} | ||
content={( | ||
<Block padding="m 0"> | ||
<Text | ||
text={message} | ||
size="m" | ||
weight="light" | ||
/> | ||
</Block> | ||
)} | ||
layer={1} | ||
> | ||
{buttonNode} | ||
</EntityBlock> | ||
); | ||
}; | ||
|
||
ErrorBlock.propTypes = { | ||
className: PropTypes.string, | ||
message: PropTypes.string.isRequired, | ||
leftButtonText: PropTypes.string, | ||
onClickLeftButton: PropTypes.func, | ||
rightButtonText: PropTypes.string, | ||
onClickRightButton: PropTypes.func, | ||
}; | ||
|
||
ErrorBlock.defaultProps = { | ||
className: '', | ||
leftButtonText: '', | ||
onClickLeftButton: null, | ||
rightButtonText: '', | ||
onClickRightButton: null, | ||
}; | ||
|
||
export default ErrorBlock; |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.