github-issue-tower-defence-management 1.89.0 → 1.91.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.
Files changed (160) hide show
  1. package/.github/CODEOWNERS +1 -2
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +15 -2
  4. package/bin/adapter/entry-points/cli/index.js +16 -12
  5. package/bin/adapter/entry-points/cli/index.js.map +1 -1
  6. package/bin/adapter/entry-points/cli/projectConfig.js +2 -0
  7. package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
  8. package/bin/adapter/entry-points/console/consoleOperationApi.js +54 -27
  9. package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
  10. package/bin/adapter/entry-points/console/consoleProjectResolver.js +38 -0
  11. package/bin/adapter/entry-points/console/consoleProjectResolver.js.map +1 -0
  12. package/bin/adapter/entry-points/console/consoleServer.js +43 -17
  13. package/bin/adapter/entry-points/console/consoleServer.js.map +1 -1
  14. package/bin/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  15. package/bin/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
  16. package/bin/adapter/entry-points/console/ui-dist/index.html +2 -2
  17. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +16 -0
  18. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
  19. package/jest.config.js +57 -9
  20. package/package.json +17 -13
  21. package/src/adapter/entry-points/cli/index.test.ts +12 -2
  22. package/src/adapter/entry-points/cli/index.ts +30 -12
  23. package/src/adapter/entry-points/cli/projectConfig.ts +3 -0
  24. package/src/adapter/entry-points/console/consoleOperationApi.test.ts +129 -15
  25. package/src/adapter/entry-points/console/consoleOperationApi.ts +83 -28
  26. package/src/adapter/entry-points/console/consoleProjectResolver.test.ts +96 -0
  27. package/src/adapter/entry-points/console/consoleProjectResolver.ts +50 -0
  28. package/src/adapter/entry-points/console/consoleServer.test.ts +86 -4
  29. package/src/adapter/entry-points/console/consoleServer.ts +53 -23
  30. package/src/adapter/entry-points/console/ui/jest.setup.ts +1 -0
  31. package/src/adapter/entry-points/console/ui/jest.styleMock.js +1 -0
  32. package/src/adapter/entry-points/console/ui/src/features/console/colors.test.ts +34 -0
  33. package/src/adapter/entry-points/console/ui/src/features/console/colors.ts +73 -0
  34. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.stories.tsx +28 -0
  35. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.test.tsx +42 -0
  36. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.tsx +55 -0
  37. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.stories.tsx +14 -0
  38. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.test.tsx +23 -0
  39. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.tsx +26 -0
  40. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.stories.tsx +29 -0
  41. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.test.tsx +55 -0
  42. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.tsx +66 -0
  43. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.stories.tsx +25 -0
  44. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.test.tsx +53 -0
  45. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.tsx +53 -0
  46. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.stories.tsx +79 -0
  47. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.test.tsx +81 -0
  48. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.tsx +226 -0
  49. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.stories.tsx +82 -0
  50. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.test.tsx +52 -0
  51. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.tsx +32 -0
  52. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.stories.tsx +25 -0
  53. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.test.tsx +43 -0
  54. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.tsx +34 -0
  55. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.stories.tsx +22 -6
  56. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.test.tsx +87 -0
  57. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.tsx +36 -32
  58. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.stories.tsx +27 -0
  59. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.test.tsx +36 -0
  60. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.tsx +50 -0
  61. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.stories.tsx +22 -0
  62. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.test.tsx +38 -0
  63. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.tsx +65 -0
  64. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.stories.tsx +20 -0
  65. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.test.tsx +42 -0
  66. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.tsx +28 -0
  67. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.stories.tsx +55 -0
  68. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.test.tsx +85 -0
  69. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.tsx +55 -0
  70. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.stories.tsx +26 -0
  71. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.test.tsx +32 -0
  72. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.tsx +36 -0
  73. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.stories.tsx +29 -0
  74. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.test.tsx +14 -0
  75. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.tsx +14 -0
  76. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.stories.tsx +14 -0
  77. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.test.tsx +33 -0
  78. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.tsx +34 -0
  79. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.stories.tsx +31 -0
  80. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.test.tsx +40 -0
  81. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.tsx +88 -0
  82. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.stories.tsx +17 -0
  83. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.test.tsx +49 -0
  84. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.tsx +63 -0
  85. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.stories.tsx +17 -0
  86. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.test.tsx +45 -0
  87. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.tsx +42 -0
  88. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.stories.tsx +27 -0
  89. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.test.tsx +24 -0
  90. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.tsx +28 -0
  91. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.stories.tsx +41 -5
  92. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.test.tsx +59 -0
  93. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.tsx +28 -19
  94. package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.test.ts +35 -0
  95. package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.ts +21 -0
  96. package/src/adapter/entry-points/console/ui/src/features/console/fixtures.ts +206 -9
  97. package/src/adapter/entry-points/console/ui/src/features/console/grouping.test.ts +91 -0
  98. package/src/adapter/entry-points/console/ui/src/features/console/grouping.ts +79 -0
  99. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.test.ts +22 -0
  100. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.ts +42 -0
  101. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.test.ts +126 -0
  102. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.ts +167 -0
  103. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +198 -0
  104. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.ts +243 -0
  105. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.test.ts +40 -0
  106. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.ts +71 -0
  107. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsolePjcode.test.ts +24 -0
  108. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsolePjcode.ts +17 -0
  109. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.test.ts +41 -0
  110. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.ts +57 -0
  111. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.test.ts +63 -0
  112. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.ts +129 -0
  113. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleToken.test.ts +41 -0
  114. package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.test.ts +97 -0
  115. package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.ts +95 -0
  116. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.test.ts +155 -0
  117. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.ts +187 -0
  118. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.test.ts +76 -0
  119. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.ts +73 -0
  120. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.test.ts +27 -0
  121. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.ts +71 -0
  122. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.test.ts +56 -0
  123. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.ts +51 -0
  124. package/src/adapter/entry-points/console/ui/src/features/console/operations.test.ts +37 -0
  125. package/src/adapter/entry-points/console/ui/src/features/console/operations.ts +35 -0
  126. package/src/adapter/entry-points/console/ui/src/features/console/overlay.test.ts +124 -0
  127. package/src/adapter/entry-points/console/ui/src/features/console/overlay.ts +101 -0
  128. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +79 -0
  129. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +109 -0
  130. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.test.tsx +74 -0
  131. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.tsx +137 -7
  132. package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.test.ts +52 -0
  133. package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.ts +51 -0
  134. package/src/adapter/entry-points/console/ui/src/features/console/types.ts +73 -1
  135. package/src/adapter/entry-points/console/ui/src/index.css +352 -2
  136. package/src/adapter/entry-points/console/ui/tsconfig.json +3 -1
  137. package/src/adapter/entry-points/console/ui/vite.config.ts +6 -1
  138. package/src/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  139. package/src/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
  140. package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
  141. package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.ts +25 -0
  142. package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +4 -0
  143. package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
  144. package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
  145. package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
  146. package/types/adapter/entry-points/console/consoleOperationApi.d.ts +6 -2
  147. package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
  148. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts +6 -0
  149. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts.map +1 -0
  150. package/types/adapter/entry-points/console/consoleServer.d.ts +3 -3
  151. package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
  152. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts +1 -0
  153. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts.map +1 -1
  154. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +1 -0
  155. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
  156. package/bin/adapter/entry-points/console/ui-dist/assets/index-DFxrSRH4.css +0 -1
  157. package/bin/adapter/entry-points/console/ui-dist/assets/index-DcOZ02ON.js +0 -49
  158. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleList.ts +0 -65
  159. package/src/adapter/entry-points/console/ui-dist/assets/index-DFxrSRH4.css +0 -1
  160. package/src/adapter/entry-points/console/ui-dist/assets/index-DcOZ02ON.js +0 -49
