Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 404 page #510

Merged
merged 8 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
279 changes: 279 additions & 0 deletions public/not-found.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ErrorBoundary: FallbackRender = (props) => {
});

return (
<BaseLayout subtitle="Unexpected error">
<BaseLayout title="Unexpected error">
<div>An unexpected error has occurred. Please refresh the page and try again.</div>
</BaseLayout>
);
Expand Down
8 changes: 4 additions & 4 deletions src/components/layout/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = {

const Layout = ({ children, title, subtitle }: Props) => {
return (
<BaseLayout subtitle={title}>
<BaseLayout title={title}>
<Header title={title} subtitle={subtitle} />
{children}
</BaseLayout>
Expand All @@ -26,10 +26,10 @@ const Layout = ({ children, title, subtitle }: Props) => {

interface BaseLayoutProps {
children: ReactNode;
subtitle: string;
title: string;
}

export const BaseLayout = ({ children, subtitle }: BaseLayoutProps) => {
export const BaseLayout = ({ children, title }: BaseLayoutProps) => {
const [showNotice, setShowNotice] = useState(
() => localStorage.getItem(ALLOW_ERROR_REPORTING) === null || localStorage.getItem(ALLOW_ANALYTICS) === null
);
Expand All @@ -43,7 +43,7 @@ export const BaseLayout = ({ children, subtitle }: BaseLayoutProps) => {
return (
<>
<Helmet>
<title>{`API3 DAO | ${subtitle}`}</title>
<title>{`API3 DAO | ${title}`}</title>
</Helmet>

<div className={styles.layout}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/history/history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const History = () => {
}, [history, checkedPrimary, checkedSecondary]);

return (
<BaseLayout subtitle="History">
<BaseLayout title="History">
<div className={styles.header}>
<Header title="History"></Header>
</div>
Expand Down
6 changes: 0 additions & 6 deletions src/pages/not-found.tsx

This file was deleted.

1 change: 1 addition & 0 deletions src/pages/not-found/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './not-found';
70 changes: 70 additions & 0 deletions src/pages/not-found/not-found.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@import '../../styles/variables.module.scss';
@import '../../styles/fonts.module.scss';

.wrapper {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 48px;
height: 100%;
width: 100%;

img {
width: 100%;
max-width: 310px;
}

@media (min-width: $sm) {
gap: 64px;

img {
max-width: 460px;
}
}

@media (min-width: $md) {
img {
max-width: 620px;
}
}
}

.content {
display: flex;
flex-direction: column;
align-items: center;
gap: 24px;

@media (min-width: $sm) {
gap: 32px;
}
}

.text {
display: flex;
flex-direction: column;
gap: 8px;
text-align: center;
color: $color-dark-blue-100;

h1 {
@include font-heading-9;
}

p {
@include font-body-15;
}

@media (min-width: $sm) {
gap: 16px;

h1 {
@include font-heading-5;
}

p {
@include font-body-3;
}
}
}
27 changes: 27 additions & 0 deletions src/pages/not-found/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { BaseLayout } from '../../components/layout';
import styles from './not-found.module.scss';
import { images } from '../../utils';
import Button from '../../components/button';

const NotFoundPage = () => {
return (
<BaseLayout title="404 Not Found">
<div className={styles.wrapper}>
<img src={images.notFound} alt="404" className={styles.image} />

<div className={styles.content}>
<div className={styles.text}>
<h1>Uh oh, that page doesn’t exist.</h1>
<p>Let’s get you back to home.</p>
</div>

<Button href="/" type="primary" className={styles.button} size="sm" sm={{ size: 'lg' }}>
Staking
</Button>
</div>
</div>
</BaseLayout>
);
};

export default NotFoundPage;
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const ProposalDetailsLayout = (props: ProposalDetailsContentProps) => {

const proposal = proposalDetailsSelector(provider, proposals, type, voteId);
return (
<BaseLayout subtitle={`Proposal ${voteId.toString()}`}>
<BaseLayout title={`Proposal ${voteId.toString()}`}>
<ProposalDetailsContent proposal={proposal} />
</BaseLayout>
);
Expand All @@ -82,6 +82,7 @@ const ProposalDetailsPage = () => {
const decoded = useMemo(() => decodeProposalTypeAndVoteId(typeAndVoteId), [typeAndVoteId]);

if (!decoded) return <NotFoundPage />;

return <ProposalDetailsLayout {...decoded} />;
};

Expand Down
1 change: 1 addition & 0 deletions src/utils/image-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const images = {
info: '/info.svg',
infoCircle: '/info-circle.svg',
notificationClose: '/notification-close.svg',
notFound: '/not-found.svg',
success: '/success.svg',
texture: '/texture.png',
triangleBracketLeft: '/triangle-bracket-left.svg',
Expand Down
Loading