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.
- package/CHANGELOG.md +15 -0
- package/README.md +19 -5
- package/bin/adapter/entry-points/cli/index.js +17 -13
- 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 +3 -4
- 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/entry-points/handlers/consoleListsWriter.js +1 -0
- package/bin/adapter/entry-points/handlers/consoleListsWriter.js.map +1 -1
- package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +16 -0
- package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
- package/bin/domain/usecases/console/GenerateConsoleListsUseCase.js +3 -0
- package/bin/domain/usecases/console/GenerateConsoleListsUseCase.js.map +1 -1
- package/jest.config.js +57 -9
- package/package.json +17 -13
- package/src/adapter/entry-points/cli/index.test.ts +18 -3
- package/src/adapter/entry-points/cli/index.ts +32 -14
- 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 +5 -4
- package/src/adapter/entry-points/console/consoleServer.ts +5 -7
- 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/components/content/ConsoleMarkdownContent.stories.tsx +27 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMarkdownContent.test.tsx +36 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMarkdownContent.tsx +50 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.stories.tsx +22 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.test.tsx +38 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/content/ConsoleMermaidDiagram.tsx +65 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.stories.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.test.tsx +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleChangedFileList.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.stories.tsx +29 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.test.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommentList.tsx +66 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.stories.tsx +25 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.test.tsx +53 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleCommitList.tsx +53 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.stories.tsx +79 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.test.tsx +81 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemDetail.tsx +229 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.stories.tsx +82 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.test.tsx +52 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsoleItemIcon.tsx +32 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.stories.tsx +31 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.test.tsx +40 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/detail/ConsolePullRequestDetail.tsx +88 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.stories.tsx +26 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.test.tsx +32 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsolePanel.tsx +36 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/{ConsoleProjectHeader.stories.tsx → layout/ConsoleProjectSummary.stories.tsx} +5 -5
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleProjectSummary.test.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/{ConsoleProjectHeader.tsx → layout/ConsoleProjectSummary.tsx} +3 -1
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.stories.tsx +70 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.test.tsx +59 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/layout/ConsoleTabList.tsx +41 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.stories.tsx +60 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.test.tsx +87 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemList.tsx +68 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.stories.tsx +25 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.test.tsx +43 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleItemSummary.tsx +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.stories.tsx +27 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.test.tsx +24 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/list/ConsoleStorySummary.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.stories.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.test.tsx +21 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleCloseActions.tsx +26 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.stories.tsx +20 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.test.tsx +42 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleNextActionDateActions.tsx +28 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.stories.tsx +55 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.test.tsx +85 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleOperationMenu.tsx +58 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.stories.tsx +14 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.test.tsx +33 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsolePullRequestReviewActions.tsx +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.stories.tsx +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.test.tsx +49 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStatusActions.tsx +66 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.stories.tsx +17 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.test.tsx +39 -0
- package/src/adapter/entry-points/console/ui/src/features/console/components/operations/ConsoleStoryActions.tsx +42 -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/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/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/logic/colors.test.ts +34 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/colors.ts +73 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/fileStatus.test.ts +35 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/fileStatus.ts +21 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/grouping.test.ts +91 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/grouping.ts +79 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/itemIcons.test.ts +97 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/itemIcons.ts +95 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/operations.test.ts +37 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/operations.ts +35 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/overlay.test.ts +124 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/overlay.ts +101 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/relativeTime.test.ts +52 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/relativeTime.ts +51 -0
- package/src/adapter/entry-points/console/ui/src/features/console/logic/types.ts +141 -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 -11
- package/src/adapter/entry-points/console/ui/src/features/console/testing/fixtures.ts +244 -0
- package/src/adapter/entry-points/console/ui/src/index.css +352 -2
- package/src/adapter/entry-points/console/ui/tsconfig.json +1 -0
- package/src/adapter/entry-points/console/ui/vite.config.ts +5 -0
- package/src/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
- package/src/adapter/entry-points/console/ui-dist/assets/index-PtVrAcBb.js +100 -0
- package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
- package/src/adapter/entry-points/handlers/consoleListsWriter.test.ts +27 -2
- package/src/adapter/entry-points/handlers/consoleListsWriter.ts +1 -0
- package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.ts +25 -0
- package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +4 -0
- package/src/domain/usecases/console/GenerateConsoleListsUseCase.test.ts +26 -0
- package/src/domain/usecases/console/GenerateConsoleListsUseCase.ts +17 -1
- 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 +2 -3
- package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
- package/types/adapter/entry-points/handlers/consoleListsWriter.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/types/domain/usecases/console/GenerateConsoleListsUseCase.d.ts +2 -1
- package/types/domain/usecases/console/GenerateConsoleListsUseCase.d.ts.map +1 -1
- package/bin/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
- package/bin/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.stories.tsx +0 -44
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.tsx +0 -58
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.stories.tsx +0 -34
- package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.tsx +0 -32
- package/src/adapter/entry-points/console/ui/src/features/console/fixtures.ts +0 -47
- package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleList.ts +0 -78
- package/src/adapter/entry-points/console/ui/src/features/console/types.ts +0 -69
- package/src/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
- package/src/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { formatFullTimestamp, formatRelativeTime } from './relativeTime';
|
|
2
|
+
|
|
3
|
+
const now = Date.parse('2026-06-19T12:00:00.000Z');
|
|
4
|
+
|
|
5
|
+
describe('formatRelativeTime', () => {
|
|
6
|
+
it('returns just now for very recent times', () => {
|
|
7
|
+
expect(formatRelativeTime('2026-06-19T11:59:30.000Z', now)).toBe(
|
|
8
|
+
'just now',
|
|
9
|
+
);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('returns minutes ago', () => {
|
|
13
|
+
expect(formatRelativeTime('2026-06-19T11:45:00.000Z', now)).toBe(
|
|
14
|
+
'15 minutes ago',
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('uses singular for one minute', () => {
|
|
19
|
+
expect(formatRelativeTime('2026-06-19T11:59:00.000Z', now)).toBe(
|
|
20
|
+
'1 minute ago',
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns hours ago', () => {
|
|
25
|
+
expect(formatRelativeTime('2026-06-19T09:00:00.000Z', now)).toBe(
|
|
26
|
+
'3 hours ago',
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('returns yesterday for one day', () => {
|
|
31
|
+
expect(formatRelativeTime('2026-06-18T12:00:00.000Z', now)).toBe(
|
|
32
|
+
'yesterday',
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('returns days ago for under a month', () => {
|
|
37
|
+
expect(formatRelativeTime('2026-06-09T12:00:00.000Z', now)).toBe(
|
|
38
|
+
'10 days ago',
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('returns an empty string for an invalid date', () => {
|
|
43
|
+
expect(formatRelativeTime('nonsense', now)).toBe('');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('formatFullTimestamp', () => {
|
|
48
|
+
it('formats a timestamp and returns empty for invalid input', () => {
|
|
49
|
+
expect(formatFullTimestamp('2026-06-19T12:00:00.000Z')).not.toBe('');
|
|
50
|
+
expect(formatFullTimestamp('nonsense')).toBe('');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const MS_PER_SECOND = 1000;
|
|
2
|
+
const MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
|
3
|
+
const MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
4
|
+
const MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
5
|
+
|
|
6
|
+
export const formatRelativeTime = (iso: string, now: number): string => {
|
|
7
|
+
const then = Date.parse(iso);
|
|
8
|
+
if (Number.isNaN(then)) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
const diff = now - then;
|
|
12
|
+
if (diff < 45 * MS_PER_SECOND) {
|
|
13
|
+
return 'just now';
|
|
14
|
+
}
|
|
15
|
+
if (diff < MS_PER_HOUR) {
|
|
16
|
+
const minutes = Math.round(diff / MS_PER_MINUTE);
|
|
17
|
+
return `${minutes} minute${minutes === 1 ? '' : 's'} ago`;
|
|
18
|
+
}
|
|
19
|
+
if (diff < MS_PER_DAY) {
|
|
20
|
+
const hours = Math.round(diff / MS_PER_HOUR);
|
|
21
|
+
return `${hours} hour${hours === 1 ? '' : 's'} ago`;
|
|
22
|
+
}
|
|
23
|
+
const days = Math.round(diff / MS_PER_DAY);
|
|
24
|
+
if (days === 1) {
|
|
25
|
+
return 'yesterday';
|
|
26
|
+
}
|
|
27
|
+
if (days < 30) {
|
|
28
|
+
return `${days} days ago`;
|
|
29
|
+
}
|
|
30
|
+
const date = new Date(then);
|
|
31
|
+
const sameYear = date.getFullYear() === new Date(now).getFullYear();
|
|
32
|
+
return date.toLocaleDateString('en-US', {
|
|
33
|
+
year: sameYear ? undefined : 'numeric',
|
|
34
|
+
month: 'short',
|
|
35
|
+
day: 'numeric',
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const formatFullTimestamp = (iso: string): string => {
|
|
40
|
+
const then = Date.parse(iso);
|
|
41
|
+
if (Number.isNaN(then)) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
return new Date(then).toLocaleString('ja-JP', {
|
|
45
|
+
year: 'numeric',
|
|
46
|
+
month: '2-digit',
|
|
47
|
+
day: '2-digit',
|
|
48
|
+
hour: '2-digit',
|
|
49
|
+
minute: '2-digit',
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export type ConsoleColor =
|
|
2
|
+
| 'GRAY'
|
|
3
|
+
| 'BLUE'
|
|
4
|
+
| 'GREEN'
|
|
5
|
+
| 'YELLOW'
|
|
6
|
+
| 'ORANGE'
|
|
7
|
+
| 'RED'
|
|
8
|
+
| 'PINK'
|
|
9
|
+
| 'PURPLE';
|
|
10
|
+
|
|
11
|
+
export type ConsoleListItem = {
|
|
12
|
+
number: number;
|
|
13
|
+
title: string;
|
|
14
|
+
url: string;
|
|
15
|
+
repo: string;
|
|
16
|
+
nameWithOwner: string;
|
|
17
|
+
projectItemId: string;
|
|
18
|
+
itemId: string;
|
|
19
|
+
isPr: boolean;
|
|
20
|
+
story: string;
|
|
21
|
+
labels: string[];
|
|
22
|
+
createdAt: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type ConsoleFieldOption = {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
color: ConsoleColor;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type ConsoleStatusTab = {
|
|
32
|
+
pjcode: string;
|
|
33
|
+
generatedAt: string;
|
|
34
|
+
statusOptions: ConsoleFieldOption[];
|
|
35
|
+
storyOrder: string[];
|
|
36
|
+
storyColors: Record<string, { color: ConsoleColor }>;
|
|
37
|
+
items: ConsoleListItem[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type ConsoleTriageTab = {
|
|
41
|
+
pjcode: string;
|
|
42
|
+
generatedAt: string;
|
|
43
|
+
storyOptions: ConsoleFieldOption[];
|
|
44
|
+
storyOrder: string[];
|
|
45
|
+
storyColors: Record<string, ConsoleColor>;
|
|
46
|
+
items: ConsoleListItem[];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type ConsoleTabData = ConsoleStatusTab | ConsoleTriageTab;
|
|
50
|
+
|
|
51
|
+
export type ConsoleStoryColorSource = Record<
|
|
52
|
+
string,
|
|
53
|
+
ConsoleColor | { color: ConsoleColor }
|
|
54
|
+
>;
|
|
55
|
+
|
|
56
|
+
export type ConsoleIssueState = {
|
|
57
|
+
state: string;
|
|
58
|
+
merged: boolean;
|
|
59
|
+
isPullRequest: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type ConsoleComment = {
|
|
63
|
+
author: string;
|
|
64
|
+
body: string;
|
|
65
|
+
createdAt: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type ConsoleChangedFile = {
|
|
69
|
+
path: string;
|
|
70
|
+
additions: number;
|
|
71
|
+
deletions: number;
|
|
72
|
+
status: string;
|
|
73
|
+
patch: string | null;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export type ConsoleCommit = {
|
|
77
|
+
sha: string;
|
|
78
|
+
message: string;
|
|
79
|
+
author: string;
|
|
80
|
+
authoredAt: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type ConsoleRelatedPullRequest = {
|
|
84
|
+
url: string;
|
|
85
|
+
branchName: string | null;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
isDraft: boolean;
|
|
88
|
+
isConflicted: boolean;
|
|
89
|
+
isPassedAllCiJob: boolean;
|
|
90
|
+
isCiStateSuccess: boolean;
|
|
91
|
+
isResolvedAllReviewComments: boolean;
|
|
92
|
+
isBranchOutOfDate: boolean;
|
|
93
|
+
missingRequiredCheckNames: string[];
|
|
94
|
+
summary: {
|
|
95
|
+
title: string;
|
|
96
|
+
body: string;
|
|
97
|
+
additions: number;
|
|
98
|
+
deletions: number;
|
|
99
|
+
changedFiles: number;
|
|
100
|
+
} | null;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type ConsoleOverlayStatus = {
|
|
104
|
+
name: string;
|
|
105
|
+
color: ConsoleColor;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export type ConsoleOverlayStory = {
|
|
109
|
+
name: string;
|
|
110
|
+
color: ConsoleColor;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export type ConsoleOverlayEntry = {
|
|
114
|
+
done?: boolean;
|
|
115
|
+
status?: ConsoleOverlayStatus;
|
|
116
|
+
story?: ConsoleOverlayStory;
|
|
117
|
+
ts: number;
|
|
118
|
+
mode: ConsoleTabName;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type ConsoleOverlay = Record<string, ConsoleOverlayEntry>;
|
|
122
|
+
|
|
123
|
+
export type ConsoleTabName =
|
|
124
|
+
| 'prs'
|
|
125
|
+
| 'triage'
|
|
126
|
+
| 'unread'
|
|
127
|
+
| 'failed-preparation'
|
|
128
|
+
| 'todo-by-human';
|
|
129
|
+
|
|
130
|
+
export type ConsoleTab = {
|
|
131
|
+
name: ConsoleTabName;
|
|
132
|
+
label: string;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const CONSOLE_TABS: ConsoleTab[] = [
|
|
136
|
+
{ name: 'prs', label: 'Awaiting Quality Check' },
|
|
137
|
+
{ name: 'triage', label: 'Triage' },
|
|
138
|
+
{ name: 'unread', label: 'Unread' },
|
|
139
|
+
{ name: 'failed-preparation', label: 'Failed Preparation' },
|
|
140
|
+
{ name: 'todo-by-human', label: 'Todo by human' },
|
|
141
|
+
];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
2
|
+
import type { ConsoleCaches } from '../hooks/useConsoleCaches';
|
|
3
|
+
import type { ConsoleOperationsApi } from '../hooks/useConsoleOperations';
|
|
4
|
+
import { ResourceCache } from '../lib/resourceCache';
|
|
5
|
+
import {
|
|
6
|
+
consoleListItemsFixture,
|
|
7
|
+
consoleStatusOptionsFixture,
|
|
8
|
+
consoleStoryColorsFixture,
|
|
9
|
+
consoleStoryOptionsFixture,
|
|
10
|
+
} from '../testing/fixtures';
|
|
11
|
+
import { ConsoleItemDetailContainer } from './ConsoleItemDetailContainer';
|
|
12
|
+
|
|
13
|
+
jest.mock('../lib/mermaidLoader', () => ({
|
|
14
|
+
renderMermaidToSvg: jest.fn(async () => '<svg></svg>'),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const prItem = consoleListItemsFixture[0];
|
|
18
|
+
|
|
19
|
+
const buildCaches = (): ConsoleCaches => {
|
|
20
|
+
const client = {
|
|
21
|
+
fetchItemBody: async () => '# body',
|
|
22
|
+
fetchComments: async () => [],
|
|
23
|
+
fetchPrFiles: async () => [],
|
|
24
|
+
fetchPrCommits: async () => [],
|
|
25
|
+
fetchRelatedPrs: async () => [],
|
|
26
|
+
fetchIssueState: async () => ({
|
|
27
|
+
state: 'open',
|
|
28
|
+
merged: false,
|
|
29
|
+
isPullRequest: true,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
client,
|
|
34
|
+
body: new ResourceCache(client.fetchItemBody),
|
|
35
|
+
comments: new ResourceCache(client.fetchComments),
|
|
36
|
+
files: new ResourceCache(client.fetchPrFiles),
|
|
37
|
+
commits: new ResourceCache(client.fetchPrCommits),
|
|
38
|
+
relatedPrs: new ResourceCache(client.fetchRelatedPrs),
|
|
39
|
+
state: new ResourceCache(client.fetchIssueState),
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const buildOperations = (): ConsoleOperationsApi => ({
|
|
44
|
+
reviewPullRequest: jest.fn(async () => {}),
|
|
45
|
+
setNextActionDate: jest.fn(async () => {}),
|
|
46
|
+
setStory: jest.fn(async () => {}),
|
|
47
|
+
setStatus: jest.fn(async () => {}),
|
|
48
|
+
setInTmuxByHuman: jest.fn(async () => {}),
|
|
49
|
+
closeIssue: jest.fn(async () => {}),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('ConsoleItemDetailContainer', () => {
|
|
53
|
+
it('wires the review action to the operations api for a PR item', async () => {
|
|
54
|
+
const operations = buildOperations();
|
|
55
|
+
const { getByText } = render(
|
|
56
|
+
<ConsoleItemDetailContainer
|
|
57
|
+
tab="prs"
|
|
58
|
+
item={prItem}
|
|
59
|
+
caches={buildCaches()}
|
|
60
|
+
operations={operations}
|
|
61
|
+
statusOptions={consoleStatusOptionsFixture}
|
|
62
|
+
storyOptions={consoleStoryOptionsFixture}
|
|
63
|
+
storyColors={consoleStoryColorsFixture}
|
|
64
|
+
storyName="TDPM Console port"
|
|
65
|
+
overlayStatus={null}
|
|
66
|
+
now={Date.parse('2026-06-19T12:00:00.000Z')}
|
|
67
|
+
/>,
|
|
68
|
+
);
|
|
69
|
+
await waitFor(() => {
|
|
70
|
+
expect(getByText('Approve')).toBeInTheDocument();
|
|
71
|
+
});
|
|
72
|
+
fireEvent.click(getByText('Approve'));
|
|
73
|
+
expect(operations.reviewPullRequest).toHaveBeenCalledWith(
|
|
74
|
+
prItem,
|
|
75
|
+
prItem.url,
|
|
76
|
+
'approve',
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ConsoleItemDetail } from '../components/detail/ConsoleItemDetail';
|
|
2
|
+
import { ConsoleOperationMenu } from '../components/operations/ConsoleOperationMenu';
|
|
3
|
+
import type { ConsoleCaches } from '../hooks/useConsoleCaches';
|
|
4
|
+
import { useConsoleItemDetailData } from '../hooks/useConsoleItemDetailData';
|
|
5
|
+
import type { ConsoleOperationsApi } from '../hooks/useConsoleOperations';
|
|
6
|
+
import { resolveStoryColorEnum } from '../logic/grouping';
|
|
7
|
+
import type { ConsoleOperationHandlers } from '../logic/operations';
|
|
8
|
+
import type {
|
|
9
|
+
ConsoleColor,
|
|
10
|
+
ConsoleFieldOption,
|
|
11
|
+
ConsoleListItem,
|
|
12
|
+
ConsoleOverlayStatus,
|
|
13
|
+
ConsoleStoryColorSource,
|
|
14
|
+
ConsoleTabName,
|
|
15
|
+
} from '../logic/types';
|
|
16
|
+
|
|
17
|
+
export type ConsoleItemDetailContainerProps = {
|
|
18
|
+
tab: ConsoleTabName;
|
|
19
|
+
item: ConsoleListItem;
|
|
20
|
+
caches: ConsoleCaches;
|
|
21
|
+
operations: ConsoleOperationsApi;
|
|
22
|
+
statusOptions: ConsoleFieldOption[];
|
|
23
|
+
storyOptions: ConsoleFieldOption[];
|
|
24
|
+
storyColors: ConsoleStoryColorSource;
|
|
25
|
+
storyName: string | null;
|
|
26
|
+
overlayStatus: ConsoleOverlayStatus | null;
|
|
27
|
+
now: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const ConsoleItemDetailContainer = ({
|
|
31
|
+
tab,
|
|
32
|
+
item,
|
|
33
|
+
caches,
|
|
34
|
+
operations,
|
|
35
|
+
statusOptions,
|
|
36
|
+
storyOptions,
|
|
37
|
+
storyColors,
|
|
38
|
+
storyName,
|
|
39
|
+
overlayStatus,
|
|
40
|
+
now,
|
|
41
|
+
}: ConsoleItemDetailContainerProps) => {
|
|
42
|
+
const detail = useConsoleItemDetailData(caches, item);
|
|
43
|
+
const hasPullRequest = item.isPr || detail.relatedPullRequests.length > 0;
|
|
44
|
+
|
|
45
|
+
const handlers: ConsoleOperationHandlers = {
|
|
46
|
+
onReview: (action) => {
|
|
47
|
+
const prUrl = item.isPr
|
|
48
|
+
? item.url
|
|
49
|
+
: (detail.relatedPullRequests[0]?.pullRequest.url ?? item.url);
|
|
50
|
+
void operations.reviewPullRequest(item, prUrl, action);
|
|
51
|
+
},
|
|
52
|
+
onSetNextActionDate: (action) => {
|
|
53
|
+
void operations.setNextActionDate(item, action);
|
|
54
|
+
},
|
|
55
|
+
onSetStory: (option: ConsoleFieldOption) => {
|
|
56
|
+
void operations.setStory(item, option);
|
|
57
|
+
},
|
|
58
|
+
onSetStatus: (option: ConsoleFieldOption) => {
|
|
59
|
+
void operations.setStatus(item, option);
|
|
60
|
+
},
|
|
61
|
+
onSetInTmuxByHuman: (option: ConsoleFieldOption) => {
|
|
62
|
+
void operations.setInTmuxByHuman(item, option);
|
|
63
|
+
},
|
|
64
|
+
onClose: (action) => {
|
|
65
|
+
void operations.closeIssue(item, action);
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const resolvedStoryName =
|
|
70
|
+
storyName ?? (item.story.trim() !== '' ? item.story : null);
|
|
71
|
+
const storyColorEnum: ConsoleColor | null =
|
|
72
|
+
resolvedStoryName !== null
|
|
73
|
+
? resolveStoryColorEnum(storyColors, resolvedStoryName)
|
|
74
|
+
: null;
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<ConsoleItemDetail
|
|
78
|
+
item={item}
|
|
79
|
+
storyName={resolvedStoryName}
|
|
80
|
+
storyColorEnum={storyColorEnum}
|
|
81
|
+
overlayStatus={overlayStatus}
|
|
82
|
+
state={detail.state}
|
|
83
|
+
body={detail.body}
|
|
84
|
+
bodyIsLoading={detail.bodyIsLoading}
|
|
85
|
+
bodyError={detail.bodyError}
|
|
86
|
+
comments={detail.comments}
|
|
87
|
+
commentsAreLoading={detail.commentsAreLoading}
|
|
88
|
+
commentsError={detail.commentsError}
|
|
89
|
+
files={detail.files}
|
|
90
|
+
filesAreLoading={detail.filesAreLoading}
|
|
91
|
+
filesError={detail.filesError}
|
|
92
|
+
commits={detail.commits}
|
|
93
|
+
commitsAreLoading={detail.commitsAreLoading}
|
|
94
|
+
commitsError={detail.commitsError}
|
|
95
|
+
relatedPullRequests={detail.relatedPullRequests}
|
|
96
|
+
now={now}
|
|
97
|
+
operationBar={
|
|
98
|
+
<ConsoleOperationMenu
|
|
99
|
+
tab={tab}
|
|
100
|
+
item={item}
|
|
101
|
+
hasPullRequest={hasPullRequest}
|
|
102
|
+
statusOptions={statusOptions}
|
|
103
|
+
storyOptions={storyOptions}
|
|
104
|
+
handlers={handlers}
|
|
105
|
+
/>
|
|
106
|
+
}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { fireEvent, render, waitFor } from '@testing-library/react';
|
|
2
|
+
import { ConsolePage } from './ConsolePage';
|
|
3
|
+
|
|
4
|
+
jest.mock('../lib/mermaidLoader', () => ({
|
|
5
|
+
renderMermaidToSvg: jest.fn(async () => '<svg></svg>'),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
const listPayload = (tab: string) => ({
|
|
9
|
+
pjcode: 'umino',
|
|
10
|
+
generatedAt: '2026-06-19T00:00:00.000Z',
|
|
11
|
+
statusOptions: [{ id: 's1', name: 'Awaiting Workspace', color: 'BLUE' }],
|
|
12
|
+
storyOptions: [{ id: 'st1', name: 'TDPM Console port', color: 'BLUE' }],
|
|
13
|
+
storyColors: { 'TDPM Console port': { color: 'BLUE' } },
|
|
14
|
+
items:
|
|
15
|
+
tab === 'prs'
|
|
16
|
+
? [
|
|
17
|
+
{
|
|
18
|
+
number: 851,
|
|
19
|
+
title: 'Add serveConsole subcommand',
|
|
20
|
+
url: 'https://github.com/o/r/pull/851',
|
|
21
|
+
repo: 'o/r',
|
|
22
|
+
nameWithOwner: 'o/r',
|
|
23
|
+
projectItemId: 'PVTI_1',
|
|
24
|
+
itemId: 'PVTI_1',
|
|
25
|
+
isPr: true,
|
|
26
|
+
story: 'TDPM Console port',
|
|
27
|
+
labels: [],
|
|
28
|
+
createdAt: '2026-06-17T00:00:00.000Z',
|
|
29
|
+
},
|
|
30
|
+
]
|
|
31
|
+
: [],
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const installFetch = (): void => {
|
|
35
|
+
const fetchMock = jest.fn(async (url: string) => {
|
|
36
|
+
const listMatch = url.match(/\/projects\/[^/]+\/([^/]+)\/list\.json/);
|
|
37
|
+
if (listMatch !== null) {
|
|
38
|
+
return {
|
|
39
|
+
ok: true,
|
|
40
|
+
status: 200,
|
|
41
|
+
json: async () => listPayload(listMatch[1]),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return { ok: true, status: 200, json: async () => ({ body: '# body' }) };
|
|
45
|
+
});
|
|
46
|
+
global.fetch = fetchMock as unknown as typeof fetch;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
describe('ConsolePage', () => {
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
localStorage.clear();
|
|
52
|
+
window.history.replaceState({}, '', '/projects/umino/prs?k=token');
|
|
53
|
+
installFetch();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('renders the tab bar with the active tab and the story-grouped list', async () => {
|
|
57
|
+
const { getByText } = render(<ConsolePage />);
|
|
58
|
+
await waitFor(() => {
|
|
59
|
+
expect(getByText('Add serveConsole subcommand')).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
expect(getByText('Awaiting Quality Check')).toBeInTheDocument();
|
|
62
|
+
expect(getByText('TDPM Console port')).toBeInTheDocument();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('opens the detail view when an item is selected', async () => {
|
|
66
|
+
const { getByText, findByText } = render(<ConsolePage />);
|
|
67
|
+
await waitFor(() => {
|
|
68
|
+
expect(getByText('Add serveConsole subcommand')).toBeInTheDocument();
|
|
69
|
+
});
|
|
70
|
+
fireEvent.click(getByText('Add serveConsole subcommand'));
|
|
71
|
+
expect(await findByText('← Back to list')).toBeInTheDocument();
|
|
72
|
+
expect(getByText('Approve')).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -1,23 +1,149 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import { ConsoleProjectSummary } from '../components/layout/ConsoleProjectSummary';
|
|
3
|
+
import { ConsoleTabList } from '../components/layout/ConsoleTabList';
|
|
4
|
+
import { ConsoleItemList } from '../components/list/ConsoleItemList';
|
|
5
|
+
import { useConsoleCaches } from '../hooks/useConsoleCaches';
|
|
6
|
+
import { useConsoleOperations } from '../hooks/useConsoleOperations';
|
|
7
|
+
import { useConsoleOverlay } from '../hooks/useConsoleOverlay';
|
|
6
8
|
import { useConsolePjcode } from '../hooks/useConsolePjcode';
|
|
7
|
-
import {
|
|
9
|
+
import { useConsoleTabData } from '../hooks/useConsoleTabData';
|
|
10
|
+
import { buildConsoleListRows, resolveItemStory } from '../logic/grouping';
|
|
11
|
+
import {
|
|
12
|
+
countPendingItems,
|
|
13
|
+
filterPendingItems,
|
|
14
|
+
overlayKeyForItem,
|
|
15
|
+
parseGeneratedAtMs,
|
|
16
|
+
} from '../logic/overlay';
|
|
17
|
+
import type {
|
|
18
|
+
ConsoleListItem,
|
|
19
|
+
ConsoleOverlayStatus,
|
|
20
|
+
ConsoleTabName,
|
|
21
|
+
} from '../logic/types';
|
|
22
|
+
import { CONSOLE_TABS } from '../logic/types';
|
|
23
|
+
import { ConsoleItemDetailContainer } from './ConsoleItemDetailContainer';
|
|
24
|
+
|
|
25
|
+
const emptyCounts = (): Record<ConsoleTabName, number> => {
|
|
26
|
+
const result = {} as Record<ConsoleTabName, number>;
|
|
27
|
+
for (const tab of CONSOLE_TABS) {
|
|
28
|
+
result[tab.name] = 0;
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const OVERLAY_NAMESPACE_FALLBACK = 'console';
|
|
8
34
|
|
|
9
35
|
export const ConsolePage = () => {
|
|
10
36
|
const pjcode = useConsolePjcode();
|
|
37
|
+
const { snapshots, isLoading, error } = useConsoleTabData(pjcode);
|
|
11
38
|
const [activeTab, setActiveTab] = useState<ConsoleTabName>(
|
|
12
39
|
CONSOLE_TABS[0].name,
|
|
13
40
|
);
|
|
14
|
-
const
|
|
41
|
+
const [selectedItem, setSelectedItem] = useState<ConsoleListItem | null>(
|
|
42
|
+
null,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const overlayState = useConsoleOverlay(pjcode ?? OVERLAY_NAMESPACE_FALLBACK);
|
|
46
|
+
const caches = useConsoleCaches();
|
|
47
|
+
const operations = useConsoleOperations(pjcode, activeTab, overlayState);
|
|
48
|
+
const now = Date.now();
|
|
49
|
+
|
|
50
|
+
const counts = useMemo(() => {
|
|
51
|
+
const result = emptyCounts();
|
|
52
|
+
for (const tab of CONSOLE_TABS) {
|
|
53
|
+
const snapshot = snapshots[tab.name];
|
|
54
|
+
if (snapshot === null) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
result[tab.name] = countPendingItems(
|
|
58
|
+
snapshot.items,
|
|
59
|
+
overlayState.overlay,
|
|
60
|
+
parseGeneratedAtMs(snapshot.generatedAt),
|
|
61
|
+
tab.name,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}, [snapshots, overlayState.overlay]);
|
|
66
|
+
|
|
67
|
+
const activeSnapshot = snapshots[activeTab];
|
|
68
|
+
const pendingItems = useMemo(() => {
|
|
69
|
+
if (activeSnapshot === null) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
return filterPendingItems(
|
|
73
|
+
activeSnapshot.items,
|
|
74
|
+
overlayState.overlay,
|
|
75
|
+
parseGeneratedAtMs(activeSnapshot.generatedAt),
|
|
76
|
+
activeTab,
|
|
77
|
+
);
|
|
78
|
+
}, [activeSnapshot, overlayState.overlay, activeTab]);
|
|
79
|
+
|
|
80
|
+
const rows = useMemo(
|
|
81
|
+
() => buildConsoleListRows(pendingItems, overlayState.overlay),
|
|
82
|
+
[pendingItems, overlayState.overlay],
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const storyColors = activeSnapshot?.storyColors ?? {};
|
|
86
|
+
const statusOptions = activeSnapshot?.statusOptions ?? [];
|
|
87
|
+
const storyOptions = activeSnapshot?.storyOptions ?? [];
|
|
88
|
+
|
|
89
|
+
const selectTab = (tab: ConsoleTabName): void => {
|
|
90
|
+
setActiveTab(tab);
|
|
91
|
+
setSelectedItem(null);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const overlayStatusForSelected = ((): ConsoleOverlayStatus | null => {
|
|
95
|
+
if (selectedItem === null) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const entry = overlayState.overlay[overlayKeyForItem(selectedItem)];
|
|
99
|
+
return entry?.status ?? null;
|
|
100
|
+
})();
|
|
101
|
+
|
|
102
|
+
const storyNameForSelected =
|
|
103
|
+
selectedItem !== null
|
|
104
|
+
? resolveItemStory(selectedItem, overlayState.overlay)
|
|
105
|
+
: null;
|
|
15
106
|
|
|
16
107
|
return (
|
|
17
|
-
<main className="
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
|
|
108
|
+
<main className="console-app">
|
|
109
|
+
<ConsoleProjectSummary pjcode={pjcode} />
|
|
110
|
+
<ConsoleTabList
|
|
111
|
+
activeTab={activeTab}
|
|
112
|
+
counts={counts}
|
|
113
|
+
onSelectTab={selectTab}
|
|
114
|
+
/>
|
|
115
|
+
{selectedItem === null ? (
|
|
116
|
+
<ConsoleItemList
|
|
117
|
+
rows={rows}
|
|
118
|
+
storyColors={storyColors}
|
|
119
|
+
activeItemId={null}
|
|
120
|
+
isLoading={isLoading}
|
|
121
|
+
error={error}
|
|
122
|
+
onSelectItem={setSelectedItem}
|
|
123
|
+
/>
|
|
124
|
+
) : (
|
|
125
|
+
<div className="console-detail-screen">
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
className="console-back-button"
|
|
129
|
+
onClick={() => setSelectedItem(null)}
|
|
130
|
+
>
|
|
131
|
+
← Back to list
|
|
132
|
+
</button>
|
|
133
|
+
<ConsoleItemDetailContainer
|
|
134
|
+
tab={activeTab}
|
|
135
|
+
item={selectedItem}
|
|
136
|
+
caches={caches}
|
|
137
|
+
operations={operations}
|
|
138
|
+
statusOptions={statusOptions}
|
|
139
|
+
storyOptions={storyOptions}
|
|
140
|
+
storyColors={storyColors}
|
|
141
|
+
storyName={storyNameForSelected}
|
|
142
|
+
overlayStatus={overlayStatusForSelected}
|
|
143
|
+
now={now}
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
21
147
|
</main>
|
|
22
148
|
);
|
|
23
149
|
};
|