@scm-manager/ui-components 3.6.1 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/src/ErrorBoundary.tsx +4 -2
- package/src/ErrorPage.tsx +19 -19
- package/src/Tag.tsx +40 -22
- package/src/__snapshots__/storyshots.test.ts.snap +1247 -819
- package/src/forms/Select.tsx +1 -1
- package/src/layout/Page.tsx +29 -63
- package/src/layout/Title.tsx +2 -12
- package/src/repos/DiffDropDown.tsx +1 -1
- package/src/repos/HunkExpandDivider.tsx +3 -0
- package/src/repos/HunkExpandLink.tsx +8 -4
- package/src/repos/changesets/ContributorRow.tsx +1 -1
- package/src/repos/diff/HunkFooter.tsx +3 -3
- package/src/repos/diff/HunkHeader.tsx +4 -5
- package/src/repos/diff/LastHunkFooter.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "UI Components for SCM-Manager and its plugins",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"react-query": "^3.39.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@scm-manager/ui-tests": "3.
|
|
36
|
-
"@scm-manager/ui-types": "3.
|
|
35
|
+
"@scm-manager/ui-tests": "3.7.0",
|
|
36
|
+
"@scm-manager/ui-types": "3.7.0",
|
|
37
37
|
"@types/fetch-mock": "^7.3.1",
|
|
38
38
|
"@types/react-select": "^2.0.19",
|
|
39
39
|
"@types/unist": "^2.0.3",
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
"@scm-manager/jest-preset": "^2.14.1",
|
|
68
68
|
"@scm-manager/prettier-config": "^2.12.0",
|
|
69
69
|
"@scm-manager/tsconfig": "^2.13.0",
|
|
70
|
-
"@scm-manager/ui-syntaxhighlighting": "3.
|
|
71
|
-
"@scm-manager/ui-shortcuts": "3.
|
|
72
|
-
"@scm-manager/ui-text": "3.
|
|
70
|
+
"@scm-manager/ui-syntaxhighlighting": "3.7.0",
|
|
71
|
+
"@scm-manager/ui-shortcuts": "3.7.0",
|
|
72
|
+
"@scm-manager/ui-text": "3.7.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@scm-manager/ui-core": "3.
|
|
76
|
-
"@scm-manager/ui-overlays": "3.
|
|
77
|
-
"@scm-manager/ui-layout": "3.
|
|
78
|
-
"@scm-manager/ui-buttons": "3.
|
|
79
|
-
"@scm-manager/ui-api": "3.
|
|
80
|
-
"@scm-manager/ui-extensions": "3.
|
|
75
|
+
"@scm-manager/ui-core": "3.7.0",
|
|
76
|
+
"@scm-manager/ui-overlays": "3.7.0",
|
|
77
|
+
"@scm-manager/ui-layout": "3.7.0",
|
|
78
|
+
"@scm-manager/ui-buttons": "3.7.0",
|
|
79
|
+
"@scm-manager/ui-api": "3.7.0",
|
|
80
|
+
"@scm-manager/ui-extensions": "3.7.0",
|
|
81
81
|
"deepmerge": "^4.2.2",
|
|
82
82
|
"hast-util-sanitize": "^3.0.2",
|
|
83
83
|
"react-diff-view": "^2.4.10",
|
package/src/ErrorBoundary.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import { useTranslation } from "react-i18next";
|
|
|
20
20
|
import classNames from "classnames";
|
|
21
21
|
import styled from "styled-components";
|
|
22
22
|
import { MissingLinkError, urls, useIndexLink } from "@scm-manager/ui-api";
|
|
23
|
+
import { useDocumentTitle } from "@scm-manager/ui-core";
|
|
23
24
|
import ErrorNotification from "./ErrorNotification";
|
|
24
25
|
import ErrorPage from "./ErrorPage";
|
|
25
26
|
import { Subtitle, Title } from "./layout";
|
|
@@ -53,6 +54,7 @@ const RedirectIconContainer = styled.div`
|
|
|
53
54
|
|
|
54
55
|
const RedirectPage = () => {
|
|
55
56
|
const [t] = useTranslation("commons");
|
|
57
|
+
useDocumentTitle(t("errorNotification.prefix"));
|
|
56
58
|
// we use an icon instead of loading spinner,
|
|
57
59
|
// because a redirect is synchron and a spinner does not spin on a synchron action
|
|
58
60
|
return (
|
|
@@ -106,7 +108,7 @@ const ErrorDisplay: FC<ErrorDisplayProps> = ({ error, errorInfo, fallback: Fallb
|
|
|
106
108
|
|
|
107
109
|
const fallbackProps = {
|
|
108
110
|
error,
|
|
109
|
-
errorInfo
|
|
111
|
+
errorInfo,
|
|
110
112
|
};
|
|
111
113
|
|
|
112
114
|
return <FallbackComponent {...fallbackProps} />;
|
|
@@ -128,7 +130,7 @@ class ErrorBoundary extends React.Component<Props, State> {
|
|
|
128
130
|
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
|
129
131
|
this.setState({
|
|
130
132
|
error,
|
|
131
|
-
errorInfo
|
|
133
|
+
errorInfo,
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
|
package/src/ErrorPage.tsx
CHANGED
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React from "react";
|
|
18
|
-
import
|
|
17
|
+
import React, { FC } from "react";
|
|
18
|
+
import { useTranslation } from "react-i18next";
|
|
19
19
|
import { BackendError, ForbiddenError } from "@scm-manager/ui-api";
|
|
20
|
+
import { useDocumentTitle } from "@scm-manager/ui-core";
|
|
21
|
+
import ErrorNotification from "./ErrorNotification";
|
|
20
22
|
|
|
21
23
|
type Props = {
|
|
22
24
|
error: Error;
|
|
@@ -24,28 +26,26 @@ type Props = {
|
|
|
24
26
|
subtitle: string;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<section className="section">
|
|
33
|
-
<div className="box column is-4 is-offset-4 container">
|
|
34
|
-
<h1 className="title">{title}</h1>
|
|
35
|
-
{this.renderSubtitle()}
|
|
36
|
-
<ErrorNotification error={error} />
|
|
37
|
-
</div>
|
|
38
|
-
</section>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
29
|
+
const ErrorPage: FC<Props> = ({ error, title, subtitle }) => {
|
|
30
|
+
const [t] = useTranslation("commons");
|
|
31
|
+
useDocumentTitle(t("errorNotification.prefix"));
|
|
41
32
|
|
|
42
|
-
renderSubtitle = () => {
|
|
43
|
-
const { error, subtitle } = this.props;
|
|
33
|
+
const renderSubtitle = () => {
|
|
44
34
|
if (error instanceof BackendError || error instanceof ForbiddenError) {
|
|
45
35
|
return null;
|
|
46
36
|
}
|
|
47
37
|
return <p className="subtitle">{subtitle}</p>;
|
|
48
38
|
};
|
|
49
|
-
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<section className="section">
|
|
42
|
+
<div className="box column is-4 is-offset-4 container">
|
|
43
|
+
<h1 className="title">{title}</h1>
|
|
44
|
+
{renderSubtitle()}
|
|
45
|
+
<ErrorNotification error={error} />
|
|
46
|
+
</div>
|
|
47
|
+
</section>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
50
|
|
|
51
51
|
export default ErrorPage;
|
package/src/Tag.tsx
CHANGED
|
@@ -45,7 +45,7 @@ const Tag: FC<Props> = ({
|
|
|
45
45
|
title,
|
|
46
46
|
onClick,
|
|
47
47
|
onRemove,
|
|
48
|
-
children
|
|
48
|
+
children,
|
|
49
49
|
}) => {
|
|
50
50
|
const [t] = useTranslation("commons");
|
|
51
51
|
|
|
@@ -53,7 +53,7 @@ const Tag: FC<Props> = ({
|
|
|
53
53
|
if (icon) {
|
|
54
54
|
showIcon = (
|
|
55
55
|
<>
|
|
56
|
-
<i className={classNames("fas", `fa-${icon}`)} />
|
|
56
|
+
<i className={classNames("fas", `fa-${icon}`)} aria-hidden="true" />
|
|
57
57
|
|
|
58
58
|
</>
|
|
59
59
|
);
|
|
@@ -65,26 +65,44 @@ const Tag: FC<Props> = ({
|
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
67
|
<>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
{onClick === undefined ? (
|
|
69
|
+
<span
|
|
70
|
+
className={classNames(
|
|
71
|
+
"tag",
|
|
72
|
+
`is-${color}`,
|
|
73
|
+
`is-${size}`,
|
|
74
|
+
className,
|
|
75
|
+
{
|
|
76
|
+
"is-outlined": outlined,
|
|
77
|
+
"is-rounded": rounded,
|
|
78
|
+
},
|
|
79
|
+
size === "small" && smallClassNames
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
{showIcon}
|
|
83
|
+
{label}
|
|
84
|
+
{children}
|
|
85
|
+
</span>
|
|
86
|
+
) : (
|
|
87
|
+
<button
|
|
88
|
+
className={classNames(
|
|
89
|
+
"tag",
|
|
90
|
+
`is-${color}`,
|
|
91
|
+
`is-${size}`,
|
|
92
|
+
className,
|
|
93
|
+
{
|
|
94
|
+
"is-outlined": outlined,
|
|
95
|
+
"is-rounded": rounded,
|
|
96
|
+
},
|
|
97
|
+
size === "small" && smallClassNames
|
|
98
|
+
)}
|
|
99
|
+
onClick={onClick}
|
|
100
|
+
>
|
|
101
|
+
{showIcon}
|
|
102
|
+
{label}
|
|
103
|
+
{children}
|
|
104
|
+
</button>
|
|
105
|
+
)}
|
|
88
106
|
{showDelete}
|
|
89
107
|
</>
|
|
90
108
|
);
|