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

feat(PageError): add component for pretty display error of page #852

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Daniil-Pabolkov
Copy link
Collaborator

@Daniil-Pabolkov Daniil-Pabolkov commented Nov 8, 2024

@Daniil-Pabolkov Daniil-Pabolkov force-pushed the YTFRONT-4049 branch 5 times, most recently from 9b8a876 to 40a355b Compare November 11, 2024 11:25
@Daniil-Pabolkov Daniil-Pabolkov marked this pull request as ready for review November 11, 2024 11:52
@Daniil-Pabolkov Daniil-Pabolkov force-pushed the YTFRONT-4049 branch 2 times, most recently from 78f692c to 1c6ebe8 Compare November 11, 2024 13:15
{code !== undefined && <React.Fragment>[{ypath.getValue(code)}]</React.Fragment>}
{code !== undefined && (
<>
&#32;<span className={b('error-code')}>[{ypath.getValue(code)}]</span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&#32;?

@@ -26,6 +26,10 @@
margin-bottom: 0;
}

&__error-code {
white-space: nowrap;
Copy link
Collaborator

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;
Copy link
Collaborator

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%;
Copy link
Collaborator

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);
Copy link
Collaborator

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';
Copy link
Collaborator

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;
Copy link
Collaborator

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);
Copy link
Collaborator

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;
Copy link
Collaborator

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}) => {
Copy link
Collaborator

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}
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants