Cleanup error/loading screens
This commit is contained in:
parent
aa988e9f4a
commit
940706bed0
12 changed files with 77 additions and 530 deletions
49
src/FullScreenView.jsx
Normal file
49
src/FullScreenView.jsx
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import React, { useEffect } from "react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { ErrorMessage } from "./Input";
|
||||
import styles from "./FullScreenView.module.css";
|
||||
import { Header, HeaderLogo, LeftNav, RightNav } from "./Header";
|
||||
|
||||
export function FullScreenView({ children }) {
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<Header>
|
||||
<LeftNav>
|
||||
<HeaderLogo />
|
||||
</LeftNav>
|
||||
<RightNav />
|
||||
</Header>
|
||||
<div className={styles.container}>
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorView({ error }) {
|
||||
const location = useLocation();
|
||||
|
||||
useEffect(() => {
|
||||
console.error(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<FullScreenView>
|
||||
<h1>Error</h1>
|
||||
<ErrorMessage>{error.message}</ErrorMessage>
|
||||
{location.pathname !== "/" && (
|
||||
<Link className={styles.homeLink} to="/">
|
||||
Return to home screen
|
||||
</Link>
|
||||
)}
|
||||
</FullScreenView>
|
||||
);
|
||||
}
|
||||
|
||||
export function LoadingView() {
|
||||
return (
|
||||
<FullScreenView>
|
||||
<h1>Loading...</h1>
|
||||
</FullScreenView>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue