@scm-manager/ui-components 3.10.2-20250802-115107 → 3.10.2
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-components",
|
|
3
|
-
"version": "3.10.2
|
|
3
|
+
"version": "3.10.2",
|
|
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.10.2
|
|
36
|
-
"@scm-manager/ui-types": "3.10.2
|
|
35
|
+
"@scm-manager/ui-tests": "3.10.2",
|
|
36
|
+
"@scm-manager/ui-types": "3.10.2",
|
|
37
37
|
"@types/fetch-mock": "^7.3.1",
|
|
38
38
|
"@types/react-select": "^2.0.19",
|
|
39
39
|
"@types/unist": "^2.0.3",
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
"@scm-manager/jest-preset": "^2.14.1",
|
|
69
69
|
"@scm-manager/prettier-config": "^2.12.0",
|
|
70
70
|
"@scm-manager/tsconfig": "^2.13.0",
|
|
71
|
-
"@scm-manager/ui-syntaxhighlighting": "3.10.2
|
|
72
|
-
"@scm-manager/ui-shortcuts": "3.10.2
|
|
73
|
-
"@scm-manager/ui-text": "3.10.2
|
|
71
|
+
"@scm-manager/ui-syntaxhighlighting": "3.10.2",
|
|
72
|
+
"@scm-manager/ui-shortcuts": "3.10.2",
|
|
73
|
+
"@scm-manager/ui-text": "3.10.2"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@scm-manager/ui-core": "3.10.2
|
|
77
|
-
"@scm-manager/ui-overlays": "3.10.2
|
|
78
|
-
"@scm-manager/ui-layout": "3.10.2
|
|
79
|
-
"@scm-manager/ui-buttons": "3.10.2
|
|
80
|
-
"@scm-manager/ui-api": "3.10.2
|
|
81
|
-
"@scm-manager/ui-extensions": "3.10.2
|
|
76
|
+
"@scm-manager/ui-core": "3.10.2",
|
|
77
|
+
"@scm-manager/ui-overlays": "3.10.2",
|
|
78
|
+
"@scm-manager/ui-layout": "3.10.2",
|
|
79
|
+
"@scm-manager/ui-buttons": "3.10.2",
|
|
80
|
+
"@scm-manager/ui-api": "3.10.2",
|
|
81
|
+
"@scm-manager/ui-extensions": "3.10.2",
|
|
82
82
|
"deepmerge": "^4.2.2",
|
|
83
83
|
"hast-util-sanitize": "^3.0.2",
|
|
84
84
|
"react-diff-view": "^2.4.10",
|
|
@@ -20389,7 +20389,7 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `
|
|
|
20389
20389
|
className="media-left mt-2 mr-2"
|
|
20390
20390
|
>
|
|
20391
20391
|
<div
|
|
20392
|
-
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0
|
|
20392
|
+
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0 gwbxYG image"
|
|
20393
20393
|
>
|
|
20394
20394
|
<img
|
|
20395
20395
|
alt="SCM Administrator"
|
|
@@ -20448,6 +20448,7 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `
|
|
|
20448
20448
|
<img
|
|
20449
20449
|
alt="Ford Prefect"
|
|
20450
20450
|
className="ContributorAvatar-sc-1yz8zn-0 lhgGHS"
|
|
20451
|
+
crossOrigin="anonymous"
|
|
20451
20452
|
src="https://robohash.org/ford.prefect@hitchhiker.com"
|
|
20452
20453
|
/>
|
|
20453
20454
|
</a>
|
|
@@ -20458,6 +20459,7 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `
|
|
|
20458
20459
|
<img
|
|
20459
20460
|
alt="Zaphod Beeblebrox"
|
|
20460
20461
|
className="ContributorAvatar-sc-1yz8zn-0 lhgGHS"
|
|
20462
|
+
crossOrigin="anonymous"
|
|
20461
20463
|
src="https://robohash.org/zaphod.beeblebrox@hitchhiker.cm"
|
|
20462
20464
|
/>
|
|
20463
20465
|
</a>
|
|
@@ -20468,6 +20470,7 @@ exports[`Storyshots Repositories/Changesets Co-Authors with avatar 1`] = `
|
|
|
20468
20470
|
<img
|
|
20469
20471
|
alt="Tricia Marie McMillan"
|
|
20470
20472
|
className="ContributorAvatar-sc-1yz8zn-0 lhgGHS"
|
|
20473
|
+
crossOrigin="anonymous"
|
|
20471
20474
|
src="https://robohash.org/trillian@hitchhiker.cm"
|
|
20472
20475
|
/>
|
|
20473
20476
|
</a>
|
|
@@ -20564,7 +20567,7 @@ exports[`Storyshots Repositories/Changesets Commiter and Co-Authors with avatar
|
|
|
20564
20567
|
className="media-left mt-2 mr-2"
|
|
20565
20568
|
>
|
|
20566
20569
|
<div
|
|
20567
|
-
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0
|
|
20570
|
+
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0 gwbxYG image"
|
|
20568
20571
|
>
|
|
20569
20572
|
<img
|
|
20570
20573
|
alt="SCM Administrator"
|
|
@@ -20618,6 +20621,7 @@ exports[`Storyshots Repositories/Changesets Commiter and Co-Authors with avatar
|
|
|
20618
20621
|
<img
|
|
20619
20622
|
alt="Zaphod Beeblebrox"
|
|
20620
20623
|
className="ContributorAvatar-sc-1yz8zn-0 lhgGHS"
|
|
20624
|
+
crossOrigin="anonymous"
|
|
20621
20625
|
src="https://robohash.org/zaphod.beeblebrox@hitchhiker.cm"
|
|
20622
20626
|
/>
|
|
20623
20627
|
</a>
|
|
@@ -20633,6 +20637,7 @@ exports[`Storyshots Repositories/Changesets Commiter and Co-Authors with avatar
|
|
|
20633
20637
|
<img
|
|
20634
20638
|
alt="Ford Prefect"
|
|
20635
20639
|
className="ContributorAvatar-sc-1yz8zn-0 lhgGHS"
|
|
20640
|
+
crossOrigin="anonymous"
|
|
20636
20641
|
src="https://robohash.org/ford.prefect@hitchhiker.com"
|
|
20637
20642
|
/>
|
|
20638
20643
|
</a>
|
|
@@ -21637,7 +21642,7 @@ exports[`Storyshots Repositories/Changesets With avatar 1`] = `
|
|
|
21637
21642
|
className="media-left mt-2 mr-2"
|
|
21638
21643
|
>
|
|
21639
21644
|
<div
|
|
21640
|
-
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0
|
|
21645
|
+
className="SingleChangeset__FixedSizedAvatar-sc-ytpqp9-0 gwbxYG image"
|
|
21641
21646
|
>
|
|
21642
21647
|
<img
|
|
21643
21648
|
alt="SCM Administrator"
|
package/src/repos/DiffTypes.ts
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { ReactNode } from "react";
|
|
18
18
|
import { DefaultCollapsed } from "./defaultCollapsed";
|
|
19
|
-
import { Change, Hunk, FileDiff as File
|
|
19
|
+
import { Change, Hunk, FileDiff as File } from "@scm-manager/ui-types";
|
|
20
20
|
|
|
21
21
|
export type ChangeEvent = {
|
|
22
22
|
change: Change;
|
|
@@ -31,18 +31,6 @@ export type AnnotationFactoryContext = BaseContext;
|
|
|
31
31
|
|
|
32
32
|
export type FileAnnotationFactory = (file: File) => ReactNode[];
|
|
33
33
|
|
|
34
|
-
export type FileTreeNodeWrapper = FC<{
|
|
35
|
-
name: string;
|
|
36
|
-
path: string;
|
|
37
|
-
changeType?: FileChangeType;
|
|
38
|
-
iconName: string;
|
|
39
|
-
iconColor: string;
|
|
40
|
-
isFile: boolean;
|
|
41
|
-
originalIcon: ReactNode;
|
|
42
|
-
originalLabel: ReactNode;
|
|
43
|
-
isCurrentFile: boolean;
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
34
|
// key = change id, value = react component
|
|
47
35
|
export type AnnotationFactory = (context: AnnotationFactoryContext) => {
|
|
48
36
|
[key: string]: any;
|
|
@@ -57,11 +57,11 @@ const ContributorWithAvatar: FC<PersonAvatarProps> = ({ person, avatar }) => {
|
|
|
57
57
|
if (person.mail) {
|
|
58
58
|
return (
|
|
59
59
|
<a href={"mailto:" + person.mail} title={t("changeset.contributors.mailto") + " " + person.mail}>
|
|
60
|
-
<ContributorAvatar src={avatar} alt={person.name} />
|
|
60
|
+
<ContributorAvatar src={avatar} alt={person.name} crossOrigin="anonymous" />
|
|
61
61
|
</a>
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
return <ContributorAvatar src={avatar} alt={person.name} title={person.name} />;
|
|
64
|
+
return <ContributorAvatar src={avatar} alt={person.name} title={person.name} crossOrigin="anonymous" />;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export const SingleContributor: FC<PersonProps> = ({ person, className, displayTextOnly }) => {
|
|
@@ -18,19 +18,12 @@ import React, { FC } from "react";
|
|
|
18
18
|
import { Link } from "react-router-dom";
|
|
19
19
|
import { useTranslation } from "react-i18next";
|
|
20
20
|
import classNames from "classnames";
|
|
21
|
-
import {
|
|
21
|
+
import { FileTree } from "@scm-manager/ui-types";
|
|
22
22
|
import { FileDiffContent, StackedSpan, StyledIcon } from "./styledElements";
|
|
23
|
-
import { FileTreeNodeWrapper } from "../DiffTypes";
|
|
24
23
|
|
|
25
|
-
type Props = {
|
|
26
|
-
tree: FileTree;
|
|
27
|
-
currentFile: string;
|
|
28
|
-
setCurrentFile: (path: string) => void;
|
|
29
|
-
gap?: number;
|
|
30
|
-
FileTreeNodeWrapper?: FileTreeNodeWrapper;
|
|
31
|
-
};
|
|
24
|
+
type Props = { tree: FileTree; currentFile: string; setCurrentFile: (path: string) => void; gap?: number };
|
|
32
25
|
|
|
33
|
-
const DiffFileTree: FC<Props> = ({ tree, currentFile, setCurrentFile, gap = 15
|
|
26
|
+
const DiffFileTree: FC<Props> = ({ tree, currentFile, setCurrentFile, gap = 15 }) => {
|
|
34
27
|
return (
|
|
35
28
|
<FileDiffContent gap={gap}>
|
|
36
29
|
{Object.keys(tree.children).map((key) => (
|
|
@@ -40,7 +33,6 @@ const DiffFileTree: FC<Props> = ({ tree, currentFile, setCurrentFile, gap = 15,
|
|
|
40
33
|
parentPath=""
|
|
41
34
|
currentFile={currentFile}
|
|
42
35
|
setCurrentFile={setCurrentFile}
|
|
43
|
-
FileTreeNodeWrapper={FileTreeNodeWrapper}
|
|
44
36
|
/>
|
|
45
37
|
))}
|
|
46
38
|
</FileDiffContent>
|
|
@@ -49,13 +41,9 @@ const DiffFileTree: FC<Props> = ({ tree, currentFile, setCurrentFile, gap = 15,
|
|
|
49
41
|
|
|
50
42
|
export default DiffFileTree;
|
|
51
43
|
|
|
52
|
-
type
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
currentFile: string;
|
|
56
|
-
setCurrentFile: (path: string) => void;
|
|
57
|
-
FileTreeNodeWrapper?: FileTreeNodeWrapper;
|
|
58
|
-
};
|
|
44
|
+
type ChangeType = "add" | "modify" | "delete" | "rename" | "copy";
|
|
45
|
+
|
|
46
|
+
type NodeProps = { node: FileTree; parentPath: string; currentFile: string; setCurrentFile: (path: string) => void };
|
|
59
47
|
|
|
60
48
|
const addPath = (parentPath: string, path: string) => {
|
|
61
49
|
if ("" === parentPath) {
|
|
@@ -64,31 +52,16 @@ const addPath = (parentPath: string, path: string) => {
|
|
|
64
52
|
return parentPath + "/" + path;
|
|
65
53
|
};
|
|
66
54
|
|
|
67
|
-
const TreeNode: FC<NodeProps> = ({ node, parentPath, currentFile, setCurrentFile
|
|
55
|
+
const TreeNode: FC<NodeProps> = ({ node, parentPath, currentFile, setCurrentFile }) => {
|
|
68
56
|
const [t] = useTranslation("repos");
|
|
69
57
|
|
|
70
|
-
FileTreeNodeWrapper = FileTreeNodeWrapper || (({ children }) => <>{children}</>);
|
|
71
|
-
|
|
72
|
-
const label = <div className="ml-1">{node.nodeName}</div>;
|
|
73
|
-
const icon = <StyledIcon alt={t("diff.showContent")}>folder</StyledIcon>;
|
|
74
58
|
return (
|
|
75
59
|
<li>
|
|
76
60
|
{Object.keys(node.children).length > 0 ? (
|
|
77
61
|
<ul className="py-1 pl-3">
|
|
78
62
|
<li className="is-flex has-text-grey">
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
isFile={false}
|
|
82
|
-
isCurrentFile={false}
|
|
83
|
-
name={node.nodeName}
|
|
84
|
-
iconName={"folder"}
|
|
85
|
-
iconColor={"grey"}
|
|
86
|
-
originalIcon={icon}
|
|
87
|
-
originalLabel={label}
|
|
88
|
-
>
|
|
89
|
-
{icon}
|
|
90
|
-
{label}
|
|
91
|
-
</FileTreeNodeWrapper>
|
|
63
|
+
<StyledIcon alt={t("diff.showContent")}>folder</StyledIcon>
|
|
64
|
+
<div className="ml-1">{node.nodeName}</div>
|
|
92
65
|
</li>
|
|
93
66
|
{Object.keys(node.children).map((key) => (
|
|
94
67
|
<TreeNode
|
|
@@ -97,25 +70,23 @@ const TreeNode: FC<NodeProps> = ({ node, parentPath, currentFile, setCurrentFile
|
|
|
97
70
|
parentPath={addPath(parentPath, node.nodeName)}
|
|
98
71
|
currentFile={currentFile}
|
|
99
72
|
setCurrentFile={setCurrentFile}
|
|
100
|
-
FileTreeNodeWrapper={FileTreeNodeWrapper}
|
|
101
73
|
/>
|
|
102
74
|
))}
|
|
103
75
|
</ul>
|
|
104
76
|
) : (
|
|
105
77
|
<TreeFile
|
|
106
|
-
changeType={node.changeType.toLowerCase() as
|
|
78
|
+
changeType={node.changeType.toLowerCase() as ChangeType}
|
|
107
79
|
path={node.nodeName}
|
|
108
80
|
parentPath={parentPath}
|
|
109
81
|
currentFile={currentFile}
|
|
110
82
|
setCurrentFile={setCurrentFile}
|
|
111
|
-
FileTreeNodeWrapper={FileTreeNodeWrapper}
|
|
112
83
|
/>
|
|
113
84
|
)}
|
|
114
85
|
</li>
|
|
115
86
|
);
|
|
116
87
|
};
|
|
117
88
|
|
|
118
|
-
const getColor = (changeType:
|
|
89
|
+
const getColor = (changeType: ChangeType) => {
|
|
119
90
|
switch (changeType) {
|
|
120
91
|
case "add":
|
|
121
92
|
return "success";
|
|
@@ -128,7 +99,7 @@ const getColor = (changeType: FileChangeType) => {
|
|
|
128
99
|
}
|
|
129
100
|
};
|
|
130
101
|
|
|
131
|
-
const getIcon = (changeType:
|
|
102
|
+
const getIcon = (changeType: ChangeType) => {
|
|
132
103
|
switch (changeType) {
|
|
133
104
|
case "add":
|
|
134
105
|
case "copy":
|
|
@@ -142,22 +113,14 @@ const getIcon = (changeType: FileChangeType) => {
|
|
|
142
113
|
};
|
|
143
114
|
|
|
144
115
|
type FileProps = {
|
|
145
|
-
changeType:
|
|
116
|
+
changeType: ChangeType;
|
|
146
117
|
path: string;
|
|
147
118
|
parentPath: string;
|
|
148
119
|
currentFile: string;
|
|
149
120
|
setCurrentFile: (path: string) => void;
|
|
150
|
-
FileTreeNodeWrapper: FileTreeNodeWrapper;
|
|
151
121
|
};
|
|
152
122
|
|
|
153
|
-
const TreeFile: FC<FileProps> = ({
|
|
154
|
-
changeType,
|
|
155
|
-
path,
|
|
156
|
-
parentPath,
|
|
157
|
-
currentFile,
|
|
158
|
-
setCurrentFile,
|
|
159
|
-
FileTreeNodeWrapper,
|
|
160
|
-
}) => {
|
|
123
|
+
const TreeFile: FC<FileProps> = ({ changeType, path, parentPath, currentFile, setCurrentFile }) => {
|
|
161
124
|
const [t] = useTranslation("repos");
|
|
162
125
|
const completePath = addPath(parentPath, path);
|
|
163
126
|
|
|
@@ -165,50 +128,35 @@ const TreeFile: FC<FileProps> = ({
|
|
|
165
128
|
return currentFile === completePath;
|
|
166
129
|
};
|
|
167
130
|
|
|
168
|
-
const iconName = getIcon(changeType);
|
|
169
|
-
|
|
170
|
-
const icon = (
|
|
171
|
-
<StackedSpan className="fa-stack">
|
|
172
|
-
<StyledIcon
|
|
173
|
-
className={classNames("fa-stack-2x", `has-text-${getColor(changeType)}`)}
|
|
174
|
-
key={completePath + "file"}
|
|
175
|
-
type="fas"
|
|
176
|
-
alt={t("diff.showContent")}
|
|
177
|
-
>
|
|
178
|
-
file
|
|
179
|
-
</StyledIcon>
|
|
180
|
-
<StyledIcon
|
|
181
|
-
className={classNames("fa-stack-1x", "is-relative", "has-text-secondary-least")}
|
|
182
|
-
isSmaller={iconName === "circle"}
|
|
183
|
-
key={changeType}
|
|
184
|
-
alt={t(`diff.changes.${changeType}`)}
|
|
185
|
-
>
|
|
186
|
-
{iconName}
|
|
187
|
-
</StyledIcon>
|
|
188
|
-
</StackedSpan>
|
|
189
|
-
);
|
|
190
|
-
const label = <div className={classNames("ml-1", isCurrentFile() ? "has-text-weight-bold" : "")}>{path}</div>;
|
|
191
|
-
|
|
192
131
|
return (
|
|
193
132
|
<Link
|
|
194
133
|
className="is-flex py-1 pl-3 has-cursor-pointer"
|
|
195
134
|
onClick={() => setCurrentFile(completePath)}
|
|
196
135
|
to={`#diff-${encodeURIComponent(completePath)}`}
|
|
197
136
|
>
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
137
|
+
<StackedSpan className="fa-stack">
|
|
138
|
+
<StyledIcon
|
|
139
|
+
className={classNames("fa-stack-2x", `has-text-${getColor(changeType)}`)}
|
|
140
|
+
key={completePath + "file"}
|
|
141
|
+
type={isCurrentFile() ? "fas" : "far"}
|
|
142
|
+
alt={t("diff.showContent")}
|
|
143
|
+
>
|
|
144
|
+
file
|
|
145
|
+
</StyledIcon>
|
|
146
|
+
<StyledIcon
|
|
147
|
+
className={classNames(
|
|
148
|
+
"fa-stack-1x",
|
|
149
|
+
"is-relative",
|
|
150
|
+
isCurrentFile() ? "has-text-secondary-least" : `has-text-${getColor(changeType)}`
|
|
151
|
+
)}
|
|
152
|
+
isSmaller={getIcon(changeType) === "circle"}
|
|
153
|
+
key={changeType}
|
|
154
|
+
alt={t(`diff.changes.${changeType}`)}
|
|
155
|
+
>
|
|
156
|
+
{getIcon(changeType)}
|
|
157
|
+
</StyledIcon>
|
|
158
|
+
</StackedSpan>
|
|
159
|
+
<div className="ml-1">{path}</div>
|
|
212
160
|
</Link>
|
|
213
161
|
);
|
|
214
162
|
};
|