This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Error page improvements. #1259
Merged
Merged
Error page improvements. #1259
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
568e0c5
Fake error. Revert this
alongoni 6d78eff
add header component
alongoni de834ea
fix styles on layout
alongoni 1f69f83
mobile fixes
alongoni b5566d4
add critical label for GH report
alongoni c3ca0b3
mobile fixes on menu
alongoni a1d5210
add CowSwap logo and replace Header component
alongoni 0ac19a8
add CowError meme
alongoni 7b63618
fix title on mobile
alongoni c2a663a
fix GH query and styles
alongoni 0c6481f
fix padding on erro box
alongoni 05b6fd8
fix cow shadow for dark mode
alongoni 44e1888
eleted forced error
alongoni dce055d
Merge branch 'develop' into issue-1255-styles-hard-error
mergify[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -2,43 +2,109 @@ import { Trans } from '@lingui/macro' | |
import React, { ErrorInfo } from 'react' | ||
import store, { AppState } from 'state/index' | ||
import { ExternalLink, TYPE } from 'theme/index' | ||
import Page, { Title } from 'components/Page' | ||
import { AutoColumn } from 'components/Column' | ||
import styled from 'styled-components/macro' | ||
import ReactGA from 'react-ga' | ||
import { getUserAgent } from 'utils/getUserAgent' | ||
import { AutoRow } from 'components/Row' | ||
import { MEDIA_WIDTHS } from '@src/theme' | ||
import CowError from 'assets/cow-swap/CowError.png' | ||
|
||
const FallbackWrapper = styled.div` | ||
const AppWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
flex-flow: column; | ||
align-items: center; | ||
z-index: 1; | ||
min-height: 100vh; | ||
overflow-x: hidden; | ||
` | ||
|
||
const Wrapper = styled(Page)` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100vw; | ||
max-width: 60vw; | ||
margin: 120px 0; | ||
|
||
@media screen and (max-width: ${MEDIA_WIDTHS.upToSmall}px) { | ||
max-width: 95vw; | ||
margin: 0 0 80px; | ||
} | ||
` | ||
|
||
const BodyWrapper = styled.div<{ margin?: string }>` | ||
padding: 1rem; | ||
const StyledTitle = styled(Title)` | ||
@media screen and (max-width: ${MEDIA_WIDTHS.upToSmall}px) { | ||
text-align: center; | ||
} | ||
` | ||
|
||
const FlexContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
padding: 1rem 0 0.5rem 0; | ||
|
||
@media screen and (max-width: ${MEDIA_WIDTHS.upToMedium}px) { | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
` | ||
const HeaderWrapper = styled.div` | ||
${({ theme }) => theme.flexRowNoWrap} | ||
width: 100%; | ||
white-space: pre; | ||
justify-content: space-between; | ||
position: fixed; | ||
top: 0; | ||
z-index: 2; | ||
@media screen and (max-width: ${MEDIA_WIDTHS.upToSmall}px) { | ||
position: relative; | ||
} | ||
` | ||
|
||
export const LogoImage = styled.img.attrs((props) => ({ | ||
src: props.theme.logo.src, | ||
alt: props.theme.logo.alt, | ||
width: props.theme.logo.width, | ||
height: props.theme.logo.height, | ||
}))` | ||
object-fit: contain; | ||
|
||
${({ theme }) => theme.mediaWidth.upToSmall` | ||
width: 150px; | ||
`}; | ||
` | ||
|
||
const CowLogo = styled.div` | ||
display: flex; | ||
margin: 1rem; | ||
transition: transform 0.3s ease; | ||
|
||
&:hover { | ||
transform: rotate(-5deg); | ||
} | ||
` | ||
const CodeBlockWrapper = styled.div` | ||
background: ${({ theme }) => theme.bg1}; | ||
background: ${({ theme }) => theme.bg4}; | ||
overflow: auto; | ||
white-space: pre; | ||
box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.01), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), | ||
0px 24px 32px rgba(0, 0, 0, 0.01); | ||
border-radius: 24px; | ||
padding: 50px; | ||
border-radius: 16px; | ||
padding: 16px; | ||
color: ${({ theme }) => theme.text2}; | ||
|
||
${({ theme }) => theme.mediaWidth.upToSmall` | ||
padding: 12px; | ||
width: auto; | ||
`}; | ||
` | ||
|
||
const LinkWrapper = styled.div` | ||
color: ${({ theme }) => theme.blue1}; | ||
padding: 6px 24px; | ||
const StyledParagraph = styled.p` | ||
overflow-x: auto; | ||
` | ||
|
||
const SomethingWentWrongWrapper = styled.div` | ||
const LinkWrapper = styled.div` | ||
color: ${({ theme }) => theme.blue1}; | ||
padding: 6px 24px; | ||
` | ||
|
||
|
@@ -69,32 +135,34 @@ export default class ErrorBoundary extends React.Component<unknown, ErrorBoundar | |
if (error !== null) { | ||
const encodedBody = encodeURIComponent(issueBody(error)) | ||
return ( | ||
<FallbackWrapper> | ||
<BodyWrapper> | ||
<AppWrapper> | ||
<HeaderWrapper> | ||
<a href="."> | ||
<CowLogo> | ||
<LogoImage /> | ||
</CowLogo> | ||
</a> | ||
</HeaderWrapper> | ||
<Wrapper> | ||
<FlexContainer> | ||
<StyledTitle> | ||
<Trans> Something went wrong</Trans> | ||
</StyledTitle> | ||
<img src={CowError} alt="CowSwap Error" height="125" /> | ||
</FlexContainer> | ||
<AutoColumn gap={'md'}> | ||
<SomethingWentWrongWrapper> | ||
<TYPE.label fontSize={24} fontWeight={600}> | ||
<Trans> | ||
<span role="img" aria-label="cow-exclamation"> | ||
🐮❕ | ||
</span>{' '} | ||
Something went wrong | ||
</Trans> | ||
</TYPE.label> | ||
</SomethingWentWrongWrapper> | ||
<CodeBlockWrapper> | ||
<code> | ||
<TYPE.main fontSize={10} color={'text1'}> | ||
{error.stack} | ||
<StyledParagraph>{error.stack}</StyledParagraph> | ||
</TYPE.main> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After a review along with @matextrem, we came to the conclusion that it is not a CSS problem. For example on Safari we get:
Instead of:
|
||
</code> | ||
</CodeBlockWrapper> | ||
<AutoRow> | ||
<LinkWrapper> | ||
<ExternalLink | ||
id="create-github-issue-link" | ||
// href={`https://github.com/Uniswap/uniswap-interface/issues/new?assignees=&labels=bug&body=${encodedBody}&title=${encodeURIComponent( | ||
href={`https://github.com/gnosis/cowswap/issues/new?assignees=&labels=bug&body=${encodedBody}&title=${encodeURIComponent( | ||
href={`https://github.com/gnosis/cowswap/issues/new?assignees=&labels=🐞 Bug,🔥 Critical&body=${encodedBody}&title=${encodeURIComponent( | ||
henrypalacios marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`Crash report: \`${error.name}${error.message && `: ${error.message}`}\`` | ||
)}`} | ||
target="_blank" | ||
|
@@ -106,7 +174,6 @@ export default class ErrorBoundary extends React.Component<unknown, ErrorBoundar | |
</ExternalLink> | ||
</LinkWrapper> | ||
<LinkWrapper> | ||
{/* <ExternalLink id="get-support-on-discord" href="https://discord.gg/FCfyBSbCU5" target="_blank"> */} | ||
<ExternalLink id="get-support-on-discord" href="https://chat.cowswap.exchange/" target="_blank"> | ||
<TYPE.link fontSize={16}> | ||
<Trans>Get support on Discord</Trans> | ||
|
@@ -116,8 +183,8 @@ export default class ErrorBoundary extends React.Component<unknown, ErrorBoundar | |
</LinkWrapper> | ||
</AutoRow> | ||
</AutoColumn> | ||
</BodyWrapper> | ||
</FallbackWrapper> | ||
</Wrapper> | ||
</AppWrapper> | ||
) | ||
} | ||
return this.props.children | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anxolin As you anticipated, I have some problems with the header links. Maybe because the header is inside the ErrorBoundary.
Can we try to fix that or maybe we can show only the CowSwap logo to go back to the home.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simplify as u suggest. An alternative header, with just a Logo suffices.
The less logic we add there, the less chances we break it. So I would add only HTML Markup, not logics that can fail