Skip to content

Commit

Permalink
Merge pull request #327 from hyperlane-xyz/rossy/component-dedupe
Browse files Browse the repository at this point in the history
Remove components, logos, and icons that have been migrated to the widgets lib
  • Loading branch information
jmrossy authored Nov 18, 2024
2 parents 508ce51 + 54c05a7 commit bb3982f
Show file tree
Hide file tree
Showing 68 changed files with 96 additions and 1,027 deletions.
28 changes: 0 additions & 28 deletions src/components/animation/SmallSpinner.tsx

This file was deleted.

81 changes: 0 additions & 81 deletions src/components/animation/Spinner.module.css

This file was deleted.

25 changes: 0 additions & 25 deletions src/components/animation/Spinner.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions src/components/banner/WarningBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Image from 'next/image';
import { WarningIcon } from '@hyperlane-xyz/widgets';
import { PropsWithChildren, ReactNode } from 'react';
import WarningIcon from '../../images/icons/warning.svg';

export function WarningBanner({
isVisible,
Expand All @@ -21,7 +20,7 @@ export function WarningBanner({
} overflow-hidden transition-all duration-500 ${className}`}
>
<div className="flex items-center gap-2">
<Image src={WarningIcon} width={20} height={20} alt="Warning:" />
<WarningIcon width={20} height={20} />
{children}
</div>
<button
Expand Down
51 changes: 0 additions & 51 deletions src/components/buttons/IconButton.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions src/components/buttons/SwitchButton.module.css

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/buttons/SwitchButton.tsx

This file was deleted.

56 changes: 10 additions & 46 deletions src/components/errors/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +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 max-w-2xl 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>
);
}
52 changes: 0 additions & 52 deletions src/components/icons/Chevron.tsx

This file was deleted.

Loading

0 comments on commit bb3982f

Please sign in to comment.