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.
- package/.github/CODEOWNERS +1 -2
- package/CHANGELOG.md +14 -0
- package/README.md +15 -2
- package/bin/adapter/entry-points/cli/index.js +16 -12
- package/bin/adapter/entry-points/cli/index.js.map +1 -1
- package/bin/adapter/entry-points/cli/projectConfig.js +2 -0
- package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
- package/bin/adapter/entry-points/console/consoleOperationApi.js +54 -27
- package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
- package/bin/adapter/entry-points/console/consoleProjectResolver.js +38 -0
- package/bin/adapter/entry-points/console/consoleProjectResolver.js.map +1 -0
- package/bin/adapter/entry-points/console/consoleServer.js +43 -17
- package/bin/adapter/entry-points/console/consoleServer.js.map +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
- package/bin/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
- package/bin/adapter/entry-points/console/ui-dist/index.html +2 -2
- package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +16 -0
- package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
- package/jest.config.js +57 -9
- package/package.json +17 -13
- package/src/adapter/entry-points/cli/index.test.ts +12 -2
- package/src/adapter/entry-points/cli/index.ts +30 -12
- package/src/adapter/entry-points/cli/projectConfig.ts +3 -0
- package/src/adapter/entry-points/console/consoleOperationApi.test.ts +129 -15
- package/src/adapter/entry-points/console/consoleOperationApi.ts +83 -28
- package/src/adapter/entry-points/console/consoleProjectResolver.test.ts +96 -0
- package/src/adapter/entry-points/console/consoleProjectResolver.ts +50 -0
- package/src/adapter/entry-points/console/consoleServer.test.ts +86 -4
- package/src/adapter/entry-points/console/consoleServer.ts +53 -23
- package/src/adapter/entry-points/console/ui/jest.setup.ts +1 -0
- package/src/adapter/entry-points/console/ui/jest.styleMock.js +1 -0
- package/src/adapter/entry-points/console/ui/src/features/console/colors.test.ts +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/colors.ts +73 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.stories.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.test.tsx +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.stories.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.test.tsx +23 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.tsx +26 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.stories.tsx +29 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.test.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.tsx +66 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.stories.tsx +25 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.test.tsx +53 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.tsx +53 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.stories.tsx +79 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.test.tsx +81 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.tsx +226 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.stories.tsx +82 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.test.tsx +52 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.tsx +32 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.stories.tsx +25 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.test.tsx +43 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.tsx +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.stories.tsx +22 -6
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.test.tsx +87 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.tsx +36 -32
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.stories.tsx +27 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.test.tsx +36 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.tsx +50 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.stories.tsx +22 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.test.tsx +38 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.tsx +65 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.stories.tsx +20 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.test.tsx +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.stories.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.test.tsx +85 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.stories.tsx +26 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.test.tsx +32 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.tsx +36 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.stories.tsx +29 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.test.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.stories.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.test.tsx +33 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.tsx +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.stories.tsx +31 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.test.tsx +40 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.tsx +88 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.stories.tsx +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.test.tsx +49 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.tsx +63 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.stories.tsx +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.test.tsx +45 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.tsx +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.stories.tsx +27 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.test.tsx +24 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.stories.tsx +41 -5
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.test.tsx +59 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.tsx +28 -19
- package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.test.ts +35 -0
- package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.ts +21 -0
- package/src/adapter/entry-points/console/ui/src/features/console/fixtures.ts +206 -9
- package/src/adapter/entry-points/console/ui/src/features/console/grouping.test.ts +91 -0
- package/src/adapter/entry-points/console/ui/src/features/console/grouping.ts +79 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.test.ts +22 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.ts +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.test.ts +126 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.ts +167 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +198 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.ts +243 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.test.ts +40 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.ts +71 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsolePjcode.test.ts +24 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsolePjcode.ts +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.test.ts +41 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.ts +57 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.test.ts +63 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.ts +129 -0
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleToken.test.ts +41 -0
- package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.test.ts +97 -0
- package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.ts +95 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.test.ts +155 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.ts +187 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.test.ts +76 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.ts +73 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.test.ts +27 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.ts +71 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.test.ts +56 -0
- package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.ts +51 -0
- package/src/adapter/entry-points/console/ui/src/features/console/operations.test.ts +37 -0
- package/src/adapter/entry-points/console/ui/src/features/console/operations.ts +35 -0
- package/src/adapter/entry-points/console/ui/src/features/console/overlay.test.ts +124 -0
- package/src/adapter/entry-points/console/ui/src/features/console/overlay.ts +101 -0
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +79 -0
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +109 -0
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.test.tsx +74 -0
- package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.tsx +137 -7
- package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.test.ts +52 -0
- package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.ts +51 -0
- package/src/adapter/entry-points/console/ui/src/features/console/types.ts +73 -1
- package/src/adapter/entry-points/console/ui/src/index.css +352 -2
- package/src/adapter/entry-points/console/ui/tsconfig.json +3 -1
- package/src/adapter/entry-points/console/ui/vite.config.ts +6 -1
- package/src/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
- package/src/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
- package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
- package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.ts +25 -0
- package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +4 -0
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
- package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
- package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts +6 -2
- package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
- package/types/adapter/entry-points/console/consoleProjectResolver.d.ts +6 -0
- package/types/adapter/entry-points/console/consoleProjectResolver.d.ts.map +1 -0
- package/types/adapter/entry-points/console/consoleServer.d.ts +3 -3
- package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
- package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts +1 -0
- package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts.map +1 -1
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +1 -0
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/index-DFxrSRH4.css +0 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/index-DcOZ02ON.js +0 -49
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleList.ts +0 -65
- package/src/adapter/entry-points/console/ui-dist/assets/index-DFxrSRH4.css +0 -1
- package/src/adapter/entry-points/console/ui-dist/assets/index-DcOZ02ON.js +0 -49
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
|
+
import { ConsoleCloseButtonGroup } from './ConsoleCloseButtonGroup';
|
|
3
|
+
|
|
4
|
+
describe('ConsoleCloseButtonGroup', () => {
|
|
5
|
+
it('renders both close buttons', () => {
|
|
6
|
+
const { getByText } = render(
|
|
7
|
+
<ConsoleCloseButtonGroup onClose={() => {}} />,
|
|
8
|
+
);
|
|
9
|
+
expect(getByText('Close')).toBeInTheDocument();
|
|
10
|
+
expect(getByText('Close as not planned')).toBeInTheDocument();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('reports the close actions', () => {
|
|
14
|
+
const onClose = jest.fn();
|
|
15
|
+
const { getByText } = render(<ConsoleCloseButtonGroup onClose={onClose} />);
|
|
16
|
+
fireEvent.click(getByText('Close'));
|
|
17
|
+
fireEvent.click(getByText('Close as not planned'));
|
|
18
|
+
expect(onClose.mock.calls.map((call) => call[0])).toEqual([
|
|
19
|
+
'close',
|
|
20
|
+
'close_not_planned',
|
|
21
|
+
]);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConsoleCloseAction } from '../operations';
|
|
2
|
+
|
|
3
|
+
export type ConsoleCloseButtonGroupProps = {
|
|
4
|
+
onClose: (action: ConsoleCloseAction) => void;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export const ConsoleCloseButtonGroup = ({
|
|
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,29 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { consoleCommentsFixture } from '../fixtures';
|
|
3
|
+
import { ConsoleCommentList } from './ConsoleCommentList';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ConsoleCommentList> = {
|
|
6
|
+
title: 'Console/ConsoleCommentList',
|
|
7
|
+
component: ConsoleCommentList,
|
|
8
|
+
args: { now: Date.parse('2026-06-19T12:00:00.000Z') },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof ConsoleCommentList>;
|
|
14
|
+
|
|
15
|
+
export const WithComments: Story = {
|
|
16
|
+
args: { comments: consoleCommentsFixture, isLoading: false, error: null },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Loading: Story = {
|
|
20
|
+
args: { comments: [], isLoading: true, error: null },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Empty: Story = {
|
|
24
|
+
args: { comments: [], isLoading: false, error: null },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const ErrorState: Story = {
|
|
28
|
+
args: { comments: [], isLoading: false, error: 'HTTP 500' },
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
2
|
+
import { consoleCommentsFixture } from '../fixtures';
|
|
3
|
+
import { ConsoleCommentList } from './ConsoleCommentList';
|
|
4
|
+
|
|
5
|
+
const now = Date.parse('2026-06-19T12:00:00.000Z');
|
|
6
|
+
|
|
7
|
+
describe('ConsoleCommentList', () => {
|
|
8
|
+
it('shows only the latest comment until expanded', () => {
|
|
9
|
+
const { getByText, queryByText } = render(
|
|
10
|
+
<ConsoleCommentList
|
|
11
|
+
comments={consoleCommentsFixture}
|
|
12
|
+
isLoading={false}
|
|
13
|
+
error={null}
|
|
14
|
+
now={now}
|
|
15
|
+
/>,
|
|
16
|
+
);
|
|
17
|
+
expect(
|
|
18
|
+
getByText(/Looks good now\. Approving once the rebase is green\./),
|
|
19
|
+
).toBeInTheDocument();
|
|
20
|
+
expect(queryByText(/Please split the token validation/)).toBeNull();
|
|
21
|
+
fireEvent.click(getByText('Show all 3'));
|
|
22
|
+
expect(getByText(/Please split the token validation/)).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('shows the loading state', () => {
|
|
26
|
+
const { getByText } = render(
|
|
27
|
+
<ConsoleCommentList comments={[]} isLoading error={null} now={now} />,
|
|
28
|
+
);
|
|
29
|
+
expect(getByText('Loading comments...')).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('shows the empty state', () => {
|
|
33
|
+
const { getByText } = render(
|
|
34
|
+
<ConsoleCommentList
|
|
35
|
+
comments={[]}
|
|
36
|
+
isLoading={false}
|
|
37
|
+
error={null}
|
|
38
|
+
now={now}
|
|
39
|
+
/>,
|
|
40
|
+
);
|
|
41
|
+
expect(getByText('No comments.')).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('shows the error state', () => {
|
|
45
|
+
const { getByRole } = render(
|
|
46
|
+
<ConsoleCommentList
|
|
47
|
+
comments={[]}
|
|
48
|
+
isLoading={false}
|
|
49
|
+
error="HTTP 500"
|
|
50
|
+
now={now}
|
|
51
|
+
/>,
|
|
52
|
+
);
|
|
53
|
+
expect(getByRole('alert')).toHaveTextContent('HTTP 500');
|
|
54
|
+
});
|
|
55
|
+
});
|
package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.tsx
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { formatRelativeTime } from '../relativeTime';
|
|
3
|
+
import type { ConsoleComment } from '../types';
|
|
4
|
+
import { ConsoleMarkdownView } from './ConsoleMarkdownView';
|
|
5
|
+
|
|
6
|
+
export type ConsoleCommentListProps = {
|
|
7
|
+
comments: ConsoleComment[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
error: string | null;
|
|
10
|
+
now: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ConsoleCommentList = ({
|
|
14
|
+
comments,
|
|
15
|
+
isLoading,
|
|
16
|
+
error,
|
|
17
|
+
now,
|
|
18
|
+
}: ConsoleCommentListProps) => {
|
|
19
|
+
const [showAll, setShowAll] = useState<boolean>(false);
|
|
20
|
+
|
|
21
|
+
if (error !== null) {
|
|
22
|
+
return (
|
|
23
|
+
<p role="alert" className="console-comment-error">
|
|
24
|
+
Failed to load comments: {error}
|
|
25
|
+
</p>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isLoading) {
|
|
30
|
+
return <p className="console-comment-loading">Loading comments...</p>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (comments.length === 0) {
|
|
34
|
+
return <p className="console-comment-empty">No comments.</p>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const visible = showAll ? comments : comments.slice(-1);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div className="console-comment-list">
|
|
41
|
+
{!showAll && comments.length > 1 && (
|
|
42
|
+
<button
|
|
43
|
+
type="button"
|
|
44
|
+
className="console-comment-show-all"
|
|
45
|
+
onClick={() => setShowAll(true)}
|
|
46
|
+
>
|
|
47
|
+
Show all {comments.length}
|
|
48
|
+
</button>
|
|
49
|
+
)}
|
|
50
|
+
{visible.map((comment) => (
|
|
51
|
+
<article
|
|
52
|
+
key={`${comment.author}:${comment.createdAt}:${comment.body}`}
|
|
53
|
+
className="console-comment"
|
|
54
|
+
>
|
|
55
|
+
<header className="console-comment-header">
|
|
56
|
+
<span className="console-comment-author">{comment.author}</span>
|
|
57
|
+
<span className="console-comment-time">
|
|
58
|
+
{formatRelativeTime(comment.createdAt, now)}
|
|
59
|
+
</span>
|
|
60
|
+
</header>
|
|
61
|
+
<ConsoleMarkdownView body={comment.body} />
|
|
62
|
+
</article>
|
|
63
|
+
))}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { consoleCommitsFixture } from '../fixtures';
|
|
3
|
+
import { ConsoleCommitList } from './ConsoleCommitList';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof ConsoleCommitList> = {
|
|
6
|
+
title: 'Console/ConsoleCommitList',
|
|
7
|
+
component: ConsoleCommitList,
|
|
8
|
+
args: { now: Date.parse('2026-06-19T12:00:00.000Z') },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof ConsoleCommitList>;
|
|
14
|
+
|
|
15
|
+
export const WithCommits: Story = {
|
|
16
|
+
args: { commits: consoleCommitsFixture, isLoading: false, error: null },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Loading: Story = {
|
|
20
|
+
args: { commits: [], isLoading: true, error: null },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Empty: Story = {
|
|
24
|
+
args: { commits: [], isLoading: false, error: null },
|
|
25
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { consoleCommitsFixture } from '../fixtures';
|
|
3
|
+
import { ConsoleCommitList } from './ConsoleCommitList';
|
|
4
|
+
|
|
5
|
+
const now = Date.parse('2026-06-19T12:00:00.000Z');
|
|
6
|
+
|
|
7
|
+
describe('ConsoleCommitList', () => {
|
|
8
|
+
it('renders the first message line, short sha and author', () => {
|
|
9
|
+
const { getByText } = render(
|
|
10
|
+
<ConsoleCommitList
|
|
11
|
+
commits={consoleCommitsFixture}
|
|
12
|
+
isLoading={false}
|
|
13
|
+
error={null}
|
|
14
|
+
now={now}
|
|
15
|
+
/>,
|
|
16
|
+
);
|
|
17
|
+
expect(
|
|
18
|
+
getByText('feat(console): add serveConsole subcommand and HTTP server'),
|
|
19
|
+
).toBeInTheDocument();
|
|
20
|
+
expect(getByText('4f9c2a1')).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('shows the loading state', () => {
|
|
24
|
+
const { getByText } = render(
|
|
25
|
+
<ConsoleCommitList commits={[]} isLoading error={null} now={now} />,
|
|
26
|
+
);
|
|
27
|
+
expect(getByText('Loading commits...')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('shows the empty state', () => {
|
|
31
|
+
const { getByText } = render(
|
|
32
|
+
<ConsoleCommitList
|
|
33
|
+
commits={[]}
|
|
34
|
+
isLoading={false}
|
|
35
|
+
error={null}
|
|
36
|
+
now={now}
|
|
37
|
+
/>,
|
|
38
|
+
);
|
|
39
|
+
expect(getByText('No commits.')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('shows the error state', () => {
|
|
43
|
+
const { getByRole } = render(
|
|
44
|
+
<ConsoleCommitList
|
|
45
|
+
commits={[]}
|
|
46
|
+
isLoading={false}
|
|
47
|
+
error="HTTP 500"
|
|
48
|
+
now={now}
|
|
49
|
+
/>,
|
|
50
|
+
);
|
|
51
|
+
expect(getByRole('alert')).toHaveTextContent('HTTP 500');
|
|
52
|
+
});
|
|
53
|
+
});
|
package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.tsx
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { formatRelativeTime } from '../relativeTime';
|
|
2
|
+
import type { ConsoleCommit } from '../types';
|
|
3
|
+
|
|
4
|
+
export type ConsoleCommitListProps = {
|
|
5
|
+
commits: ConsoleCommit[];
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
now: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const shortSha = (sha: string): string => sha.slice(0, 7);
|
|
12
|
+
|
|
13
|
+
const firstLine = (message: string): string => message.split('\n')[0];
|
|
14
|
+
|
|
15
|
+
export const ConsoleCommitList = ({
|
|
16
|
+
commits,
|
|
17
|
+
isLoading,
|
|
18
|
+
error,
|
|
19
|
+
now,
|
|
20
|
+
}: ConsoleCommitListProps) => {
|
|
21
|
+
if (error !== null) {
|
|
22
|
+
return (
|
|
23
|
+
<p role="alert" className="console-commits-error">
|
|
24
|
+
Failed to load commits: {error}
|
|
25
|
+
</p>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isLoading) {
|
|
30
|
+
return <p className="console-commits-loading">Loading commits...</p>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (commits.length === 0) {
|
|
34
|
+
return <p className="console-commits-empty">No commits.</p>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ul className="console-commits">
|
|
39
|
+
{commits.map((commit) => (
|
|
40
|
+
<li key={commit.sha} className="console-commit">
|
|
41
|
+
<span className="console-commit-message">
|
|
42
|
+
{firstLine(commit.message)}
|
|
43
|
+
</span>
|
|
44
|
+
<span className="console-commit-sha">{shortSha(commit.sha)}</span>
|
|
45
|
+
<span className="console-commit-author">{commit.author}</span>
|
|
46
|
+
<span className="console-commit-time">
|
|
47
|
+
{formatRelativeTime(commit.authoredAt, now)}
|
|
48
|
+
</span>
|
|
49
|
+
</li>
|
|
50
|
+
))}
|
|
51
|
+
</ul>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import {
|
|
3
|
+
consoleChangedFilesFixture,
|
|
4
|
+
consoleCommentsFixture,
|
|
5
|
+
consoleCommitsFixture,
|
|
6
|
+
consoleListItemsFixture,
|
|
7
|
+
consoleMermaidBodyFixture,
|
|
8
|
+
consoleRelatedPullRequestsFixture,
|
|
9
|
+
} from '../fixtures';
|
|
10
|
+
import { ConsoleItemDetail } from './ConsoleItemDetail';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof ConsoleItemDetail> = {
|
|
13
|
+
title: 'Console/ConsoleItemDetail',
|
|
14
|
+
component: ConsoleItemDetail,
|
|
15
|
+
args: {
|
|
16
|
+
now: Date.parse('2026-06-19T12:00:00.000Z'),
|
|
17
|
+
operationBar: null,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default meta;
|
|
22
|
+
|
|
23
|
+
type Story = StoryObj<typeof ConsoleItemDetail>;
|
|
24
|
+
|
|
25
|
+
export const PullRequestItem: Story = {
|
|
26
|
+
args: {
|
|
27
|
+
item: consoleListItemsFixture[0],
|
|
28
|
+
storyName: 'TDPM Console port',
|
|
29
|
+
storyColorEnum: 'BLUE',
|
|
30
|
+
overlayStatus: null,
|
|
31
|
+
state: { state: 'open', merged: false, isPullRequest: true },
|
|
32
|
+
body: consoleMermaidBodyFixture,
|
|
33
|
+
bodyIsLoading: false,
|
|
34
|
+
bodyError: null,
|
|
35
|
+
comments: consoleCommentsFixture,
|
|
36
|
+
commentsAreLoading: false,
|
|
37
|
+
commentsError: null,
|
|
38
|
+
files: consoleChangedFilesFixture,
|
|
39
|
+
filesAreLoading: false,
|
|
40
|
+
filesError: null,
|
|
41
|
+
commits: consoleCommitsFixture,
|
|
42
|
+
commitsAreLoading: false,
|
|
43
|
+
commitsError: null,
|
|
44
|
+
relatedPullRequests: [],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const IssueWithLinkedPullRequest: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
item: consoleListItemsFixture[2],
|
|
51
|
+
storyName: 'TDPM Console port',
|
|
52
|
+
storyColorEnum: 'BLUE',
|
|
53
|
+
overlayStatus: null,
|
|
54
|
+
state: { state: 'open', merged: false, isPullRequest: false },
|
|
55
|
+
body: '## Issue body\n\nThis issue has a linked pull request.',
|
|
56
|
+
bodyIsLoading: false,
|
|
57
|
+
bodyError: null,
|
|
58
|
+
comments: consoleCommentsFixture,
|
|
59
|
+
commentsAreLoading: false,
|
|
60
|
+
commentsError: null,
|
|
61
|
+
files: [],
|
|
62
|
+
filesAreLoading: false,
|
|
63
|
+
filesError: null,
|
|
64
|
+
commits: [],
|
|
65
|
+
commitsAreLoading: false,
|
|
66
|
+
commitsError: null,
|
|
67
|
+
relatedPullRequests: [
|
|
68
|
+
{
|
|
69
|
+
pullRequest: consoleRelatedPullRequestsFixture[0],
|
|
70
|
+
files: consoleChangedFilesFixture,
|
|
71
|
+
filesAreLoading: false,
|
|
72
|
+
filesError: null,
|
|
73
|
+
commits: consoleCommitsFixture,
|
|
74
|
+
commitsAreLoading: false,
|
|
75
|
+
commitsError: null,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import {
|
|
3
|
+
consoleChangedFilesFixture,
|
|
4
|
+
consoleCommentsFixture,
|
|
5
|
+
consoleCommitsFixture,
|
|
6
|
+
consoleListItemsFixture,
|
|
7
|
+
} from '../fixtures';
|
|
8
|
+
import { ConsoleItemDetail } from './ConsoleItemDetail';
|
|
9
|
+
|
|
10
|
+
jest.mock('../lib/mermaidLoader', () => ({
|
|
11
|
+
renderMermaidToSvg: jest.fn(async () => '<svg></svg>'),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const now = Date.parse('2026-06-19T12:00:00.000Z');
|
|
15
|
+
const prItem = consoleListItemsFixture[0];
|
|
16
|
+
const issueItem = consoleListItemsFixture[2];
|
|
17
|
+
|
|
18
|
+
const baseProps = {
|
|
19
|
+
storyName: 'TDPM Console port',
|
|
20
|
+
storyColorEnum: 'BLUE' as const,
|
|
21
|
+
overlayStatus: null,
|
|
22
|
+
state: { state: 'open', merged: false, isPullRequest: true },
|
|
23
|
+
body: '## Body heading',
|
|
24
|
+
bodyIsLoading: false,
|
|
25
|
+
bodyError: null,
|
|
26
|
+
comments: consoleCommentsFixture,
|
|
27
|
+
commentsAreLoading: false,
|
|
28
|
+
commentsError: null,
|
|
29
|
+
files: consoleChangedFilesFixture,
|
|
30
|
+
filesAreLoading: false,
|
|
31
|
+
filesError: null,
|
|
32
|
+
commits: consoleCommitsFixture,
|
|
33
|
+
commitsAreLoading: false,
|
|
34
|
+
commitsError: null,
|
|
35
|
+
relatedPullRequests: [],
|
|
36
|
+
now,
|
|
37
|
+
operationBar: <div>operation-bar</div>,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
describe('ConsoleItemDetail', () => {
|
|
41
|
+
it('renders the PR title with the PR number, sub bar and changed files panel', () => {
|
|
42
|
+
const { getByText, getAllByText } = render(
|
|
43
|
+
<ConsoleItemDetail item={prItem} {...baseProps} />,
|
|
44
|
+
);
|
|
45
|
+
expect(getAllByText(`PR #${prItem.number}`).length).toBeGreaterThan(0);
|
|
46
|
+
expect(getByText('Changed files')).toBeInTheDocument();
|
|
47
|
+
expect(getByText('Commits')).toBeInTheDocument();
|
|
48
|
+
expect(getByText('operation-bar')).toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('renders the story tag and opened relative time', () => {
|
|
52
|
+
const { getByText } = render(
|
|
53
|
+
<ConsoleItemDetail item={prItem} {...baseProps} />,
|
|
54
|
+
);
|
|
55
|
+
expect(getByText('TDPM Console port')).toBeInTheDocument();
|
|
56
|
+
expect(getByText(/opened/)).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('renders an issue without the changed files or commits panels', () => {
|
|
60
|
+
const { queryByText } = render(
|
|
61
|
+
<ConsoleItemDetail
|
|
62
|
+
item={issueItem}
|
|
63
|
+
{...baseProps}
|
|
64
|
+
state={{ state: 'open', merged: false, isPullRequest: false }}
|
|
65
|
+
/>,
|
|
66
|
+
);
|
|
67
|
+
expect(queryByText('Changed files')).toBeNull();
|
|
68
|
+
expect(queryByText('Commits')).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('renders the overlay status chip when set', () => {
|
|
72
|
+
const { getByText } = render(
|
|
73
|
+
<ConsoleItemDetail
|
|
74
|
+
item={issueItem}
|
|
75
|
+
{...baseProps}
|
|
76
|
+
overlayStatus={{ name: 'Awaiting Workspace', color: 'BLUE' }}
|
|
77
|
+
/>,
|
|
78
|
+
);
|
|
79
|
+
expect(getByText('Awaiting Workspace')).toBeInTheDocument();
|
|
80
|
+
});
|
|
81
|
+
});
|