Skip to content

Commit ae15287

Browse files
authored
refactor: cluster mode 제거 및 코드 포맷팅·린팅 수정 (#946)
* refactor: lint 에러 수정 * refactor: cluster mode 삭제 * refactor: 유틸 함수 이동 및 NavigationStrategy 파일 삭제
1 parent 3071cf3 commit ae15287

10 files changed

Lines changed: 189 additions & 313 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const DIMENSIONS = {
22
width: 800,
33
height: 400,
4-
margin: { top: 40, right: 120, bottom: 60, left: 20 }
5-
};
4+
margin: { top: 40, right: 120, bottom: 60, left: 20 },
5+
};

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ClusterNode } from "types";
2+
23
import type { FolderActivity } from "./FolderActivityFlow.analyzer";
34

45
/**
@@ -19,18 +20,18 @@ export function getSubFolders(totalData: ClusterNode[], parentPath: string): Fol
1920

2021
const subFolderStats = new Map<string, FolderActivity>();
2122

22-
totalData.forEach(cluster => {
23-
cluster.commitNodeList.forEach(commitNode => {
24-
const commit = commitNode.commit;
23+
totalData.forEach((cluster) => {
24+
cluster.commitNodeList.forEach((commitNode) => {
25+
const { commit } = commitNode;
2526

2627
Object.entries(commit.diffStatistics.files)
27-
.filter(([filePath]) => parentPath === "" || filePath.startsWith(parentPath + "/"))
28+
.filter(([filePath]) => parentPath === "" || filePath.startsWith(`${parentPath}/`))
2829
.forEach(([filePath, stats]) => {
2930
const relativePath = parentPath === "" ? filePath : filePath.substring(parentPath.length + 1);
30-
const pathParts = relativePath.split('/');
31+
const pathParts = relativePath.split("/");
3132
const subPath = pathParts[0];
3233

33-
if (subPath && subPath !== '.' && subPath !== '') {
34+
if (subPath && subPath !== "." && subPath !== "") {
3435
const fullPath = parentPath === "" ? subPath : `${parentPath}/${subPath}`;
3536

3637
if (!subFolderStats.has(fullPath)) {
@@ -39,7 +40,7 @@ export function getSubFolders(totalData: ClusterNode[], parentPath: string): Fol
3940
totalChanges: 0,
4041
insertions: 0,
4142
deletions: 0,
42-
commitCount: 0
43+
commitCount: 0,
4344
});
4445
}
4546

@@ -75,18 +76,18 @@ export function getReleaseSubFolders(totalData: ClusterNode[], parentPath: strin
7576

7677
const subFolderStats = new Map<string, number>();
7778

78-
totalData.forEach(cluster => {
79-
cluster.commitNodeList.forEach(commitNode => {
80-
const commit = commitNode.commit;
79+
totalData.forEach((cluster) => {
80+
cluster.commitNodeList.forEach((commitNode) => {
81+
const { commit } = commitNode;
8182

8283
Object.entries(commit.diffStatistics.files)
83-
.filter(([filePath]) => parentPath === "" || filePath.startsWith(parentPath + "/"))
84+
.filter(([filePath]) => parentPath === "" || filePath.startsWith(`${parentPath}/`))
8485
.forEach(([filePath, stats]) => {
8586
const relativePath = parentPath === "" ? filePath : filePath.substring(parentPath.length + 1);
86-
const pathParts = relativePath.split('/');
87+
const pathParts = relativePath.split("/");
8788
const subPath = pathParts[0];
8889

89-
if (subPath && subPath !== '.' && subPath !== '') {
90+
if (subPath && subPath !== "." && subPath !== "") {
9091
const fullPath = parentPath === "" ? subPath : `${parentPath}/${subPath}`;
9192

9293
const currentChanges = subFolderStats.get(fullPath) || 0;
@@ -100,4 +101,4 @@ export function getReleaseSubFolders(totalData: ClusterNode[], parentPath: strin
100101
.sort((a, b) => b[1] - a[1])
101102
.slice(0, 8)
102103
.map(([folderPath]) => folderPath);
103-
}
104+
}

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

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { ClusterNode } from "types";
2+
23
import {
34
groupCommitsByReleaseTags,
45
analyzeReleaseFolderActivity,
5-
getTopFoldersByRelease
6+
getTopFoldersByRelease,
67
} from "./FolderActivityFlow.releaseAnalyzer";
78

89
// 테스트 데이터 생성
@@ -19,12 +20,12 @@ export function createTestData(): ClusterNode[] {
1920
author: {
2021
id: "user1",
2122
names: ["이규환"],
22-
emails: ["user1@example.com"]
23+
emails: ["user1@example.com"],
2324
},
2425
committer: {
2526
id: "user1",
2627
names: ["이규환"],
27-
emails: ["user1@example.com"]
28+
emails: ["user1@example.com"],
2829
},
2930
authorDate: "Mon Sep 29 2025 18:35:18 GMT+0900",
3031
commitDate: "Mon Sep 29 2025 18:35:18 GMT+0900",
@@ -34,15 +35,15 @@ export function createTestData(): ClusterNode[] {
3435
deletions: 20,
3536
files: {
3637
"src/components/Button.tsx": { insertions: 50, deletions: 10 },
37-
"src/utils/helper.ts": { insertions: 50, deletions: 10 }
38-
}
38+
"src/utils/helper.ts": { insertions: 50, deletions: 10 },
39+
},
3940
},
4041
message: "feat: add button component",
4142
tags: [],
42-
releaseTags: ["v1.0.0"]
43+
releaseTags: ["v1.0.0"],
4344
},
4445
seq: 1,
45-
clusterId: 1
46+
clusterId: 1,
4647
},
4748
{
4849
nodeTypeName: "COMMIT",
@@ -52,12 +53,12 @@ export function createTestData(): ClusterNode[] {
5253
author: {
5354
id: "user2",
5455
names: ["김개발"],
55-
emails: ["user2@example.com"]
56+
emails: ["user2@example.com"],
5657
},
5758
committer: {
5859
id: "user2",
5960
names: ["김개발"],
60-
emails: ["user2@example.com"]
61+
emails: ["user2@example.com"],
6162
},
6263
authorDate: "Tue Sep 30 2025 10:00:00 GMT+0900",
6364
commitDate: "Tue Sep 30 2025 10:00:00 GMT+0900",
@@ -66,15 +67,15 @@ export function createTestData(): ClusterNode[] {
6667
insertions: 30,
6768
deletions: 5,
6869
files: {
69-
"src/components/Input.tsx": { insertions: 30, deletions: 5 }
70-
}
70+
"src/components/Input.tsx": { insertions: 30, deletions: 5 },
71+
},
7172
},
7273
message: "feat: add input component",
7374
tags: [],
74-
releaseTags: [] // releaseTags 없음 -> 이전 v1.0.0과 합쳐짐
75+
releaseTags: [], // releaseTags 없음 -> 이전 v1.0.0과 합쳐짐
7576
},
7677
seq: 2,
77-
clusterId: 1
78+
clusterId: 1,
7879
},
7980
{
8081
nodeTypeName: "COMMIT",
@@ -84,12 +85,12 @@ export function createTestData(): ClusterNode[] {
8485
author: {
8586
id: "user1",
8687
names: ["이규환"],
87-
emails: ["user1@example.com"]
88+
emails: ["user1@example.com"],
8889
},
8990
committer: {
9091
id: "user1",
9192
names: ["이규환"],
92-
emails: ["user1@example.com"]
93+
emails: ["user1@example.com"],
9394
},
9495
authorDate: "Wed Oct 01 2025 14:30:00 GMT+0900",
9596
commitDate: "Wed Oct 01 2025 14:30:00 GMT+0900",
@@ -99,18 +100,18 @@ export function createTestData(): ClusterNode[] {
99100
deletions: 15,
100101
files: {
101102
"src/pages/Home.tsx": { insertions: 60, deletions: 10 },
102-
"src/styles/main.css": { insertions: 20, deletions: 5 }
103-
}
103+
"src/styles/main.css": { insertions: 20, deletions: 5 },
104+
},
104105
},
105106
message: "feat: add home page",
106107
tags: [],
107-
releaseTags: ["v1.1.0"]
108+
releaseTags: ["v1.1.0"],
108109
},
109110
seq: 3,
110-
clusterId: 2
111-
}
112-
]
113-
}
111+
clusterId: 2,
112+
},
113+
],
114+
},
114115
] as ClusterNode[];
115116
}
116117

@@ -138,6 +139,6 @@ export function testReleaseAnalyzer() {
138139
return {
139140
releaseGroups,
140141
folderActivities,
141-
topFoldersResult
142+
topFoldersResult,
142143
};
143-
}
144+
}

packages/view/src/components/FolderActivityFlow/FolderActivityFlow.tsx

Lines changed: 30 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { useDataStore } from "store";
66

77
import { DIMENSIONS } from "./FolderActivityFlow.const";
88
import "./FolderActivityFlow.scss";
9-
import { extractContributorActivities, extractReleaseBasedContributorActivities } from "./FolderActivityFlow.util";
10-
import { renderClusterVisualization } from "./ClusterVisualization";
9+
import { extractReleaseBasedContributorActivities } from "./FolderActivityFlow.util";
1110
import { renderReleaseVisualization } from "./ReleaseVisualization";
1211
import { useFolderNavigation } from "./useFolderNavigation";
1312

@@ -18,12 +17,9 @@ const FolderActivityFlow = () => {
1817
const tooltipRef = useRef<HTMLDivElement>(null);
1918

2019
const {
21-
topFolders,
2220
currentPath,
23-
isReleaseMode,
2421
releaseGroups,
2522
releaseTopFolderPaths,
26-
toggleMode,
2723
navigateToFolder,
2824
navigateUp,
2925
navigateToBreadcrumb,
@@ -40,100 +36,50 @@ const FolderActivityFlow = () => {
4036
return;
4137
}
4238

43-
if (isReleaseMode) {
44-
if (releaseGroups.length === 0 || releaseTopFolderPaths.length === 0) {
45-
return;
46-
}
47-
} else if (topFolders.length === 0) {
39+
if (releaseGroups.length === 0 || releaseTopFolderPaths.length === 0) {
4840
return;
4941
}
5042

5143
const svg = d3.select(svgRef.current).attr("width", DIMENSIONS.width).attr("height", DIMENSIONS.height);
5244

5345
svg.selectAll("*").remove();
5446

55-
if (isReleaseMode) {
56-
const currentDepth = currentPath === "" ? 1 : currentPath.split("/").length + 1;
57-
const releaseContributorActivities = extractReleaseBasedContributorActivities(
58-
totalData,
59-
releaseTopFolderPaths,
60-
currentDepth
61-
);
62-
63-
if (releaseContributorActivities.length === 0) {
64-
svg
65-
.append("text")
66-
.attr("x", DIMENSIONS.width / 2)
67-
.attr("y", DIMENSIONS.height / 2)
68-
.attr("text-anchor", "middle")
69-
.attr("dominant-baseline", "middle")
70-
.text("No release activity data available")
71-
.style("font-size", "14px")
72-
.style("fill", "#6c757d");
73-
return;
74-
}
75-
76-
renderReleaseVisualization({
77-
svg,
78-
releaseContributorActivities,
79-
releaseTopFolderPaths,
80-
tooltipRef,
81-
onFolderClick: navigateToFolder,
82-
});
83-
} else {
84-
const contributorActivities = extractContributorActivities(totalData, topFolders, currentPath);
85-
86-
if (contributorActivities.length === 0) {
87-
svg
88-
.append("text")
89-
.attr("x", DIMENSIONS.width / 2)
90-
.attr("y", DIMENSIONS.height / 2)
91-
.attr("text-anchor", "middle")
92-
.attr("dominant-baseline", "middle")
93-
.text("No activity data available for this folder")
94-
.style("font-size", "14px")
95-
.style("fill", "#6c757d");
96-
return;
97-
}
98-
99-
renderClusterVisualization({
100-
svg,
101-
contributorActivities,
102-
topFolders,
103-
tooltipRef,
104-
onFolderClick: navigateToFolder,
105-
});
47+
const currentDepth = currentPath === "" ? 1 : currentPath.split("/").length + 1;
48+
const releaseContributorActivities = extractReleaseBasedContributorActivities(
49+
totalData,
50+
releaseTopFolderPaths,
51+
currentDepth
52+
);
53+
54+
if (releaseContributorActivities.length === 0) {
55+
svg
56+
.append("text")
57+
.attr("x", DIMENSIONS.width / 2)
58+
.attr("y", DIMENSIONS.height / 2)
59+
.attr("text-anchor", "middle")
60+
.attr("dominant-baseline", "middle")
61+
.text("No release activity data available")
62+
.style("font-size", "14px")
63+
.style("fill", "#6c757d");
64+
return;
10665
}
107-
}, [totalData, topFolders, isReleaseMode, releaseGroups, releaseTopFolderPaths, navigateToFolder]);
66+
67+
renderReleaseVisualization({
68+
svg,
69+
releaseContributorActivities,
70+
releaseTopFolderPaths,
71+
tooltipRef,
72+
onFolderClick: navigateToFolder,
73+
});
74+
}, [totalData, releaseGroups, releaseTopFolderPaths, navigateToFolder, currentPath]);
10875

10976
return (
11077
<div className="folder-activity-flow">
11178
<div className="folder-activity-flow__header">
11279
<div>
11380
<p className="folder-activity-flow__title">Contributors Folder Activity Flow</p>
114-
<div className="folder-activity-flow__subtitle">
115-
{isReleaseMode
116-
? "Contributors moving between folders across releases"
117-
: "Contributors moving between top folders over time"}
118-
</div>
81+
<div className="folder-activity-flow__subtitle">Contributors moving between folders across releases</div>
11982
</div>
120-
<button
121-
type="button"
122-
className="folder-activity-flow__mode-toggle"
123-
onClick={toggleMode}
124-
style={{
125-
padding: "8px 16px",
126-
backgroundColor: isReleaseMode ? "#28a745" : "#007bff",
127-
color: "white",
128-
border: "none",
129-
borderRadius: "4px",
130-
cursor: "pointer",
131-
fontSize: "14px",
132-
fontWeight: "500",
133-
}}
134-
>
135-
{isReleaseMode ? "📋 Release Mode" : "🔗 Cluster Mode"}
136-
</button>
13783
</div>
13884

13985
<div className="folder-activity-flow__breadcrumb">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export interface ReleaseFlowLineData {
3535
endReleaseIndex: number;
3636
endFolder: string;
3737
contributorName: string;
38-
}
38+
}

0 commit comments

Comments
 (0)