-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(PageError): add component for pretty display error of page #852
base: main
Are you sure you want to change the base?
Conversation
9b8a876
to
40a355b
Compare
78f692c
to
1c6ebe8
Compare
{code !== undefined && <React.Fragment>[{ypath.getValue(code)}]</React.Fragment>} | ||
{code !== undefined && ( | ||
<> | ||
 <span className={b('error-code')}>[{ypath.getValue(code)}]</span> |
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.
 
?
@@ -26,6 +26,10 @@ | |||
margin-bottom: 0; | |||
} | |||
|
|||
&__error-code { | |||
white-space: nowrap; |
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.
The value of the block is single number. Do you know other cases?
flex-direction: row; | ||
align-items: stretch; | ||
gap: 30px; | ||
max-width: 90vw; |
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.
What if we want to use the block in a modal dialog?
justify-content: center; | ||
flex: 1; | ||
min-width: 100%; | ||
min-height: 100%; |
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.
Do we really need min-width
, min-height
here?
color: var(--g-color-text-complementary); | ||
font-family: var(--g-text-body-font-family); | ||
font-size: var(--g-text-subheader-1-font-size); | ||
line-height: var(--g-text-subheader-1-line-height); |
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.
Is it better to use <Text ... /> from @gravity-ui/uikit
.
@@ -0,0 +1,58 @@ | |||
import {createSelector} from 'reselect'; |
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.
It is alway better to use git mv
to keep history of changes of renamed files.
@@ -134,23 +135,14 @@ export const getSupportedTabs = createSelector( | |||
}, | |||
); | |||
|
|||
const emptyHandler = () => undefined; |
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.
Do we really need it?
&__title { | ||
font-family: var(--g-text-body-font-family); | ||
font-size: var(--g-text-subheader-3-font-size); | ||
line-height: var(--g-text-subheader-3-line-height); |
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.
<Text ... />
import React, {useMemo} from 'react'; | ||
|
||
const tokenRegex = | ||
/(\/{1,2}@[^/]+?[^/.,_-]+)|(\/{1,2}[^/.,_-]+)|([.,_-]{1,3}[^/.,_-]+)|([.,_-]{1,3})/g; |
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.
It is better to use YPath to split path.
path: string; | ||
} | ||
|
||
export const WordWrapPath: React.FC<WordWrapPathProps> = ({path}) => { |
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.
Why do you prefer useMemo
instead of React.memo
?
</div> | ||
<PageError | ||
error={permissionDeniedError ?? details} | ||
type={isPermissionDenied ? PageErrorType.PermissionsDenied : PageErrorType.NotFound} |
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.
There are a lot of other types of errors except PermissionDenied and NotFound
@@ -365,7 +365,13 @@ class OperationDetail extends React.Component<ReduxProps & RouteProps> { | |||
renderError() { | |||
const {errorData} = this.props; | |||
|
|||
return <Error message={errorData.message} error={errorData.details} />; | |||
return ( | |||
<PageError |
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.
There are a lot of other types of errors except PermissionDenied and NotFound
1c6ebe8
to
89bb615
Compare
89bb615
to
703c05a
Compare
703c05a
to
c45447b
Compare
https://nda.ya.ru/t/GIE-qkOP79aLaC