@@ -0,0 +1,226 @@
1
+ import type { ReactNode } from 'react';
2
+ import { colorFromEnum } from '../colors';
3
+ import { formatFullTimestamp, formatRelativeTime } from '../relativeTime';
4
+ import type {
5
+ ConsoleChangedFile,
6
+ ConsoleColor,
7
+ ConsoleComment,
8
+ ConsoleCommit,
9
+ ConsoleIssueState,
10
+ ConsoleListItem,
11
+ ConsoleOverlayStatus,
12
+ ConsoleRelatedPullRequest,
13
+ } from '../types';
14
+ import { ConsoleChangedFileList } from './ConsoleChangedFileList';
15
+ import { ConsoleCommentList } from './ConsoleCommentList';
16
+ import { ConsoleCommitList } from './ConsoleCommitList';
17
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
18
+ import { ConsoleMarkdownView } from './ConsoleMarkdownView';
19
+ import { ConsolePanel } from './ConsolePanel';
20
+ import { ConsolePullRequestSection } from './ConsolePullRequestSection';
21
+
22
+ export type ConsoleRelatedPullRequestView = {
23
+ pullRequest: ConsoleRelatedPullRequest;
24
+ files: ConsoleChangedFile[];
25
+ filesAreLoading: boolean;
26
+ filesError: string | null;
27
+ commits: ConsoleCommit[];
28
+ commitsAreLoading: boolean;
29
+ commitsError: string | null;
30
+ };
31
+
32
+ export type ConsoleItemDetailProps = {
33
+ item: ConsoleListItem;
34
+ storyName: string | null;
35
+ storyColorEnum: ConsoleColor | null;
36
+ overlayStatus: ConsoleOverlayStatus | null;
37
+ state: ConsoleIssueState | null;
38
+ body: string;
39
+ bodyIsLoading: boolean;
40
+ bodyError: string | null;
41
+ comments: ConsoleComment[];
42
+ commentsAreLoading: boolean;
43
+ commentsError: string | null;
44
+ files: ConsoleChangedFile[];
45
+ filesAreLoading: boolean;
46
+ filesError: string | null;
47
+ commits: ConsoleCommit[];
48
+ commitsAreLoading: boolean;
49
+ commitsError: string | null;
50
+ relatedPullRequests: ConsoleRelatedPullRequestView[];
51
+ now: number;
52
+ operationBar: ReactNode;
53
+ };
54
+
55
+ export const ConsoleItemDetail = ({
56
+ item,
57
+ storyName,
58
+ storyColorEnum,
59
+ overlayStatus,
60
+ state,
61
+ body,
62
+ bodyIsLoading,
63
+ bodyError,
64
+ comments,
65
+ commentsAreLoading,
66
+ commentsError,
67
+ files,
68
+ filesAreLoading,
69
+ filesError,
70
+ commits,
71
+ commitsAreLoading,
72
+ commitsError,
73
+ relatedPullRequests,
74
+ now,
75
+ operationBar,
76
+ }: ConsoleItemDetailProps) => {
77
+ const resolvedState = state?.state ?? 'open';
78
+ const merged = state?.merged ?? false;
79
+ const closedStateLabel =
80
+ !item.isPr && resolvedState === 'closed' ? 'Closed' : null;
81
+ const storyPalette = colorFromEnum(storyColorEnum);
82
+ const statusPalette = overlayStatus
83
+ ? colorFromEnum(overlayStatus.color)
84
+ : null;
85
+
86
+ return (
87
+ <article className="console-detail">
88
+ {storyName !== null && (
89
+ <div className="console-detail-story">
90
+ <span className="console-storytag">
91
+ <span
92
+ className="console-story-dot"
93
+ style={{ backgroundColor: storyPalette.dot }}
94
+ />
95
+ {storyName}
96
+ </span>
97
+ </div>
98
+ )}
99
+
100
+ {overlayStatus !== null && statusPalette !== null && (
101
+ <span
102
+ className="console-detail-status-chip"
103
+ style={{
104
+ color: statusPalette.fg,
105
+ borderColor: statusPalette.border,
106
+ backgroundColor: statusPalette.bg,
107
+ }}
108
+ >
109
+ {overlayStatus.name}
110
+ </span>
111
+ )}
112
+
113
+ <h2 className="console-detail-title">
114
+ <ConsoleItemIcon
115
+ isPr={item.isPr}
116
+ state={resolvedState}
117
+ merged={merged}
118
+ isDraft={false}
119
+ stateReason=""
120
+ />
121
+ <span className="console-detail-title-text">{item.title}</span>
122
+ <span className="console-detail-number">
123
+ {item.isPr ? `PR #${item.number}` : `#${item.number}`}
124
+ </span>
125
+ {closedStateLabel !== null && (
126
+ <span className="console-detail-closed-label">
127
+ {closedStateLabel}
128
+ </span>
129
+ )}
130
+ </h2>
131
+
132
+ <div className="console-detail-subbar">
133
+ <a
134
+ href={item.url}
135
+ className="console-detail-link"
136
+ target="_blank"
137
+ rel="noopener noreferrer"
138
+ >
139
+ {item.isPr ? `PR #${item.number}` : `Issue #${item.number}`}
140
+ </a>
141
+ <span className="console-detail-repo">{item.repo}</span>
142
+ <span className="console-detail-pill">
143
+ {item.isPr ? 'PR' : 'Issue'}
144
+ </span>
145
+ </div>
146
+
147
+ {item.labels.length > 0 && (
148
+ <div className="console-detail-labels">
149
+ {item.labels.map((label) => (
150
+ <span key={label} className="console-label-chip">
151
+ {label}
152
+ </span>
153
+ ))}
154
+ </div>
155
+ )}
156
+
157
+ <div
158
+ className="console-detail-createdat"
159
+ title={formatFullTimestamp(item.createdAt)}
160
+ >
161
+ opened {formatRelativeTime(item.createdAt, now)}
162
+ </div>
163
+
164
+ <ConsolePanel title="Description">
165
+ {bodyError !== null ? (
166
+ <p role="alert" className="console-detail-body-error">
167
+ Failed to load description: {bodyError}
168
+ </p>
169
+ ) : bodyIsLoading ? (
170
+ <p className="console-detail-body-loading">Loading description...</p>
171
+ ) : (
172
+ <ConsoleMarkdownView body={body} />
173
+ )}
174
+ </ConsolePanel>
175
+
176
+ {item.isPr && (
177
+ <ConsolePanel title="Changed files">
178
+ <ConsoleChangedFileList
179
+ files={files}
180
+ isLoading={filesAreLoading}
181
+ error={filesError}
182
+ />
183
+ </ConsolePanel>
184
+ )}
185
+
186
+ <ConsolePanel title="Comments" defaultCollapsed={item.isPr}>
187
+ <ConsoleCommentList
188
+ comments={comments}
189
+ isLoading={commentsAreLoading}
190
+ error={commentsError}
191
+ now={now}
192
+ />
193
+ </ConsolePanel>
194
+
195
+ {item.isPr && (
196
+ <ConsolePanel title="Commits" defaultCollapsed>
197
+ <ConsoleCommitList
198
+ commits={commits}
199
+ isLoading={commitsAreLoading}
200
+ error={commitsError}
201
+ now={now}
202
+ />
203
+ </ConsolePanel>
204
+ )}
205
+
206
+ {!item.isPr &&
207
+ relatedPullRequests.map((related) => (
208
+ <ConsolePullRequestSection
209
+ key={related.pullRequest.url}
210
+ pullRequest={related.pullRequest}
211
+ body={related.pullRequest.summary?.body ?? ''}
212
+ bodyIsLoading={false}
213
+ files={related.files}
214
+ filesAreLoading={related.filesAreLoading}
215
+ filesError={related.filesError}
216
+ commits={related.commits}
217
+ commitsAreLoading={related.commitsAreLoading}
218
+ commitsError={related.commitsError}
219
+ now={now}
220
+ />
221
+ ))}
222
+
223
+ <div className="console-detail-operations">{operationBar}</div>
224
+ </article>
225
+ );
226
+ };
@@ -0,0 +1,82 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
3
+
4
+ const meta: Meta<typeof ConsoleItemIcon> = {
5
+ title: 'Console/ConsoleItemIcon',
6
+ component: ConsoleItemIcon,
7
+ args: { size: 20 },
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof ConsoleItemIcon>;
13
+
14
+ export const PullRequestOpen: Story = {
15
+ args: {
16
+ isPr: true,
17
+ state: 'open',
18
+ merged: false,
19
+ isDraft: false,
20
+ stateReason: '',
21
+ },
22
+ };
23
+
24
+ export const PullRequestMerged: Story = {
25
+ args: {
26
+ isPr: true,
27
+ state: 'closed',
28
+ merged: true,
29
+ isDraft: false,
30
+ stateReason: '',
31
+ },
32
+ };
33
+
34
+ export const PullRequestClosed: Story = {
35
+ args: {
36
+ isPr: true,
37
+ state: 'closed',
38
+ merged: false,
39
+ isDraft: false,
40
+ stateReason: '',
41
+ },
42
+ };
43
+
44
+ export const PullRequestDraft: Story = {
45
+ args: {
46
+ isPr: true,
47
+ state: 'open',
48
+ merged: false,
49
+ isDraft: true,
50
+ stateReason: '',
51
+ },
52
+ };
53
+
54
+ export const IssueOpen: Story = {
55
+ args: {
56
+ isPr: false,
57
+ state: 'open',
58
+ merged: false,
59
+ isDraft: false,
60
+ stateReason: '',
61
+ },
62
+ };
63
+
64
+ export const IssueClosedCompleted: Story = {
65
+ args: {
66
+ isPr: false,
67
+ state: 'closed',
68
+ merged: false,
69
+ isDraft: false,
70
+ stateReason: 'completed',
71
+ },
72
+ };
73
+
74
+ export const IssueClosedNotPlanned: Story = {
75
+ args: {
76
+ isPr: false,
77
+ state: 'closed',
78
+ merged: false,
79
+ isDraft: false,
80
+ stateReason: 'not_planned',
81
+ },
82
+ };
@@ -0,0 +1,52 @@
1
+ import { render } from '@testing-library/react';
2
+ import { CONSOLE_ITEM_ICONS } from '../itemIcons';
3
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
4
+
5
+ describe('ConsoleItemIcon', () => {
6
+ it('renders the green open pull-request icon for an open PR', () => {
7
+ const { getByRole } = render(
8
+ <ConsoleItemIcon
9
+ isPr
10
+ state="open"
11
+ merged={false}
12
+ isDraft={false}
13
+ stateReason=""
14
+ />,
15
+ );
16
+ const svg = getByRole('img');
17
+ expect(svg).toHaveAttribute('fill', CONSOLE_ITEM_ICONS.prOpen.color);
18
+ expect(svg).toHaveAttribute('aria-label', 'prOpen');
19
+ });
20
+
21
+ it('renders the red closed pull-request icon for a closed PR', () => {
22
+ const { getByRole } = render(
23
+ <ConsoleItemIcon
24
+ isPr
25
+ state="closed"
26
+ merged={false}
27
+ isDraft={false}
28
+ stateReason=""
29
+ />,
30
+ );
31
+ expect(getByRole('img')).toHaveAttribute(
32
+ 'fill',
33
+ CONSOLE_ITEM_ICONS.prClosed.color,
34
+ );
35
+ });
36
+
37
+ it('renders the gray not-planned icon for a closed unplanned issue', () => {
38
+ const { getByRole } = render(
39
+ <ConsoleItemIcon
40
+ isPr={false}
41
+ state="closed"
42
+ merged={false}
43
+ isDraft={false}
44
+ stateReason="not_planned"
45
+ />,
46
+ );
47
+ expect(getByRole('img')).toHaveAttribute(
48
+ 'fill',
49
+ CONSOLE_ITEM_ICONS.issueClosedNotPlanned.color,
50
+ );
51
+ });
52
+ });
@@ -0,0 +1,32 @@
1
+ import {
2
+ CONSOLE_ITEM_ICONS,
3
+ type ConsoleItemIconInput,
4
+ resolveConsoleItemIconKind,
5
+ } from '../itemIcons';
6
+
7
+ export type ConsoleItemIconProps = ConsoleItemIconInput & {
8
+ size?: number;
9
+ };
10
+
11
+ export const ConsoleItemIcon = ({
12
+ size = 12,
13
+ ...input
14
+ }: ConsoleItemIconProps) => {
15
+ const kind = resolveConsoleItemIconKind(input);
16
+ const definition = CONSOLE_ITEM_ICONS[kind];
17
+ return (
18
+ <svg
19
+ className="console-item-icon"
20
+ viewBox="0 0 16 16"
21
+ width={size}
22
+ height={size}
23
+ fill={definition.color}
24
+ role="img"
25
+ aria-label={kind}
26
+ >
27
+ {definition.paths.map((d) => (
28
+ <path key={d} d={d} />
29
+ ))}
30
+ </svg>
31
+ );
32
+ };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { consoleListItemsFixture } from '../fixtures';
3
+ import { ConsoleListItemRow } from './ConsoleListItemRow';
4
+
5
+ const meta: Meta<typeof ConsoleListItemRow> = {
6
+ title: 'Console/ConsoleListItemRow',
7
+ component: ConsoleListItemRow,
8
+ args: { onSelect: () => {} },
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ConsoleListItemRow>;
14
+
15
+ export const PullRequestRow: Story = {
16
+ args: { item: consoleListItemsFixture[0], isActive: false },
17
+ };
18
+
19
+ export const IssueRow: Story = {
20
+ args: { item: consoleListItemsFixture[2], isActive: false },
21
+ };
22
+
23
+ export const ActiveRow: Story = {
24
+ args: { item: consoleListItemsFixture[0], isActive: true },
25
+ };
@@ -0,0 +1,43 @@
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import { consoleListItemsFixture } from '../fixtures';
3
+ import { ConsoleListItemRow } from './ConsoleListItemRow';
4
+
5
+ const prItem = consoleListItemsFixture[0];
6
+ const issueItem = consoleListItemsFixture[2];
7
+
8
+ describe('ConsoleListItemRow', () => {
9
+ it('renders a PR number with the PR prefix', () => {
10
+ const { getByText } = render(
11
+ <ConsoleListItemRow item={prItem} isActive={false} onSelect={() => {}} />,
12
+ );
13
+ expect(getByText(`PR #${prItem.number}`)).toBeInTheDocument();
14
+ expect(getByText(prItem.title)).toBeInTheDocument();
15
+ });
16
+
17
+ it('renders an issue number with the hash prefix', () => {
18
+ const { getByText } = render(
19
+ <ConsoleListItemRow
20
+ item={issueItem}
21
+ isActive={false}
22
+ onSelect={() => {}}
23
+ />,
24
+ );
25
+ expect(getByText(`#${issueItem.number}`)).toBeInTheDocument();
26
+ });
27
+
28
+ it('reports the item on click', () => {
29
+ const onSelect = jest.fn();
30
+ const { getByRole } = render(
31
+ <ConsoleListItemRow item={prItem} isActive={false} onSelect={onSelect} />,
32
+ );
33
+ fireEvent.click(getByRole('button'));
34
+ expect(onSelect).toHaveBeenCalledWith(prItem);
35
+ });
36
+
37
+ it('marks the active row', () => {
38
+ const { getByRole } = render(
39
+ <ConsoleListItemRow item={prItem} isActive onSelect={() => {}} />,
40
+ );
41
+ expect(getByRole('button')).toHaveAttribute('data-active', 'true');
42
+ });
43
+ });
@@ -0,0 +1,34 @@
1
+ import type { ConsoleListItem } from '../types';
2
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
3
+
4
+ export type ConsoleListItemRowProps = {
5
+ item: ConsoleListItem;
6
+ isActive: boolean;
7
+ onSelect: (item: ConsoleListItem) => void;
8
+ };
9
+
10
+ export const ConsoleListItemRow = ({
11
+ item,
12
+ isActive,
13
+ onSelect,
14
+ }: ConsoleListItemRowProps) => (
15
+ <button
16
+ type="button"
17
+ className="console-item-row"
18
+ aria-current={isActive ? 'true' : undefined}
19
+ data-active={isActive ? 'true' : undefined}
20
+ onClick={() => onSelect(item)}
21
+ >
22
+ <ConsoleItemIcon
23
+ isPr={item.isPr}
24
+ state="open"
25
+ merged={false}
26
+ isDraft={false}
27
+ stateReason=""
28
+ />
29
+ <span className="console-item-title">{item.title}</span>
30
+ <span className="console-item-number">
31
+ {item.isPr ? `PR #${item.number}` : `#${item.number}`}
32
+ </span>
33
+ </button>
34
+ );
@@ -1,5 +1,9 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { consoleListItemsFixture } from '../fixtures';
2
+ import {
3
+ consoleListItemsFixture,
4
+ consoleStoryColorsFixture,
5
+ } from '../fixtures';
6
+ import { buildConsoleListRows } from '../grouping';
3
7
  import { ConsoleListView } from './ConsoleListView';
4
8
 
5
9
  const meta: Meta<typeof ConsoleListView> = {
@@ -11,34 +15,46 @@ export default meta;
11
15
 
12
16
  type Story = StoryObj<typeof ConsoleListView>;
13
17
 
14
- export const WithItems: Story = {
18
+ export const WithStoryGroups: Story = {
15
19
  args: {
16
- items: consoleListItemsFixture,
20
+ rows: buildConsoleListRows(consoleListItemsFixture, {}),
21
+ storyColors: consoleStoryColorsFixture,
22
+ activeItemId: null,
17
23
  isLoading: false,
18
24
  error: null,
25
+ onSelectItem: () => {},
19
26
  },
20
27
  };
21
28
 
22
29
  export const Loading: Story = {
23
30
  args: {
24
- items: [],
31
+ rows: [],
32
+ storyColors: {},
33
+ activeItemId: null,
25
34
  isLoading: true,
26
35
  error: null,
36
+ onSelectItem: () => {},
27
37
  },
28
38
  };
29
39
 
30
40
  export const Empty: Story = {
31
41
  args: {
32
- items: [],
42
+ rows: [],
43
+ storyColors: {},
44
+ activeItemId: null,
33
45
  isLoading: false,
34
46
  error: null,
47
+ onSelectItem: () => {},
35
48
  },
36
49
  };
37
50
 
38
51
  export const ErrorState: Story = {
39
52
  args: {
40
- items: [],
53
+ rows: [],
54
+ storyColors: {},
55
+ activeItemId: null,
41
56
  isLoading: false,
42
57
  error: 'HTTP 404',
58
+ onSelectItem: () => {},
43
59
  },
44
60
  };
@@ -0,0 +1,87 @@
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import {
3
+ consoleListItemsFixture,
4
+ consoleStoryColorsFixture,
5
+ } from '../fixtures';
6
+ import { buildConsoleListRows } from '../grouping';
7
+ import { ConsoleListView } from './ConsoleListView';
8
+
9
+ const rows = buildConsoleListRows(consoleListItemsFixture, {});
10
+
11
+ describe('ConsoleListView', () => {
12
+ it('renders group headers and items in array order', () => {
13
+ const { getAllByRole, getByText } = render(
14
+ <ConsoleListView
15
+ rows={rows}
16
+ storyColors={consoleStoryColorsFixture}
17
+ activeItemId={null}
18
+ isLoading={false}
19
+ error={null}
20
+ onSelectItem={() => {}}
21
+ />,
22
+ );
23
+ expect(getByText('TDPM Console port')).toBeInTheDocument();
24
+ expect(getByText('regular / workflow improvement')).toBeInTheDocument();
25
+ expect(getAllByRole('button').length).toBe(consoleListItemsFixture.length);
26
+ });
27
+
28
+ it('reports the selected item', () => {
29
+ const onSelectItem = jest.fn();
30
+ const { getByText } = render(
31
+ <ConsoleListView
32
+ rows={rows}
33
+ storyColors={consoleStoryColorsFixture}
34
+ activeItemId={null}
35
+ isLoading={false}
36
+ error={null}
37
+ onSelectItem={onSelectItem}
38
+ />,
39
+ );
40
+ fireEvent.click(
41
+ getByText('Add serveConsole subcommand under entry-points'),
42
+ );
43
+ expect(onSelectItem).toHaveBeenCalledWith(consoleListItemsFixture[0]);
44
+ });
45
+
46
+ it('shows the loading state', () => {
47
+ const { getByText } = render(
48
+ <ConsoleListView
49
+ rows={[]}
50
+ storyColors={{}}
51
+ activeItemId={null}
52
+ isLoading
53
+ error={null}
54
+ onSelectItem={() => {}}
55
+ />,
56
+ );
57
+ expect(getByText('Loading list...')).toBeInTheDocument();
58
+ });
59
+
60
+ it('shows the empty state', () => {
61
+ const { getByText } = render(
62
+ <ConsoleListView
63
+ rows={[]}
64
+ storyColors={{}}
65
+ activeItemId={null}
66
+ isLoading={false}
67
+ error={null}
68
+ onSelectItem={() => {}}
69
+ />,
70
+ );
71
+ expect(getByText('No items.')).toBeInTheDocument();
72
+ });
73
+
74
+ it('shows the error state', () => {
75
+ const { getByRole } = render(
76
+ <ConsoleListView
77
+ rows={[]}
78
+ storyColors={{}}
79
+ activeItemId={null}
80
+ isLoading={false}
81
+ error="HTTP 404"
82
+ onSelectItem={() => {}}
83
+ />,
84
+ );
85
+ expect(getByRole('alert')).toHaveTextContent('HTTP 404');
86
+ });
87
+ });