-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
getHelpUrl
config where users can go with error logs (#2685)
* optional supportUrl & error log copy button * dont freak out when user rejects in their wallet * remove g flag because it behaves funny * get help bro * the * more generic property name * dont say help twice
- Loading branch information
1 parent
6dbc1f1
commit 418068b
Showing
4 changed files
with
107 additions
and
25 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
72 changes: 72 additions & 0 deletions
72
wormhole-connect/src/views/v2/Bridge/ReviewTransaction/SendError.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,72 @@ | ||
import React, { useState } from 'react'; | ||
import { makeStyles } from 'tss-react/mui'; | ||
import config from 'config'; | ||
import AlertBannerV2 from 'components/v2/AlertBanner'; | ||
import { copyTextToClipboard } from 'utils'; | ||
import { Box, Typography } from '@mui/material'; | ||
import CopyIcon from '@mui/icons-material/ContentCopy'; | ||
import DoneIcon from '@mui/icons-material/Done'; | ||
|
||
type Props = { | ||
humanError?: string; | ||
internalError?: any; | ||
}; | ||
|
||
const useStyles = makeStyles()((theme: any) => ({ | ||
copyIcon: { | ||
fontSize: '14px', | ||
}, | ||
doneIcon: { | ||
fontSize: '14px', | ||
color: theme.palette.success.main, | ||
}, | ||
})); | ||
|
||
export default ({ humanError, internalError }: Props) => { | ||
const { classes } = useStyles(); | ||
|
||
const [justCopied, setJustCopied] = useState(false); | ||
|
||
if (humanError === undefined) { | ||
return null; | ||
} | ||
|
||
const getHelp = | ||
internalError && internalError.message && config.ui.getHelpUrl ? ( | ||
<Typography fontSize={14} sx={{ marginTop: 1 }}> | ||
Having trouble?{' '} | ||
<a | ||
href="#" | ||
onClick={() => { | ||
copyTextToClipboard(internalError.message); | ||
setJustCopied(true); | ||
setTimeout(() => setJustCopied(false), 3000); | ||
}} | ||
> | ||
Copy the error logs{' '} | ||
{justCopied ? ( | ||
<DoneIcon className={classes.doneIcon} /> | ||
) : ( | ||
<CopyIcon className={classes.copyIcon} /> | ||
)} | ||
</a> | ||
{' and '} | ||
<a href={config.ui.getHelpUrl} target="_blank"> | ||
ask for help | ||
</a> | ||
. | ||
</Typography> | ||
) : null; | ||
|
||
return ( | ||
<Box sx={{ marginBottom: 2 }}> | ||
<AlertBannerV2 | ||
error | ||
content={humanError} | ||
show={true} | ||
testId="send-error-message" | ||
/> | ||
{getHelp} | ||
</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