github-issue-tower-defence-management 1.90.0 → 1.91.1

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 (174) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +19 -5
  3. package/bin/adapter/entry-points/cli/index.js +17 -13
  4. package/bin/adapter/entry-points/cli/index.js.map +1 -1
  5. package/bin/adapter/entry-points/cli/projectConfig.js +2 -0
  6. package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
  7. package/bin/adapter/entry-points/console/consoleOperationApi.js +54 -27
  8. package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
  9. package/bin/adapter/entry-points/console/consoleProjectResolver.js +38 -0
  10. package/bin/adapter/entry-points/console/consoleProjectResolver.js.map +1 -0
  11. package/bin/adapter/entry-points/console/consoleServer.js +3 -4
  12. package/bin/adapter/entry-points/console/consoleServer.js.map +1 -1
  13. package/bin/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  14. package/bin/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
  15. package/bin/adapter/entry-points/console/ui-dist/index.html +2 -2
  16. package/bin/adapter/entry-points/handlers/consoleListsWriter.js +1 -0
  17. package/bin/adapter/entry-points/handlers/consoleListsWriter.js.map +1 -1
  18. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +16 -0
  19. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
  20. package/bin/domain/usecases/console/GenerateConsoleListsUseCase.js +3 -0
  21. package/bin/domain/usecases/console/GenerateConsoleListsUseCase.js.map +1 -1
  22. package/jest.config.js +57 -9
  23. package/package.json +17 -13
  24. package/src/adapter/entry-points/cli/index.test.ts +18 -3
  25. package/src/adapter/entry-points/cli/index.ts +32 -14
  26. package/src/adapter/entry-points/cli/projectConfig.ts +3 -0
  27. package/src/adapter/entry-points/console/consoleOperationApi.test.ts +129 -15
  28. package/src/adapter/entry-points/console/consoleOperationApi.ts +83 -28
  29. package/src/adapter/entry-points/console/consoleProjectResolver.test.ts +96 -0
  30. package/src/adapter/entry-points/console/consoleProjectResolver.ts +50 -0
  31. package/src/adapter/entry-points/console/consoleServer.test.ts +5 -4
  32. package/src/adapter/entry-points/console/consoleServer.ts +5 -7
  33. package/src/adapter/entry-points/console/ui/jest.setup.ts +1 -0
  34. package/src/adapter/entry-points/console/ui/jest.styleMock.js +1 -0
  35. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMarkdownContent.stories.tsx +27 -0
  36. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMarkdownContent.test.tsx +36 -0
  37. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMarkdownContent.tsx +50 -0
  38. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.stories.tsx +22 -0
  39. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.test.tsx +38 -0
  40. package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.tsx +65 -0
  41. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.stories.tsx +28 -0
  42. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.test.tsx +42 -0
  43. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.tsx +55 -0
  44. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.stories.tsx +29 -0
  45. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.test.tsx +55 -0
  46. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.tsx +66 -0
  47. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.stories.tsx +25 -0
  48. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.test.tsx +53 -0
  49. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.tsx +53 -0
  50. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.stories.tsx +79 -0
  51. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.test.tsx +81 -0
  52. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.tsx +229 -0
  53. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.stories.tsx +82 -0
  54. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.test.tsx +52 -0
  55. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.tsx +32 -0
  56. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.stories.tsx +31 -0
  57. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.test.tsx +40 -0
  58. package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.tsx +88 -0
  59. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.stories.tsx +26 -0
  60. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.test.tsx +32 -0
  61. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.tsx +36 -0
  62. package/src/adapter/entry-points/console/ui/src/features/console/components/{ConsoleProjectHeader.stories.tsx → layout/ConsoleProjectSummary.stories.tsx} +5 -5
  63. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleProjectSummary.test.tsx +14 -0
  64. package/src/adapter/entry-points/console/ui/src/features/console/components/{ConsoleProjectHeader.tsx → layout/ConsoleProjectSummary.tsx} +3 -1
  65. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.stories.tsx +70 -0
  66. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.test.tsx +59 -0
  67. package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.tsx +41 -0
  68. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.stories.tsx +60 -0
  69. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.test.tsx +87 -0
  70. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.tsx +68 -0
  71. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.stories.tsx +25 -0
  72. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.test.tsx +43 -0
  73. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.tsx +34 -0
  74. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.stories.tsx +27 -0
  75. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.test.tsx +24 -0
  76. package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.tsx +28 -0
  77. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.stories.tsx +14 -0
  78. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.test.tsx +21 -0
  79. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.tsx +26 -0
  80. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.stories.tsx +20 -0
  81. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.test.tsx +42 -0
  82. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.tsx +28 -0
  83. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.stories.tsx +55 -0
  84. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.test.tsx +85 -0
  85. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.tsx +58 -0
  86. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.stories.tsx +14 -0
  87. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.test.tsx +33 -0
  88. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.tsx +34 -0
  89. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.stories.tsx +17 -0
  90. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.test.tsx +49 -0
  91. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.tsx +66 -0
  92. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.stories.tsx +17 -0
  93. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.test.tsx +39 -0
  94. package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.tsx +42 -0
  95. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.test.ts +22 -0
  96. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.ts +42 -0
  97. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.test.ts +126 -0
  98. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.ts +167 -0
  99. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +198 -0
  100. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.ts +243 -0
  101. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.test.ts +40 -0
  102. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.ts +71 -0
  103. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.test.ts +41 -0
  104. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.ts +57 -0
  105. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.test.ts +63 -0
  106. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.ts +129 -0
  107. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleToken.test.ts +41 -0
  108. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.test.ts +155 -0
  109. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.ts +187 -0
  110. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.test.ts +76 -0
  111. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.ts +73 -0
  112. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.test.ts +27 -0
  113. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.ts +71 -0
  114. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.test.ts +56 -0
  115. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.ts +51 -0
  116. package/src/adapter/entry-points/console/ui/src/features/console/logic/colors.test.ts +34 -0
  117. package/src/adapter/entry-points/console/ui/src/features/console/logic/colors.ts +73 -0
  118. package/src/adapter/entry-points/console/ui/src/features/console/logic/fileStatus.test.ts +35 -0
  119. package/src/adapter/entry-points/console/ui/src/features/console/logic/fileStatus.ts +21 -0
  120. package/src/adapter/entry-points/console/ui/src/features/console/logic/grouping.test.ts +91 -0
  121. package/src/adapter/entry-points/console/ui/src/features/console/logic/grouping.ts +79 -0
  122. package/src/adapter/entry-points/console/ui/src/features/console/logic/itemIcons.test.ts +97 -0
  123. package/src/adapter/entry-points/console/ui/src/features/console/logic/itemIcons.ts +95 -0
  124. package/src/adapter/entry-points/console/ui/src/features/console/logic/operations.test.ts +37 -0
  125. package/src/adapter/entry-points/console/ui/src/features/console/logic/operations.ts +35 -0
  126. package/src/adapter/entry-points/console/ui/src/features/console/logic/overlay.test.ts +124 -0
  127. package/src/adapter/entry-points/console/ui/src/features/console/logic/overlay.ts +101 -0
  128. package/src/adapter/entry-points/console/ui/src/features/console/logic/relativeTime.test.ts +52 -0
  129. package/src/adapter/entry-points/console/ui/src/features/console/logic/relativeTime.ts +51 -0
  130. package/src/adapter/entry-points/console/ui/src/features/console/logic/types.ts +141 -0
  131. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +79 -0
  132. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +109 -0
  133. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.test.tsx +74 -0
  134. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.tsx +137 -11
  135. package/src/adapter/entry-points/console/ui/src/features/console/testing/fixtures.ts +244 -0
  136. package/src/adapter/entry-points/console/ui/src/index.css +352 -2
  137. package/src/adapter/entry-points/console/ui/tsconfig.json +1 -0
  138. package/src/adapter/entry-points/console/ui/vite.config.ts +5 -0
  139. package/src/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  140. package/src/adapter/entry-points/console/ui-dist/assets/index-PtVrAcBb.js +100 -0
  141. package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
  142. package/src/adapter/entry-points/handlers/consoleListsWriter.test.ts +27 -2
  143. package/src/adapter/entry-points/handlers/consoleListsWriter.ts +1 -0
  144. package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.ts +25 -0
  145. package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +4 -0
  146. package/src/domain/usecases/console/GenerateConsoleListsUseCase.test.ts +26 -0
  147. package/src/domain/usecases/console/GenerateConsoleListsUseCase.ts +17 -1
  148. package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
  149. package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
  150. package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
  151. package/types/adapter/entry-points/console/consoleOperationApi.d.ts +6 -2
  152. package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
  153. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts +6 -0
  154. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts.map +1 -0
  155. package/types/adapter/entry-points/console/consoleServer.d.ts +2 -3
  156. package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
  157. package/types/adapter/entry-points/handlers/consoleListsWriter.d.ts.map +1 -1
  158. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts +1 -0
  159. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts.map +1 -1
  160. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +1 -0
  161. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
  162. package/types/domain/usecases/console/GenerateConsoleListsUseCase.d.ts +2 -1
  163. package/types/domain/usecases/console/GenerateConsoleListsUseCase.d.ts.map +1 -1
  164. package/bin/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
  165. package/bin/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
  166. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.stories.tsx +0 -44
  167. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.tsx +0 -58
  168. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.stories.tsx +0 -34
  169. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.tsx +0 -32
  170. package/src/adapter/entry-points/console/ui/src/features/console/fixtures.ts +0 -47
  171. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleList.ts +0 -78
  172. package/src/adapter/entry-points/console/ui/src/features/console/types.ts +0 -69
  173. package/src/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
  174. package/src/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
