Skip to content

Commit 2af28bf

Browse files
authored
feat(view): mcp tool 연동용 storyline chart (#924)
* refactor: 불필요한 차트 ui 제거 및 lint 에러 수정 * feat(newviz): storyline chart 간소화 및 mcp tool 연동을 위한 ui 템플릿 리팩토링
1 parent 80531cd commit 2af28bf

9 files changed

Lines changed: 418 additions & 1164 deletions

packages/view/src/App.tsx

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ import { useEffect, useRef, useState } from "react";
44
import BounceLoader from "react-spinners/BounceLoader";
55

66
import MonoLogo from "assets/monoLogo.svg";
7-
import { BranchSelector, Statistics, TemporalFilter, ThemeSelector, VerticalClusterList, FolderActivityFlow } from "components";
7+
import {
8+
BranchSelector,
9+
Statistics,
10+
TemporalFilter,
11+
ThemeSelector,
12+
VerticalClusterList,
13+
FolderActivityFlow,
14+
} from "components";
815
import "./App.scss";
916
import type IDEPort from "ide/IDEPort";
1017
import { useAnalayzedData } from "hooks";
@@ -13,6 +20,12 @@ import type { IDESentEvents } from "types/IDESentEvents";
1320
import { useBranchStore, useDataStore, useGithubInfo, useLoadingStore, useThemeStore } from "store";
1421
import { THEME_INFO } from "components/ThemeSelector/ThemeSelector.const";
1522
import { NetworkGraph } from "components/NetworkGraph";
23+
import {
24+
analyzeReleaseBasedFolders,
25+
extractReleaseBasedContributorActivities,
26+
findFirstReleaseContributorNodes,
27+
generateReleaseFlowLineData,
28+
} from "components/FolderActivityFlow/FolderActivityFlow.util";
1629

1730
const App = () => {
1831
const initRef = useRef<boolean>(false);
@@ -23,6 +36,7 @@ const App = () => {
2336
const { handleGithubInfo } = useGithubInfo();
2437
const { loading, setLoading } = useLoadingStore();
2538
const { theme } = useThemeStore();
39+
const totalData = useDataStore((state) => state.data);
2640
const ideAdapter = container.resolve<IDEPort>("IDEAdapter");
2741

2842
const handleOpenFolderActivityFlowModal = () => {
@@ -33,6 +47,14 @@ const App = () => {
3347
setShowFolderActivityFlowModal(false);
3448
};
3549

50+
// storyline chart
51+
const flatData = totalData.flat();
52+
const releaseResult = analyzeReleaseBasedFolders(flatData, 8, 1);
53+
const { releaseGroups, topFolderPaths: releaseTopFolderPaths } = releaseResult;
54+
const releaseContributorActivities = extractReleaseBasedContributorActivities(flatData, releaseTopFolderPaths, 1);
55+
const flowLineData = generateReleaseFlowLineData(releaseContributorActivities);
56+
const firstNodesByContributor = findFirstReleaseContributorNodes(releaseContributorActivities);
57+
3658
useEffect(() => {
3759
if (initRef.current === false) {
3860
const callbacks: IDESentEvents = {
@@ -73,6 +95,7 @@ const App = () => {
7395
<button
7496
className="folder-activity-flow-button"
7597
onClick={handleOpenFolderActivityFlowModal}
98+
type="button"
7699
>
77100
Folder Activity Flow
78101
</button>
@@ -100,19 +123,32 @@ const App = () => {
100123
{showFolderActivityFlowModal && (
101124
<div
102125
className="folder-activity-flow-modal"
103-
onClick={handleCloseFolderActivityFlowModal}
126+
onClick={(e) => {
127+
if (e.target === e.currentTarget) {
128+
handleCloseFolderActivityFlowModal();
129+
}
130+
}}
131+
onKeyDown={(e) => e.key === "Escape" && handleCloseFolderActivityFlowModal()}
132+
role="button"
133+
tabIndex={0}
134+
aria-label="Close modal"
104135
>
105-
<div
106-
className="folder-activity-flow-modal-content"
107-
onClick={(e) => e.stopPropagation()}
108-
>
136+
<div className="folder-activity-flow-modal-content">
109137
<button
110138
className="folder-activity-flow-modal-close"
111139
onClick={handleCloseFolderActivityFlowModal}
140+
type="button"
141+
aria-label="Close modal"
112142
>
113143
×
114144
</button>
115-
<FolderActivityFlow />
145+
<FolderActivityFlow
146+
releaseGroups={releaseGroups}
147+
releaseTopFolderPaths={releaseTopFolderPaths}
148+
flowLineData={flowLineData}
149+
releaseContributorActivities={releaseContributorActivities}
150+
firstNodesByContributor={firstNodesByContributor}
151+
/>
116152
</div>
117153
</div>
118154
)}

packages/view/src/components/FolderActivityFlow/FolderActivityFlow.analyzer.ts

Lines changed: 0 additions & 86 deletions
This file was deleted.

packages/view/src/components/FolderActivityFlow/FolderActivityFlow.const.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)