Skip to content

Commit d0fa662

Browse files
committed
[fix] : contributor activity가 없는 폴더/파일은 차트에서 삭제
1 parent 8fe971b commit d0fa662

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,20 @@ const FolderActivityFlow = () => {
4545
return;
4646
}
4747

48-
// 폴더 개수에 따라 동적으로 높이 계산
49-
const chartHeight = calculateChartHeight(releaseTopFolderPaths.length);
50-
const svg = d3.select(svgRef.current).attr("width", DIMENSIONS.width).attr("height", chartHeight);
51-
52-
svg.selectAll("*").remove();
53-
48+
// 실제로 activity가 있는 폴더만 카운트
5449
const currentDepth = currentPath === "" ? 1 : currentPath.split("/").length + 1;
5550
const releaseContributorActivities = extractReleaseBasedContributorActivities(
5651
totalData,
5752
releaseTopFolderPaths,
5853
currentDepth
5954
);
55+
const activeFolderCount = new Set(releaseContributorActivities.map((a) => a.folderPath)).size;
56+
57+
// 폴더 개수에 따라 동적으로 높이 계산
58+
const chartHeight = calculateChartHeight(activeFolderCount);
59+
const svg = d3.select(svgRef.current).attr("width", DIMENSIONS.width).attr("height", chartHeight);
60+
61+
svg.selectAll("*").remove();
6062

6163
if (releaseContributorActivities.length === 0) {
6264
svg

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ export const renderReleaseVisualization = ({
5757
releaseTagsByIndex.set(a.releaseIndex, a.releaseTag);
5858
});
5959

60+
// 실제로 노드(activity)가 있는 폴더만 필터링
61+
const activeFolderPaths = Array.from(new Set(releaseContributorActivities.map((a) => a.folderPath)));
62+
const filteredFolderPaths = releaseTopFolderPaths.filter((path) => activeFolderPaths.includes(path));
63+
6064
const xScale = d3
6165
.scaleBand()
6266
.domain(uniqueReleases.map(String))
@@ -65,7 +69,7 @@ export const renderReleaseVisualization = ({
6569

6670
const yScale = d3
6771
.scaleBand()
68-
.domain(releaseTopFolderPaths)
72+
.domain(filteredFolderPaths)
6973
.range([DIMENSIONS.margin.top, chartHeight - DIMENSIONS.margin.bottom])
7074
.paddingInner(0.2);
7175

@@ -88,7 +92,7 @@ export const renderReleaseVisualization = ({
8892

8993
mainGroup
9094
.selectAll(".folder-label")
91-
.data(releaseTopFolderPaths)
95+
.data(filteredFolderPaths)
9296
.enter()
9397
.append("text")
9498
.attr("class", (folderPath: string) => {

0 commit comments

Comments
 (0)