-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: De-duplicate images, components, and most utils with widgets l…
…ib (#143) Remove more dead and duplicated code, favoring widgets lib versions
- Loading branch information
Showing
48 changed files
with
44 additions
and
508 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,15 @@ | ||
import Image from 'next/image'; | ||
import { Component } from 'react'; | ||
|
||
import { ErrorBoundary as ErrorBoundaryInner } from '@hyperlane-xyz/widgets'; | ||
import { PropsWithChildren } from 'react'; | ||
import { links } from '../../consts/links'; | ||
import ErrorIcon from '../../images/icons/error-circle.svg'; | ||
import { logger } from '../../utils/logger'; | ||
|
||
interface ErrorBoundaryState { | ||
error: any; | ||
errorInfo: any; | ||
export function ErrorBoundary({ children }: PropsWithChildren<unknown>) { | ||
return <ErrorBoundaryInner supportLink={<SupportLink />}>{children}</ErrorBoundaryInner>; | ||
} | ||
|
||
export class ErrorBoundary extends Component<any, ErrorBoundaryState> { | ||
constructor(props: any) { | ||
super(props); | ||
this.state = { error: null, errorInfo: null }; | ||
} | ||
|
||
componentDidCatch(error: any, errorInfo: any) { | ||
this.setState({ | ||
error, | ||
errorInfo, | ||
}); | ||
logger.error('Error caught by error boundary', error, errorInfo); | ||
} | ||
|
||
render() { | ||
const errorInfo = this.state.error || this.state.errorInfo; | ||
if (errorInfo) { | ||
const details = errorInfo.message || JSON.stringify(errorInfo); | ||
return ( | ||
<div className="flex h-screen w-screen items-center justify-center bg-gray-50"> | ||
<div className="flex flex-col items-center"> | ||
<Image src={ErrorIcon} width={80} height={80} alt="" /> | ||
<h1 className="mt-5 text-lg">Fatal Error Occurred</h1> | ||
<div className="mt-5 text-sm">{details}</div> | ||
<a | ||
href={links.discord} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="mt-5 text-sm" | ||
> | ||
For support, join the{' '} | ||
<span className="underline underline-offset-2">Hyperlane Discord</span>{' '} | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} | ||
return this.props.children; | ||
} | ||
function SupportLink() { | ||
return ( | ||
<a href={links.discord} target="_blank" rel="noopener noreferrer" className="mt-5 text-sm"> | ||
For support, join the <span className="underline underline-offset-2">Hyperlane Discord</span>{' '} | ||
</a> | ||
); | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export const MIN_ROUNDED_VALUE = 0.00001; | ||
export const DISPLAY_DECIMALS = 5; | ||
export const DELIVERY_LOG_CHECK_BLOCK_RANGE = 1_000; | ||
export const PI_MESSAGE_LOG_CHECK_BLOCK_RANGE = 5_000; |
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.