@scm-manager/ui-components 4.0.0-REACT18-20250701-125025 → 4.0.0-REACT18-20250824-143504
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 +45 -50
- package/src/BranchSelector.stories.tsx +60 -11
- package/src/Breadcrumb.stories.tsx +131 -57
- package/src/Breadcrumb.tsx +3 -3
- package/src/CardColumn.stories.tsx +94 -27
- package/src/CardColumnSmall.stories.tsx +102 -27
- package/src/CommaSeparatedList.tsx +2 -2
- package/src/Date.stories.tsx +64 -17
- package/src/Duration.stories.tsx +92 -45
- package/src/ErrorBoundary.tsx +38 -58
- package/src/ErrorNotification.tsx +1 -1
- package/src/Help.stories.tsx +61 -17
- package/src/Help.tsx +5 -11
- package/src/Icon.stories.tsx +93 -13
- package/src/LinkPaginator.tsx +9 -6
- package/src/Loading.stories.tsx +26 -6
- package/src/Logo.stories.tsx +44 -13
- package/src/Notification.stories.tsx +111 -23
- package/src/OverviewPageActions.tsx +5 -5
- package/src/Paginator.test.tsx +115 -94
- package/src/PdfViewer.stories.tsx +83 -5
- package/src/PreformattedCodeBlock.stories.tsx +97 -26
- package/src/ProtectedRoute.tsx +14 -39
- package/src/SmallLoadingSpinner.stories.tsx +26 -6
- package/src/SyntaxHighlighter.stories.tsx +122 -40
- package/src/SyntaxHighlighterRenderer.tsx +7 -7
- package/src/Tag.stories.tsx +135 -18
- package/src/Tag.tsx +2 -1
- package/src/Tooltip.stories.tsx +147 -34
- package/src/__snapshots__/storyshots.test.ts.snap +6 -112
- package/src/avatar/Avatar.ts +1 -1
- package/src/avatar/AvatarImage.tsx +1 -1
- package/src/avatar/AvatarWrapper.tsx +2 -2
- package/src/buttons/Button.stories.tsx +159 -0
- package/src/buttons/Button.tsx +5 -5
- package/src/config/ConfigurationBinder.tsx +39 -39
- package/src/config/ConfigurationForm.tsx +2 -1
- package/src/config/TitledSettings.tsx +4 -1
- package/src/forms/AddKeyValueEntryToTableField.stories.tsx +60 -25
- package/src/forms/Checkbox.stories.tsx +165 -27
- package/src/forms/Checkbox.tsx +1 -0
- package/src/forms/DropDown.stories.tsx +81 -35
- package/src/forms/FileInput.stories.tsx +85 -10
- package/src/forms/InputField.stories.tsx +210 -37
- package/src/forms/InputField.tsx +1 -0
- package/src/forms/Radio.stories.tsx +181 -34
- package/src/forms/Radio.tsx +1 -0
- package/src/forms/Select.stories.tsx +266 -46
- package/src/forms/Select.tsx +1 -0
- package/src/forms/Textarea.stories.tsx +99 -53
- package/src/forms/Textarea.tsx +1 -0
- package/src/forms/index.ts +3 -1
- package/src/index.ts +5 -5
- package/src/jest-dom.d.ts +17 -0
- package/src/layout/Footer.stories.tsx +114 -22
- package/src/layout/FooterSection.tsx +1 -0
- package/src/layout/Header.tsx +2 -1
- package/src/layout/Page.tsx +1 -3
- package/src/layout/PrimaryContentColumn.tsx +2 -2
- package/src/layout/SecondaryNavigationColumn.tsx +3 -3
- package/src/layout/SubSubtitle.tsx +2 -1
- package/src/layout/Subtitle.tsx +2 -1
- package/src/layout/Title.tsx +2 -5
- package/src/markdown/LazyMarkdownView.tsx +16 -5
- package/src/markdown/MarkdownHeadingRenderer.test.ts +9 -1
- package/src/markdown/MarkdownHeadingRenderer.tsx +3 -3
- package/src/markdown/MarkdownImageRenderer.test.ts +8 -1
- package/src/markdown/MarkdownImageRenderer.tsx +2 -1
- package/src/markdown/MarkdownLinkRenderer.test.tsx +9 -0
- package/src/markdown/MarkdownLinkRenderer.tsx +6 -4
- package/src/markdown/MarkdownView.stories.tsx +224 -72
- package/src/markdown/markdownExtensions.ts +6 -4
- package/src/modals/ConfirmAlert.stories.tsx +133 -44
- package/src/modals/ConfirmAlert.tsx +5 -4
- package/src/modals/Modal.stories.tsx +461 -252
- package/src/modals/Modal.tsx +12 -11
- package/src/modals/useRegisterModal.test.tsx +5 -4
- package/src/navigation/MenuContext.tsx +2 -2
- package/src/navigation/NavLink.tsx +4 -7
- package/src/navigation/PrimaryNavigation.tsx +2 -2
- package/src/navigation/PrimaryNavigationLink.tsx +6 -5
- package/src/navigation/RoutingProps.ts +1 -3
- package/src/navigation/SecondaryNavigation.stories.tsx +157 -45
- package/src/navigation/SecondaryNavigation.tsx +17 -16
- package/src/navigation/SecondaryNavigationItem.tsx +2 -1
- package/src/navigation/SubNavigation.tsx +4 -8
- package/src/navigation/useActiveMatch.ts +20 -22
- package/src/navigation/useNavigationLock.ts +1 -0
- package/src/popover/Popover.stories.tsx +111 -41
- package/src/popover/Popover.tsx +2 -5
- package/src/repos/Diff.stories.tsx +418 -223
- package/src/repos/Diff.tsx +1 -5
- package/src/repos/HunkExpandDivider.tsx +2 -2
- package/src/repos/LoadingDiff.tsx +11 -6
- package/src/repos/RepositoryEntry.stories.tsx +217 -53
- package/src/repos/RepositoryFlag.tsx +2 -1
- package/src/repos/TokenizedDiffView.tsx +4 -2
- package/src/repos/annotate/Annotate.stories.tsx +225 -111
- package/src/repos/annotate/AnnotateLine.tsx +2 -1
- package/src/repos/changesets/ChangesetAuthor.tsx +2 -2
- package/src/repos/changesets/ChangesetButtonGroup.test.tsx +9 -5
- package/src/repos/changesets/ChangesetDiff.test.ts +10 -2
- package/src/repos/changesets/Changesets.stories.tsx +388 -197
- package/src/repos/changesets/ContributorRow.tsx +2 -2
- package/src/repos/changesets/SignatureIcon.tsx +1 -0
- package/src/repos/diff/DiffFileTree.tsx +1 -1
- package/src/repos/diff/styledElements.tsx +4 -3
- package/src/repos/index.ts +15 -15
- package/src/search/Hit.tsx +3 -2
- package/src/search/TextHitField.stories.tsx +131 -43
- package/src/search/TextHitField.tsx +3 -2
- package/src/search/index.ts +1 -1
- package/src/storyshots.test.ts +66 -60
- package/src/table/Table.stories.tsx +146 -48
- package/src/table/Table.tsx +7 -8
- package/src/table/TextColumn.tsx +0 -9
- package/src/toast/Toast.tsx +2 -1
- package/src/toast/ToastArea.tsx +2 -2
- package/src/toast/ToastButton.tsx +2 -1
- package/src/toast/ToastButtons.tsx +4 -2
- package/src/toast/ToastNotification.tsx +2 -1
- package/src/toast/index.stories.tsx +144 -39
- package/src/toast/index.ts +1 -1
- package/src/buttons/index.stories.tsx +0 -85
|
@@ -14,29 +14,304 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { storiesOf } from "@storybook/react";
|
|
18
|
-
import * as React from "react";
|
|
17
|
+
// import { storiesOf } from "@storybook/react";
|
|
18
|
+
// import * as React from "react";
|
|
19
|
+
// import styled from "styled-components";
|
|
20
|
+
// import { MemoryRouter } from "react-router-dom";
|
|
21
|
+
// import repository from "../../__resources__/repository";
|
|
22
|
+
// import ChangesetRow from "./ChangesetRow";
|
|
23
|
+
// import { five, four, one, three, two } from "../../__resources__/changesets";
|
|
24
|
+
// import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
25
|
+
// // @ts-ignore
|
|
26
|
+
// import hitchhiker from "../../__resources__/hitchhiker.png";
|
|
27
|
+
// import { Person } from "../../avatar/Avatar";
|
|
28
|
+
// import { Changeset } from "@scm-manager/ui-types";
|
|
29
|
+
// import { Replacement } from "@scm-manager/ui-text";
|
|
30
|
+
// import ChangesetList from "./ChangesetList";
|
|
31
|
+
// import { ShortcutDocsContextProvider } from "@scm-manager/ui-shortcuts";
|
|
32
|
+
//
|
|
33
|
+
// const Wrapper = styled.div`
|
|
34
|
+
// margin: 25rem 4rem;
|
|
35
|
+
// `;
|
|
36
|
+
//
|
|
37
|
+
// const robohash = (person: Person) => {
|
|
38
|
+
// return `https://robohash.org/${person.mail}`;
|
|
39
|
+
// };
|
|
40
|
+
//
|
|
41
|
+
// const withAvatarFactory = (factory: (person: Person) => string, changeset: Changeset) => {
|
|
42
|
+
// const binder = new Binder("changeset stories");
|
|
43
|
+
// binder.bind("avatar.factory", factory);
|
|
44
|
+
// return (
|
|
45
|
+
// <BinderContext.Provider value={binder}>
|
|
46
|
+
// <ChangesetRow repository={repository} changeset={changeset} />
|
|
47
|
+
// </BinderContext.Provider>
|
|
48
|
+
// );
|
|
49
|
+
// };
|
|
50
|
+
//
|
|
51
|
+
// const withReplacements = (
|
|
52
|
+
// replacements: ((changeset: Changeset, value: string) => Replacement[])[],
|
|
53
|
+
// changeset: Changeset
|
|
54
|
+
// ) => {
|
|
55
|
+
// const binder = new Binder("changeset stories");
|
|
56
|
+
// replacements.forEach((replacement) => binder.bind("changeset.description.tokens", replacement));
|
|
57
|
+
// return (
|
|
58
|
+
// <BinderContext.Provider value={binder}>
|
|
59
|
+
// <ChangesetRow repository={repository} changeset={changeset} />
|
|
60
|
+
// </BinderContext.Provider>
|
|
61
|
+
// );
|
|
62
|
+
// };
|
|
63
|
+
//
|
|
64
|
+
// function copy<T>(input: T): T {
|
|
65
|
+
// return JSON.parse(JSON.stringify(input));
|
|
66
|
+
// }
|
|
67
|
+
//
|
|
68
|
+
// storiesOf("Repositories/Changesets", module)
|
|
69
|
+
// .addDecorator((story) => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
|
|
70
|
+
// .addDecorator((storyFn) => <Wrapper className="box box-link-shadow">{storyFn()}</Wrapper>)
|
|
71
|
+
// .add("Default", () => <ChangesetRow repository={repository} changeset={three} />)
|
|
72
|
+
// .add("With Committer", () => <ChangesetRow repository={repository} changeset={two} />)
|
|
73
|
+
// .add("With Committer and Co-Author", () => <ChangesetRow repository={repository} changeset={one} />)
|
|
74
|
+
// .add("With multiple Co-Authors", () => <ChangesetRow repository={repository} changeset={four} />)
|
|
75
|
+
// .add("With avatar", () => {
|
|
76
|
+
// return withAvatarFactory(() => hitchhiker, three);
|
|
77
|
+
// })
|
|
78
|
+
// .add("Commiter and Co-Authors with avatar", () => {
|
|
79
|
+
// return withAvatarFactory(robohash, one);
|
|
80
|
+
// })
|
|
81
|
+
// .add("Co-Authors with avatar", () => {
|
|
82
|
+
// return withAvatarFactory(robohash, four);
|
|
83
|
+
// })
|
|
84
|
+
// .add("Replacements", () => {
|
|
85
|
+
// const link = <a href={"http://example.com/hog"}>HOG-42</a>;
|
|
86
|
+
// const mail = <a href={"mailto:hog@example.com"}>Arthur</a>;
|
|
87
|
+
// return withReplacements(
|
|
88
|
+
// [
|
|
89
|
+
// () => [{ textToReplace: "HOG-42", replacement: link }],
|
|
90
|
+
// () => [{ textToReplace: "arthur@guide.galaxy", replacement: mail }],
|
|
91
|
+
// ],
|
|
92
|
+
// five
|
|
93
|
+
// );
|
|
94
|
+
// })
|
|
95
|
+
// .add("With unknown signature", () => {
|
|
96
|
+
// const changeset = copy(three);
|
|
97
|
+
// changeset.signatures = [
|
|
98
|
+
// {
|
|
99
|
+
// keyId: "0x247E908C6FD35473",
|
|
100
|
+
// type: "gpg",
|
|
101
|
+
// status: "NOT_FOUND",
|
|
102
|
+
// },
|
|
103
|
+
// ];
|
|
104
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
105
|
+
// })
|
|
106
|
+
// .add("With valid signature", () => {
|
|
107
|
+
// const changeset = copy(three);
|
|
108
|
+
// changeset.signatures = [
|
|
109
|
+
// {
|
|
110
|
+
// keyId: "0x247E908C6FD35473",
|
|
111
|
+
// type: "gpg",
|
|
112
|
+
// status: "VERIFIED",
|
|
113
|
+
// owner: "trillian",
|
|
114
|
+
// contacts: [
|
|
115
|
+
// {
|
|
116
|
+
// name: "Tricia Marie McMilla",
|
|
117
|
+
// mail: "trillian@hitchhiker.com",
|
|
118
|
+
// },
|
|
119
|
+
// ],
|
|
120
|
+
// },
|
|
121
|
+
// ];
|
|
122
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
123
|
+
// })
|
|
124
|
+
// .add("With unowned signature", () => {
|
|
125
|
+
// const changeset = copy(three);
|
|
126
|
+
// changeset.signatures = [
|
|
127
|
+
// {
|
|
128
|
+
// keyId: "0x247E908C6FD35473",
|
|
129
|
+
// type: "gpg",
|
|
130
|
+
// status: "VERIFIED",
|
|
131
|
+
// contacts: [
|
|
132
|
+
// {
|
|
133
|
+
// name: "Tricia Marie McMilla",
|
|
134
|
+
// mail: "trillian@hitchhiker.com",
|
|
135
|
+
// },
|
|
136
|
+
// ],
|
|
137
|
+
// },
|
|
138
|
+
// ];
|
|
139
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
140
|
+
// })
|
|
141
|
+
// .add("With contactless signature", () => {
|
|
142
|
+
// const changeset = copy(three);
|
|
143
|
+
// changeset.signatures = [
|
|
144
|
+
// {
|
|
145
|
+
// keyId: "0x247E908C6FD35473",
|
|
146
|
+
// type: "gpg",
|
|
147
|
+
// status: "VERIFIED",
|
|
148
|
+
// owner: "trillian",
|
|
149
|
+
// },
|
|
150
|
+
// ];
|
|
151
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
152
|
+
// })
|
|
153
|
+
// .add("With invalid signature", () => {
|
|
154
|
+
// const changeset = copy(three);
|
|
155
|
+
// changeset.signatures = [
|
|
156
|
+
// {
|
|
157
|
+
// keyId: "0x247E908C6FD35473",
|
|
158
|
+
// type: "gpg",
|
|
159
|
+
// status: "INVALID",
|
|
160
|
+
// owner: "trillian",
|
|
161
|
+
// contacts: [
|
|
162
|
+
// {
|
|
163
|
+
// name: "Tricia Marie McMilla",
|
|
164
|
+
// mail: "trillian@hitchhiker.com",
|
|
165
|
+
// },
|
|
166
|
+
// ],
|
|
167
|
+
// },
|
|
168
|
+
// ];
|
|
169
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
170
|
+
// })
|
|
171
|
+
// .add("With multiple signatures and invalid status", () => {
|
|
172
|
+
// const changeset = copy(three);
|
|
173
|
+
// changeset.signatures = [
|
|
174
|
+
// {
|
|
175
|
+
// keyId: "0x912389FJIQW8W223",
|
|
176
|
+
// type: "gpg",
|
|
177
|
+
// status: "INVALID",
|
|
178
|
+
// owner: "trillian",
|
|
179
|
+
// contacts: [
|
|
180
|
+
// {
|
|
181
|
+
// name: "Tricia Marie McMilla",
|
|
182
|
+
// mail: "trillian@hitchhiker.com",
|
|
183
|
+
// },
|
|
184
|
+
// ],
|
|
185
|
+
// },
|
|
186
|
+
// {
|
|
187
|
+
// keyId: "0x247E908C6FD35473",
|
|
188
|
+
// type: "gpg",
|
|
189
|
+
// status: "VERIFIED",
|
|
190
|
+
// owner: "trillian",
|
|
191
|
+
// contacts: [
|
|
192
|
+
// {
|
|
193
|
+
// name: "Tricia Marie McMilla",
|
|
194
|
+
// mail: "trillian@hitchhiker.com",
|
|
195
|
+
// },
|
|
196
|
+
// ],
|
|
197
|
+
// },
|
|
198
|
+
// {
|
|
199
|
+
// keyId: "0x9123891239VFIA33",
|
|
200
|
+
// type: "gpg",
|
|
201
|
+
// status: "NOT_FOUND",
|
|
202
|
+
// owner: "trillian",
|
|
203
|
+
// contacts: [
|
|
204
|
+
// {
|
|
205
|
+
// name: "Tricia Marie McMilla",
|
|
206
|
+
// mail: "trillian@hitchhiker.com",
|
|
207
|
+
// },
|
|
208
|
+
// ],
|
|
209
|
+
// },
|
|
210
|
+
// ];
|
|
211
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
212
|
+
// })
|
|
213
|
+
// .add("With multiple signatures and valid status", () => {
|
|
214
|
+
// const changeset = copy(three);
|
|
215
|
+
// changeset.signatures = [
|
|
216
|
+
// {
|
|
217
|
+
// keyId: "0x912389FJIQW8W223",
|
|
218
|
+
// type: "gpg",
|
|
219
|
+
// status: "NOT_FOUND",
|
|
220
|
+
// owner: "trillian",
|
|
221
|
+
// contacts: [
|
|
222
|
+
// {
|
|
223
|
+
// name: "Tricia Marie McMilla",
|
|
224
|
+
// mail: "trillian@hitchhiker.com",
|
|
225
|
+
// },
|
|
226
|
+
// ],
|
|
227
|
+
// },
|
|
228
|
+
// {
|
|
229
|
+
// keyId: "0x247E908C6FD35473",
|
|
230
|
+
// type: "gpg",
|
|
231
|
+
// status: "VERIFIED",
|
|
232
|
+
// owner: "trillian",
|
|
233
|
+
// contacts: [
|
|
234
|
+
// {
|
|
235
|
+
// name: "Tricia Marie McMilla",
|
|
236
|
+
// mail: "trillian@hitchhiker.com",
|
|
237
|
+
// },
|
|
238
|
+
// ],
|
|
239
|
+
// },
|
|
240
|
+
// {
|
|
241
|
+
// keyId: "0x9123891239VFIA33",
|
|
242
|
+
// type: "gpg",
|
|
243
|
+
// status: "NOT_FOUND",
|
|
244
|
+
// owner: "trillian",
|
|
245
|
+
// contacts: [
|
|
246
|
+
// {
|
|
247
|
+
// name: "Tricia Marie McMilla",
|
|
248
|
+
// mail: "trillian@hitchhiker.com",
|
|
249
|
+
// },
|
|
250
|
+
// ],
|
|
251
|
+
// },
|
|
252
|
+
// ];
|
|
253
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
254
|
+
// })
|
|
255
|
+
// .add("With multiple signatures and not found status", () => {
|
|
256
|
+
// const changeset = copy(three);
|
|
257
|
+
// changeset.signatures = [
|
|
258
|
+
// {
|
|
259
|
+
// keyId: "0x912389FJIQW8W223",
|
|
260
|
+
// type: "gpg",
|
|
261
|
+
// status: "NOT_FOUND",
|
|
262
|
+
// owner: "trillian",
|
|
263
|
+
// contacts: [
|
|
264
|
+
// {
|
|
265
|
+
// name: "Tricia Marie McMilla",
|
|
266
|
+
// mail: "trillian@hitchhiker.com",
|
|
267
|
+
// },
|
|
268
|
+
// ],
|
|
269
|
+
// },
|
|
270
|
+
// {
|
|
271
|
+
// keyId: "0x9123891239VFIA33",
|
|
272
|
+
// type: "gpg",
|
|
273
|
+
// status: "NOT_FOUND",
|
|
274
|
+
// owner: "trillian",
|
|
275
|
+
// contacts: [
|
|
276
|
+
// {
|
|
277
|
+
// name: "Tricia Marie McMilla",
|
|
278
|
+
// mail: "trillian@hitchhiker.com",
|
|
279
|
+
// },
|
|
280
|
+
// ],
|
|
281
|
+
// },
|
|
282
|
+
// ];
|
|
283
|
+
// return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
284
|
+
// })
|
|
285
|
+
// .add("List with navigation", () => (
|
|
286
|
+
// <ShortcutDocsContextProvider>
|
|
287
|
+
// <ChangesetList repository={repository} changesets={[copy(one), copy(two), copy(three)]} />
|
|
288
|
+
// </ShortcutDocsContextProvider>
|
|
289
|
+
// ));
|
|
290
|
+
|
|
291
|
+
import React from "react";
|
|
19
292
|
import styled from "styled-components";
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
293
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
294
|
+
import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
295
|
+
import { ShortcutDocsContextProvider } from "@scm-manager/ui-shortcuts";
|
|
296
|
+
import { Changeset } from "@scm-manager/ui-types";
|
|
297
|
+
import { Replacement } from "@scm-manager/ui-text";
|
|
298
|
+
|
|
22
299
|
import ChangesetRow from "./ChangesetRow";
|
|
300
|
+
import ChangesetList from "./ChangesetList";
|
|
301
|
+
import repository from "../../__resources__/repository";
|
|
23
302
|
import { five, four, one, three, two } from "../../__resources__/changesets";
|
|
24
|
-
import { Binder, BinderContext } from "@scm-manager/ui-extensions";
|
|
25
303
|
// @ts-ignore
|
|
26
304
|
import hitchhiker from "../../__resources__/hitchhiker.png";
|
|
27
305
|
import { Person } from "../../avatar/Avatar";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import { ShortcutDocsContextProvider } from "@scm-manager/ui-shortcuts";
|
|
306
|
+
import { MemoryRouter } from "react-router-dom";
|
|
307
|
+
|
|
308
|
+
// --- Helfer-Funktionen und Mock-Daten (aus der Original-Story übernommen) ---
|
|
32
309
|
|
|
33
310
|
const Wrapper = styled.div`
|
|
34
|
-
margin:
|
|
311
|
+
margin: 2rem 4rem;
|
|
35
312
|
`;
|
|
36
313
|
|
|
37
|
-
const robohash = (person: Person) => {
|
|
38
|
-
return `https://robohash.org/${person.mail}`;
|
|
39
|
-
};
|
|
314
|
+
const robohash = (person: Person) => `https://robohash.org/${person.mail}`;
|
|
40
315
|
|
|
41
316
|
const withAvatarFactory = (factory: (person: Person) => string, changeset: Changeset) => {
|
|
42
317
|
const binder = new Binder("changeset stories");
|
|
@@ -50,7 +325,7 @@ const withAvatarFactory = (factory: (person: Person) => string, changeset: Chang
|
|
|
50
325
|
|
|
51
326
|
const withReplacements = (
|
|
52
327
|
replacements: ((changeset: Changeset, value: string) => Replacement[])[],
|
|
53
|
-
changeset: Changeset
|
|
328
|
+
changeset: Changeset,
|
|
54
329
|
) => {
|
|
55
330
|
const binder = new Binder("changeset stories");
|
|
56
331
|
replacements.forEach((replacement) => binder.bind("changeset.description.tokens", replacement));
|
|
@@ -65,80 +340,79 @@ function copy<T>(input: T): T {
|
|
|
65
340
|
return JSON.parse(JSON.stringify(input));
|
|
66
341
|
}
|
|
67
342
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
343
|
+
// --- Storybook Metadaten ---
|
|
344
|
+
|
|
345
|
+
const meta: Meta<typeof ChangesetRow> = {
|
|
346
|
+
title: "Repositories/Changesets",
|
|
347
|
+
component: ChangesetRow,
|
|
348
|
+
decorators: [
|
|
349
|
+
(Story) => <MemoryRouter initialEntries={["/"]}>{Story()}</MemoryRouter>,
|
|
350
|
+
(Story) => <Wrapper className="box box-link-shadow">{Story()}</Wrapper>,
|
|
351
|
+
],
|
|
352
|
+
tags: ["autodocs"],
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export default meta;
|
|
356
|
+
|
|
357
|
+
// --- Story-Definitionen ---
|
|
358
|
+
|
|
359
|
+
type Story = StoryObj<typeof meta>;
|
|
360
|
+
|
|
361
|
+
// Einfache Stories mit `args`
|
|
362
|
+
export const Default: Story = {
|
|
363
|
+
args: { repository, changeset: three },
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export const WithCommitter: Story = {
|
|
367
|
+
args: { repository, changeset: two },
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export const WithCommitterAndCoAuthor: Story = {
|
|
371
|
+
args: { repository, changeset: one },
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export const WithMultipleCoAuthors: Story = {
|
|
375
|
+
args: { repository, changeset: four },
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
// Komplexe Stories mit `render`
|
|
379
|
+
export const WithAvatar: Story = {
|
|
380
|
+
render: () => withAvatarFactory(() => hitchhiker, three),
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export const CommitterAndCoAuthorsWithAvatar: Story = {
|
|
384
|
+
render: () => withAvatarFactory(robohash, one),
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export const CoAuthorsWithAvatar: Story = {
|
|
388
|
+
render: () => withAvatarFactory(robohash, four),
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const Replacements: Story = {
|
|
392
|
+
render: () => {
|
|
393
|
+
const link = <a href="http://example.com/hog">HOG-42</a>;
|
|
394
|
+
const mail = <a href="mailto:hog@example.com">Arthur</a>;
|
|
87
395
|
return withReplacements(
|
|
88
396
|
[
|
|
89
397
|
() => [{ textToReplace: "HOG-42", replacement: link }],
|
|
90
398
|
() => [{ textToReplace: "arthur@guide.galaxy", replacement: mail }],
|
|
91
399
|
],
|
|
92
|
-
five
|
|
400
|
+
five,
|
|
93
401
|
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
type: "gpg",
|
|
101
|
-
status: "NOT_FOUND",
|
|
102
|
-
},
|
|
103
|
-
];
|
|
104
|
-
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
105
|
-
})
|
|
106
|
-
.add("With valid signature", () => {
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// Stories für Signaturen
|
|
406
|
+
export const WithUnknownSignature: Story = {
|
|
407
|
+
render: () => {
|
|
107
408
|
const changeset = copy(three);
|
|
108
|
-
changeset.signatures = [
|
|
109
|
-
{
|
|
110
|
-
keyId: "0x247E908C6FD35473",
|
|
111
|
-
type: "gpg",
|
|
112
|
-
status: "VERIFIED",
|
|
113
|
-
owner: "trillian",
|
|
114
|
-
contacts: [
|
|
115
|
-
{
|
|
116
|
-
name: "Tricia Marie McMilla",
|
|
117
|
-
mail: "trillian@hitchhiker.com",
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
];
|
|
409
|
+
changeset.signatures = [{ keyId: "0x247E908C6FD35473", type: "gpg", status: "NOT_FOUND" }];
|
|
122
410
|
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
keyId: "0x247E908C6FD35473",
|
|
129
|
-
type: "gpg",
|
|
130
|
-
status: "VERIFIED",
|
|
131
|
-
contacts: [
|
|
132
|
-
{
|
|
133
|
-
name: "Tricia Marie McMilla",
|
|
134
|
-
mail: "trillian@hitchhiker.com",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
];
|
|
139
|
-
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
140
|
-
})
|
|
141
|
-
.add("With contactless signature", () => {
|
|
411
|
+
},
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
export const WithValidSignature: Story = {
|
|
415
|
+
render: () => {
|
|
142
416
|
const changeset = copy(three);
|
|
143
417
|
changeset.signatures = [
|
|
144
418
|
{
|
|
@@ -146,11 +420,15 @@ storiesOf("Repositories/Changesets", module)
|
|
|
146
420
|
type: "gpg",
|
|
147
421
|
status: "VERIFIED",
|
|
148
422
|
owner: "trillian",
|
|
423
|
+
contacts: [{ name: "Tricia Marie McMilla", mail: "trillian@hitchhiker.com" }],
|
|
149
424
|
},
|
|
150
425
|
];
|
|
151
426
|
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
152
|
-
}
|
|
153
|
-
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
export const WithInvalidSignature: Story = {
|
|
431
|
+
render: () => {
|
|
154
432
|
const changeset = copy(three);
|
|
155
433
|
changeset.signatures = [
|
|
156
434
|
{
|
|
@@ -158,132 +436,45 @@ storiesOf("Repositories/Changesets", module)
|
|
|
158
436
|
type: "gpg",
|
|
159
437
|
status: "INVALID",
|
|
160
438
|
owner: "trillian",
|
|
161
|
-
contacts: [
|
|
162
|
-
{
|
|
163
|
-
name: "Tricia Marie McMilla",
|
|
164
|
-
mail: "trillian@hitchhiker.com",
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
|
-
];
|
|
169
|
-
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
170
|
-
})
|
|
171
|
-
.add("With multiple signatures and invalid status", () => {
|
|
172
|
-
const changeset = copy(three);
|
|
173
|
-
changeset.signatures = [
|
|
174
|
-
{
|
|
175
|
-
keyId: "0x912389FJIQW8W223",
|
|
176
|
-
type: "gpg",
|
|
177
|
-
status: "INVALID",
|
|
178
|
-
owner: "trillian",
|
|
179
|
-
contacts: [
|
|
180
|
-
{
|
|
181
|
-
name: "Tricia Marie McMilla",
|
|
182
|
-
mail: "trillian@hitchhiker.com",
|
|
183
|
-
},
|
|
184
|
-
],
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
keyId: "0x247E908C6FD35473",
|
|
188
|
-
type: "gpg",
|
|
189
|
-
status: "VERIFIED",
|
|
190
|
-
owner: "trillian",
|
|
191
|
-
contacts: [
|
|
192
|
-
{
|
|
193
|
-
name: "Tricia Marie McMilla",
|
|
194
|
-
mail: "trillian@hitchhiker.com",
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
keyId: "0x9123891239VFIA33",
|
|
200
|
-
type: "gpg",
|
|
201
|
-
status: "NOT_FOUND",
|
|
202
|
-
owner: "trillian",
|
|
203
|
-
contacts: [
|
|
204
|
-
{
|
|
205
|
-
name: "Tricia Marie McMilla",
|
|
206
|
-
mail: "trillian@hitchhiker.com",
|
|
207
|
-
},
|
|
208
|
-
],
|
|
439
|
+
contacts: [{ name: "Tricia Marie McMilla", mail: "trillian@hitchhiker.com" }],
|
|
209
440
|
},
|
|
210
441
|
];
|
|
211
442
|
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
212
|
-
}
|
|
213
|
-
|
|
443
|
+
},
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
export const WithMultipleSignaturesInvalid: Story = {
|
|
447
|
+
name: "With Multiple Signatures (Invalid Status)",
|
|
448
|
+
render: () => {
|
|
214
449
|
const changeset = copy(three);
|
|
215
450
|
changeset.signatures = [
|
|
216
|
-
{
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
status: "NOT_FOUND",
|
|
220
|
-
owner: "trillian",
|
|
221
|
-
contacts: [
|
|
222
|
-
{
|
|
223
|
-
name: "Tricia Marie McMilla",
|
|
224
|
-
mail: "trillian@hitchhiker.com",
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
keyId: "0x247E908C6FD35473",
|
|
230
|
-
type: "gpg",
|
|
231
|
-
status: "VERIFIED",
|
|
232
|
-
owner: "trillian",
|
|
233
|
-
contacts: [
|
|
234
|
-
{
|
|
235
|
-
name: "Tricia Marie McMilla",
|
|
236
|
-
mail: "trillian@hitchhiker.com",
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
keyId: "0x9123891239VFIA33",
|
|
242
|
-
type: "gpg",
|
|
243
|
-
status: "NOT_FOUND",
|
|
244
|
-
owner: "trillian",
|
|
245
|
-
contacts: [
|
|
246
|
-
{
|
|
247
|
-
name: "Tricia Marie McMilla",
|
|
248
|
-
mail: "trillian@hitchhiker.com",
|
|
249
|
-
},
|
|
250
|
-
],
|
|
251
|
-
},
|
|
451
|
+
{ keyId: "0x912389FJIQW8W223", type: "gpg", status: "INVALID", owner: "trillian" },
|
|
452
|
+
{ keyId: "0x247E908C6FD35473", type: "gpg", status: "VERIFIED", owner: "trillian" },
|
|
453
|
+
{ keyId: "0x9123891239VFIA33", type: "gpg", status: "NOT_FOUND", owner: "trillian" },
|
|
252
454
|
];
|
|
253
455
|
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
254
|
-
}
|
|
255
|
-
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
export const WithMultipleSignaturesValid: Story = {
|
|
460
|
+
name: "With Multiple Signatures (Valid Status)",
|
|
461
|
+
render: () => {
|
|
256
462
|
const changeset = copy(three);
|
|
257
463
|
changeset.signatures = [
|
|
258
|
-
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
status: "NOT_FOUND",
|
|
262
|
-
owner: "trillian",
|
|
263
|
-
contacts: [
|
|
264
|
-
{
|
|
265
|
-
name: "Tricia Marie McMilla",
|
|
266
|
-
mail: "trillian@hitchhiker.com",
|
|
267
|
-
},
|
|
268
|
-
],
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
keyId: "0x9123891239VFIA33",
|
|
272
|
-
type: "gpg",
|
|
273
|
-
status: "NOT_FOUND",
|
|
274
|
-
owner: "trillian",
|
|
275
|
-
contacts: [
|
|
276
|
-
{
|
|
277
|
-
name: "Tricia Marie McMilla",
|
|
278
|
-
mail: "trillian@hitchhiker.com",
|
|
279
|
-
},
|
|
280
|
-
],
|
|
281
|
-
},
|
|
464
|
+
{ keyId: "0x912389FJIQW8W223", type: "gpg", status: "NOT_FOUND", owner: "trillian" },
|
|
465
|
+
{ keyId: "0x247E908C6FD35473", type: "gpg", status: "VERIFIED", owner: "trillian" },
|
|
466
|
+
{ keyId: "0x9123891239VFIA33", type: "gpg", status: "NOT_FOUND", owner: "trillian" },
|
|
282
467
|
];
|
|
283
468
|
return <ChangesetRow repository={repository} changeset={changeset} />;
|
|
284
|
-
}
|
|
285
|
-
|
|
469
|
+
},
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// Story für die ChangesetList
|
|
473
|
+
export const ListWithNavigation: Story = {
|
|
474
|
+
name: "List With Navigation",
|
|
475
|
+
render: () => (
|
|
286
476
|
<ShortcutDocsContextProvider>
|
|
287
477
|
<ChangesetList repository={repository} changesets={[copy(one), copy(two), copy(three)]} />
|
|
288
478
|
</ShortcutDocsContextProvider>
|
|
289
|
-
)
|
|
479
|
+
),
|
|
480
|
+
};
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { FC } from "react";
|
|
17
|
+
import React, { FC, ReactNode } from "react";
|
|
18
18
|
import styled from "styled-components";
|
|
19
19
|
|
|
20
20
|
const SizedTd = styled.td`
|
|
21
21
|
width: 10rem;
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
const ContributorRow: FC<{ label: string }> = ({ label, children }) => {
|
|
24
|
+
const ContributorRow: FC<{ label: string; children?: ReactNode }> = ({ label, children }) => {
|
|
25
25
|
return (
|
|
26
26
|
<tr key={label}>
|
|
27
27
|
<SizedTd>{label}:</SizedTd>
|
|
@@ -125,6 +125,7 @@ const SignatureIcon: FC<Props> = ({ signatures, className }) => {
|
|
|
125
125
|
>
|
|
126
126
|
<StyledDiv>{signatureElements}</StyledDiv>
|
|
127
127
|
</Popover>
|
|
128
|
+
{/* @ts-ignore */}
|
|
128
129
|
<div {...triggerProps}>
|
|
129
130
|
<StyledIcon name="key" className={className} color={getColor(signatures)} />
|
|
130
131
|
</div>
|
|
@@ -149,7 +149,7 @@ const TreeFile: FC<FileProps> = ({ changeType, path, parentPath, currentFile, se
|
|
|
149
149
|
"is-relative",
|
|
150
150
|
isCurrentFile() ? "has-text-secondary-least" : `has-text-${getColor(changeType)}`
|
|
151
151
|
)}
|
|
152
|
-
|
|
152
|
+
issmaller={getIcon(changeType) === "circle" ? "true" : "false"}
|
|
153
153
|
key={changeType}
|
|
154
154
|
alt={t(`diff.changes.${changeType}`)}
|
|
155
155
|
>
|