@@ -0,0 +1,60 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { buildConsoleListRows } from '../../logic/grouping';
3
+ import {
4
+ consoleListItemsFixture,
5
+ consoleStoryColorsFixture,
6
+ } from '../../testing/fixtures';
7
+ import { ConsoleItemList } from './ConsoleItemList';
8
+
9
+ const meta: Meta<typeof ConsoleItemList> = {
10
+ title: 'Console/ConsoleItemList',
11
+ component: ConsoleItemList,
12
+ };
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj<typeof ConsoleItemList>;
17
+
18
+ export const WithStoryGroups: Story = {
19
+ args: {
20
+ rows: buildConsoleListRows(consoleListItemsFixture, {}),
21
+ storyColors: consoleStoryColorsFixture,
22
+ activeItemId: null,
23
+ isLoading: false,
24
+ error: null,
25
+ onSelectItem: () => {},
26
+ },
27
+ };
28
+
29
+ export const Loading: Story = {
30
+ args: {
31
+ rows: [],
32
+ storyColors: {},
33
+ activeItemId: null,
34
+ isLoading: true,
35
+ error: null,
36
+ onSelectItem: () => {},
37
+ },
38
+ };
39
+
40
+ export const Empty: Story = {
41
+ args: {
42
+ rows: [],
43
+ storyColors: {},
44
+ activeItemId: null,
45
+ isLoading: false,
46
+ error: null,
47
+ onSelectItem: () => {},
48
+ },
49
+ };
50
+
51
+ export const ErrorState: Story = {
52
+ args: {
53
+ rows: [],
54
+ storyColors: {},
55
+ activeItemId: null,
56
+ isLoading: false,
57
+ error: 'HTTP 404',
58
+ onSelectItem: () => {},
59
+ },
60
+ };
@@ -0,0 +1,87 @@
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import { buildConsoleListRows } from '../../logic/grouping';
3
+ import {
4
+ consoleListItemsFixture,
5
+ consoleStoryColorsFixture,
6
+ } from '../../testing/fixtures';
7
+ import { ConsoleItemList } from './ConsoleItemList';
8
+
9
+ const rows = buildConsoleListRows(consoleListItemsFixture, {});
10
+
11
+ describe('ConsoleItemList', () => {
12
+ it('renders group headers and items in array order', () => {
13
+ const { getAllByRole, getByText } = render(
14
+ <ConsoleItemList
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
+ <ConsoleItemList
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
+ <ConsoleItemList
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
+ <ConsoleItemList
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
+ <ConsoleItemList
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
+ });
@@ -0,0 +1,68 @@
1
+ import {
2
+ type ConsoleListRow,
3
+ resolveStoryColorEnum,
4
+ } from '../../logic/grouping';
5
+ import type {
6
+ ConsoleListItem,
7
+ ConsoleStoryColorSource,
8
+ } from '../../logic/types';
9
+ import { ConsoleItemSummary } from './ConsoleItemSummary';
10
+ import { ConsoleStorySummary } from './ConsoleStorySummary';
11
+
12
+ export type ConsoleListViewProps = {
13
+ rows: ConsoleListRow[];
14
+ storyColors: ConsoleStoryColorSource;
15
+ activeItemId: string | null;
16
+ isLoading: boolean;
17
+ error: string | null;
18
+ onSelectItem: (item: ConsoleListItem) => void;
19
+ };
20
+
21
+ export const ConsoleItemList = ({
22
+ rows,
23
+ storyColors,
24
+ activeItemId,
25
+ isLoading,
26
+ error,
27
+ onSelectItem,
28
+ }: ConsoleListViewProps) => {
29
+ if (error !== null) {
30
+ return (
31
+ <p role="alert" className="console-list-message console-list-error">
32
+ Failed to load list: {error}
33
+ </p>
34
+ );
35
+ }
36
+
37
+ if (isLoading) {
38
+ return <p className="console-list-message">Loading list...</p>;
39
+ }
40
+
41
+ if (rows.length === 0) {
42
+ return <p className="console-list-message">No items.</p>;
43
+ }
44
+
45
+ return (
46
+ <ul className="console-list">
47
+ {rows.map((row) =>
48
+ row.kind === 'group-header' ? (
49
+ <li key={`group:${row.story}`} className="console-list-group">
50
+ <ConsoleStorySummary
51
+ story={row.story}
52
+ count={row.count}
53
+ colorEnum={resolveStoryColorEnum(storyColors, row.story)}
54
+ />
55
+ </li>
56
+ ) : (
57
+ <li key={row.item.itemId} className="console-list-row">
58
+ <ConsoleItemSummary
59
+ item={row.item}
60
+ isActive={row.item.itemId === activeItemId}
61
+ onSelect={onSelectItem}
62
+ />
63
+ </li>
64
+ ),
65
+ )}
66
+ </ul>
67
+ );
68
+ };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { consoleListItemsFixture } from '../../testing/fixtures';
3
+ import { ConsoleItemSummary } from './ConsoleItemSummary';
4
+
5
+ const meta: Meta<typeof ConsoleItemSummary> = {
6
+ title: 'Console/ConsoleItemSummary',
7
+ component: ConsoleItemSummary,
8
+ args: { onSelect: () => {} },
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ConsoleItemSummary>;
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 '../../testing/fixtures';
3
+ import { ConsoleItemSummary } from './ConsoleItemSummary';
4
+
5
+ const prItem = consoleListItemsFixture[0];
6
+ const issueItem = consoleListItemsFixture[2];
7
+
8
+ describe('ConsoleItemSummary', () => {
9
+ it('renders a PR number with the PR prefix', () => {
10
+ const { getByText } = render(
11
+ <ConsoleItemSummary 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
+ <ConsoleItemSummary
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
+ <ConsoleItemSummary 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
+ <ConsoleItemSummary item={prItem} isActive onSelect={() => {}} />,
40
+ );
41
+ expect(getByRole('button')).toHaveAttribute('data-active', 'true');
42
+ });
43
+ });
@@ -0,0 +1,34 @@
1
+ import type { ConsoleListItem } from '../../logic/types';
2
+ import { ConsoleItemIcon } from '../detail/ConsoleItemIcon';
3
+
4
+ export type ConsoleListItemRowProps = {
5
+ item: ConsoleListItem;
6
+ isActive: boolean;
7
+ onSelect: (item: ConsoleListItem) => void;
8
+ };
9
+
10
+ export const ConsoleItemSummary = ({
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
+ );
@@ -0,0 +1,27 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ConsoleStorySummary } from './ConsoleStorySummary';
3
+
4
+ const meta: Meta<typeof ConsoleStorySummary> = {
5
+ title: 'Console/ConsoleStorySummary',
6
+ component: ConsoleStorySummary,
7
+ };
8
+
9
+ export default meta;
10
+
11
+ type Story = StoryObj<typeof ConsoleStorySummary>;
12
+
13
+ export const ConsolePortStory: Story = {
14
+ args: { story: 'TDPM Console port', count: 4, colorEnum: 'BLUE' },
15
+ };
16
+
17
+ export const RegularWorkflowStory: Story = {
18
+ args: {
19
+ story: 'regular / workflow improvement',
20
+ count: 12,
21
+ colorEnum: 'GRAY',
22
+ },
23
+ };
24
+
25
+ export const NoStory: Story = {
26
+ args: { story: '(No story)', count: 3, colorEnum: null },
27
+ };
@@ -0,0 +1,24 @@
1
+ import { render } from '@testing-library/react';
2
+ import { ConsoleStorySummary } from './ConsoleStorySummary';
3
+
4
+ describe('ConsoleStorySummary', () => {
5
+ it('renders the story name and count', () => {
6
+ const { getByText } = render(
7
+ <ConsoleStorySummary
8
+ story="TDPM Console port"
9
+ count={4}
10
+ colorEnum="BLUE"
11
+ />,
12
+ );
13
+ expect(getByText('TDPM Console port')).toBeInTheDocument();
14
+ expect(getByText('4')).toBeInTheDocument();
15
+ });
16
+
17
+ it('applies the dot color from the enum', () => {
18
+ const { container } = render(
19
+ <ConsoleStorySummary story="s" count={1} colorEnum="GREEN" />,
20
+ );
21
+ const dot = container.querySelector('.console-story-dot');
22
+ expect(dot).toHaveStyle({ backgroundColor: '#3fb950' });
23
+ });
24
+ });
@@ -0,0 +1,28 @@
1
+ import { colorFromEnum } from '../../logic/colors';
2
+ import type { ConsoleColor } from '../../logic/types';
3
+
4
+ export type ConsoleStoryGroupHeaderProps = {
5
+ story: string;
6
+ count: number;
7
+ colorEnum: ConsoleColor | null;
8
+ };
9
+
10
+ export const ConsoleStorySummary = ({
11
+ story,
12
+ count,
13
+ colorEnum,
14
+ }: ConsoleStoryGroupHeaderProps) => {
15
+ const palette = colorFromEnum(colorEnum);
16
+ return (
17
+ <div className="console-group-header">
18
+ <span className="console-storytag">
19
+ <span
20
+ className="console-story-dot"
21
+ style={{ backgroundColor: palette.dot }}
22
+ />
23
+ {story}
24
+ </span>
25
+ <span className="console-group-count">{count}</span>
26
+ </div>
27
+ );
28
+ };
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ConsoleCloseActions } from './ConsoleCloseActions';
3
+
4
+ const meta: Meta<typeof ConsoleCloseActions> = {
5
+ title: 'Console/ConsoleCloseActions',
6
+ component: ConsoleCloseActions,
7
+ args: { onClose: () => {} },
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof ConsoleCloseActions>;
13
+
14
+ export const Default: Story = {};
@@ -0,0 +1,21 @@
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import { ConsoleCloseActions } from './ConsoleCloseActions';
3
+
4
+ describe('ConsoleCloseActions', () => {
5
+ it('renders both close buttons', () => {
6
+ const { getByText } = render(<ConsoleCloseActions onClose={() => {}} />);
7
+ expect(getByText('Close')).toBeInTheDocument();
8
+ expect(getByText('Close as not planned')).toBeInTheDocument();
9
+ });
10
+
11
+ it('reports the close actions', () => {
12
+ const onClose = jest.fn();
13
+ const { getByText } = render(<ConsoleCloseActions onClose={onClose} />);
14
+ fireEvent.click(getByText('Close'));
15
+ fireEvent.click(getByText('Close as not planned'));
16
+ expect(onClose.mock.calls.map((call) => call[0])).toEqual([
17
+ 'close',
18
+ 'close_not_planned',
19
+ ]);
20
+ });
21
+ });
@@ -0,0 +1,26 @@
1
+ import type { ConsoleCloseAction } from '../../logic/operations';
2
+
3
+ export type ConsoleCloseButtonGroupProps = {
4
+ onClose: (action: ConsoleCloseAction) => void;
5
+ };
6
+
7
+ export const ConsoleCloseActions = ({
8
+ onClose,
9
+ }: ConsoleCloseButtonGroupProps) => (
10
+ <div className="console-op-group">
11
+ <button
12
+ type="button"
13
+ className="console-op-button"
14
+ onClick={() => onClose('close')}
15
+ >
16
+ Close
17
+ </button>
18
+ <button
19
+ type="button"
20
+ className="console-op-button"
21
+ onClick={() => onClose('close_not_planned')}
22
+ >
23
+ Close as not planned
24
+ </button>
25
+ </div>
26
+ );
@@ -0,0 +1,20 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ConsoleNextActionDateActions } from './ConsoleNextActionDateActions';
3
+
4
+ const meta: Meta<typeof ConsoleNextActionDateActions> = {
5
+ title: 'Console/ConsoleNextActionDateActions',
6
+ component: ConsoleNextActionDateActions,
7
+ args: { onSetNextActionDate: () => {} },
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof ConsoleNextActionDateActions>;
13
+
14
+ export const StandardTab: Story = {
15
+ args: { isTodoByHuman: false },
16
+ };
17
+
18
+ export const TodoByHumanTab: Story = {
19
+ args: { isTodoByHuman: true },
20
+ };
@@ -0,0 +1,42 @@
1
+ import { fireEvent, render } from '@testing-library/react';
2
+ import { ConsoleNextActionDateActions } from './ConsoleNextActionDateActions';
3
+
4
+ describe('ConsoleNextActionDateActions', () => {
5
+ it('shows +1 day and +1 week outside the todo-by-human tab', () => {
6
+ const { getByText, queryByText } = render(
7
+ <ConsoleNextActionDateActions
8
+ isTodoByHuman={false}
9
+ onSetNextActionDate={() => {}}
10
+ />,
11
+ );
12
+ expect(getByText('+1 day')).toBeInTheDocument();
13
+ expect(getByText('+1 week')).toBeInTheDocument();
14
+ expect(queryByText('+1 week and skip')).toBeNull();
15
+ });
16
+
17
+ it('shows +1 week and skip on the todo-by-human tab', () => {
18
+ const { getByText } = render(
19
+ <ConsoleNextActionDateActions
20
+ isTodoByHuman
21
+ onSetNextActionDate={() => {}}
22
+ />,
23
+ );
24
+ expect(getByText('+1 week and skip')).toBeInTheDocument();
25
+ });
26
+
27
+ it('reports the snooze actions', () => {
28
+ const onSetNextActionDate = jest.fn();
29
+ const { getByText } = render(
30
+ <ConsoleNextActionDateActions
31
+ isTodoByHuman={false}
32
+ onSetNextActionDate={onSetNextActionDate}
33
+ />,
34
+ );
35
+ fireEvent.click(getByText('+1 day'));
36
+ fireEvent.click(getByText('+1 week'));
37
+ expect(onSetNextActionDate.mock.calls.map((call) => call[0])).toEqual([
38
+ 'snooze_1day',
39
+ 'snooze_1week',
40
+ ]);
41
+ });
42
+ });
@@ -0,0 +1,28 @@
1
+ import type { ConsoleNextActionDateAction } from '../../logic/operations';
2
+
3
+ export type ConsoleNextActionDateGroupProps = {
4
+ isTodoByHuman: boolean;
5
+ onSetNextActionDate: (action: ConsoleNextActionDateAction) => void;
6
+ };
7
+
8
+ export const ConsoleNextActionDateActions = ({
9
+ isTodoByHuman,
10
+ onSetNextActionDate,
11
+ }: ConsoleNextActionDateGroupProps) => (
12
+ <div className="console-op-group">
13
+ <button
14
+ type="button"
15
+ className="console-op-button"
16
+ onClick={() => onSetNextActionDate('snooze_1day')}
17
+ >
18
+ +1 day
19
+ </button>
20
+ <button
21
+ type="button"
22
+ className="console-op-button"
23
+ onClick={() => onSetNextActionDate('snooze_1week')}
24
+ >
25
+ {isTodoByHuman ? '+1 week and skip' : '+1 week'}
26
+ </button>
27
+ </div>
28
+ );
@@ -0,0 +1,55 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import type { ConsoleOperationHandlers } from '../../logic/operations';
3
+ import {
4
+ consoleListItemsFixture,
5
+ consoleStatusOptionsFixture,
6
+ consoleStoryOptionsFixture,
7
+ } from '../../testing/fixtures';
8
+ import { ConsoleOperationMenu } from './ConsoleOperationMenu';
9
+
10
+ const handlers: ConsoleOperationHandlers = {
11
+ onReview: () => {},
12
+ onSetNextActionDate: () => {},
13
+ onSetStory: () => {},
14
+ onSetStatus: () => {},
15
+ onSetInTmuxByHuman: () => {},
16
+ onClose: () => {},
17
+ };
18
+
19
+ const meta: Meta<typeof ConsoleOperationMenu> = {
20
+ title: 'Console/ConsoleOperationMenu',
21
+ component: ConsoleOperationMenu,
22
+ args: {
23
+ statusOptions: consoleStatusOptionsFixture,
24
+ storyOptions: consoleStoryOptionsFixture,
25
+ handlers,
26
+ },
27
+ };
28
+
29
+ export default meta;
30
+
31
+ type Story = StoryObj<typeof ConsoleOperationMenu>;
32
+
33
+ export const PrsTabPullRequest: Story = {
34
+ args: {
35
+ tab: 'prs',
36
+ item: consoleListItemsFixture[0],
37
+ hasPullRequest: true,
38
+ },
39
+ };
40
+
41
+ export const TriageTabIssueWithStoryGroup: Story = {
42
+ args: {
43
+ tab: 'triage',
44
+ item: consoleListItemsFixture[2],
45
+ hasPullRequest: false,
46
+ },
47
+ };
48
+
49
+ export const TodoByHumanTabIssue: Story = {
50
+ args: {
51
+ tab: 'todo-by-human',
52
+ item: consoleListItemsFixture[2],
53
+ hasPullRequest: false,
54
+ },
55
+ };