-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add error page and and re-direct user fetch errors
- Loading branch information
1 parent
5032af6
commit 3c88479
Showing
11 changed files
with
150 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
|
||
import { ThemeEngine, Themes } from '@zero-tech/zui/components/ThemeEngine'; | ||
import { Button } from '@zero-tech/zui/components'; | ||
import ZeroLogo from '../../zero-logo.svg?react'; | ||
|
||
import { bemClassName } from '../../lib/bem'; | ||
import './error.scss'; | ||
|
||
const cn = bemClassName('error-page'); | ||
|
||
interface ErrorComponentProperties { | ||
onRetry: () => void; | ||
} | ||
|
||
export const ErrorComponent = ({ onRetry }: ErrorComponentProperties) => { | ||
return ( | ||
<> | ||
<ThemeEngine theme={Themes.Dark} /> | ||
<div {...cn('')}> | ||
<main {...cn('content')}> | ||
<div {...cn('logo-container')}> | ||
<ZeroLogo /> | ||
</div> | ||
<div {...cn('message-container')}> | ||
<h3 {...cn('message')}>There was an error loading ZERO, please try again.</h3> | ||
<Button onPress={onRetry}>Try Again</Button> | ||
</div> | ||
</main> | ||
</div> | ||
</> | ||
); | ||
}; |
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,11 @@ | ||
import { ErrorComponent } from './error-component'; | ||
|
||
export const ErrorPage = () => { | ||
const handleRetry = () => { | ||
window.location.href = '/'; | ||
}; | ||
|
||
const error = 'There was an error loading ZERO, please try again.'; | ||
|
||
return <ErrorComponent onRetry={handleRetry} error={error} />; | ||
}; |
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,54 @@ | ||
@use '~@zero-tech/zui/styles/theme' as theme; | ||
|
||
@import '../../background'; | ||
@import '../../glass'; | ||
|
||
.error-page { | ||
@include root-background; | ||
|
||
position: absolute; | ||
overflow-y: auto; | ||
overflow-x: hidden; | ||
width: 100vw; | ||
height: 100vh; | ||
top: 0; | ||
left: 0; | ||
z-index: 10; | ||
|
||
&__content { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 100%; | ||
height: 100%; | ||
padding: 24px 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
&__logo-container { | ||
padding-left: 8px; | ||
margin-bottom: 76px; | ||
mix-blend-mode: screen; | ||
} | ||
|
||
&__message-container { | ||
@include glass-shadow-and-blur; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 24px; | ||
padding: 32px; | ||
background: rgba(11, 7, 7, 0.75); | ||
border-radius: 8px; | ||
} | ||
|
||
&__message { | ||
@include glass-text-primary-color; | ||
text-align: center; | ||
font-weight: 600; | ||
font-size: 18px; | ||
line-height: 22px; | ||
margin: 0; | ||
} | ||
} |
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 @@ | ||
export { ErrorPage } from './error-container'; |
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 +1,2 @@ | ||
export * from './login'; | ||
export * from './error'; |
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
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