Skip to content

Commit b047540

Browse files
committed
[refactor] : y축 폴더/파일명 구분
1 parent 98b38ac commit b047540

2 files changed

Lines changed: 68 additions & 16 deletions

File tree

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

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ export const renderClusterVisualization = ({
8383
.data(topFolders)
8484
.enter()
8585
.append("text")
86-
.attr("class", "folder-label clickable")
86+
.attr("class", (d: FolderActivity) => {
87+
const isFile = d.folderPath.includes(".");
88+
return isFile ? "folder-label" : "folder-label clickable";
89+
})
8790
.attr("x", DIMENSIONS.width - DIMENSIONS.margin.right + 10)
8891
.attr("y", (d: FolderActivity) => (yScale(d.folderPath) || 0) + yScale.bandwidth() / 2)
8992
.attr("text-anchor", "start")
@@ -93,22 +96,45 @@ export const renderClusterVisualization = ({
9396

9497
const fileName = d.folderPath.includes("/") ? d.folderPath.split("/").pop() : d.folderPath;
9598

96-
return fileName && fileName.length > 15 ? `${fileName.substring(0, 12)}...` : fileName || "unknown";
99+
return fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
97100
})
98101
.style("font-size", "12px")
99102
.style("fill", "#b4bac6")
100103
.style("font-weight", "500")
101-
.style("cursor", "pointer")
104+
.style("cursor", (d: FolderActivity) => {
105+
const isFile = d.folderPath.includes(".");
106+
return isFile ? "default" : "pointer";
107+
})
102108
.on("click", (_event: MouseEvent, d: FolderActivity) => {
103-
if (d.folderPath !== ".") {
109+
const isFile = d.folderPath.includes(".");
110+
if (!isFile && d.folderPath !== ".") {
104111
onFolderClick(d.folderPath);
105112
}
106113
})
107-
.on("mouseover", function () {
108-
d3.select(this).style("fill", "#e06091");
114+
.on("mouseover", function (_event: MouseEvent, d: FolderActivity) {
115+
const isFile = d.folderPath.includes(".");
116+
if (!isFile) {
117+
d3.select(this).style("fill", "#e06091");
118+
}
109119
})
110-
.on("mouseout", function () {
111-
d3.select(this).style("fill", "#b4bac6");
120+
.on("mouseout", function (_event: MouseEvent, d: FolderActivity) {
121+
const isFile = d.folderPath.includes(".");
122+
const element = d3.select(this);
123+
if (!isFile) {
124+
element.style("fill", "#b4bac6");
125+
}
126+
// 호버 끝나면 축약된 텍스트로 복원
127+
const fileName = d.folderPath.includes("/") ? d.folderPath.split("/").pop() : d.folderPath;
128+
const displayName = fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
129+
element.text(d.folderPath === "." ? "root" : displayName);
130+
});
131+
132+
// 호버 시 전체 이름 표시를 위한 추가 이벤트
133+
mainGroup
134+
.selectAll<SVGTextElement, FolderActivity>(".folder-label")
135+
.on("mouseover.showfull", function (_event, d) {
136+
const fileName = d.folderPath.includes("/") ? d.folderPath.split("/").pop() : d.folderPath;
137+
d3.select(this).text(d.folderPath === "." ? "root" : fileName || "unknown");
112138
});
113139

114140
// 클러스터 축

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

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,56 @@ export const renderReleaseVisualization = ({
8888
.data(releaseTopFolderPaths)
8989
.enter()
9090
.append("text")
91-
.attr("class", "folder-label clickable")
91+
.attr("class", (folderPath: string) => {
92+
const isFile = folderPath.includes(".");
93+
return isFile ? "folder-label" : "folder-label clickable";
94+
})
9295
.attr("x", DIMENSIONS.width - DIMENSIONS.margin.right + 10)
9396
.attr("y", (folderPath: string) => (yScale(folderPath) || 0) + yScale.bandwidth() / 2)
9497
.attr("text-anchor", "start")
9598
.attr("dominant-baseline", "middle")
9699
.text((folderPath: string) => {
97100
if (folderPath === ".") return "root";
98101
const fileName = folderPath.includes("/") ? folderPath.split("/").pop() : folderPath;
99-
return fileName && fileName.length > 15 ? `${fileName.substring(0, 12)}...` : fileName || "unknown";
102+
return fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
100103
})
101104
.style("font-size", "12px")
102105
.style("fill", "#b4bac6")
103106
.style("font-weight", "500")
104-
.style("cursor", "pointer")
107+
.style("cursor", (folderPath: string) => {
108+
const isFile = folderPath.includes(".");
109+
return isFile ? "default" : "pointer";
110+
})
105111
.on("click", (_event: MouseEvent, folderPath: string) => {
106-
if (folderPath !== ".") {
112+
const isFile = folderPath.includes(".");
113+
if (!isFile && folderPath !== ".") {
107114
onFolderClick(folderPath);
108115
}
109116
})
110-
.on("mouseover", function () {
111-
d3.select(this).style("fill", "#e06091");
117+
.on("mouseover", function (_event: MouseEvent, folderPath: string) {
118+
const isFile = folderPath.includes(".");
119+
if (!isFile) {
120+
d3.select(this).style("fill", "#e06091");
121+
}
112122
})
113-
.on("mouseout", function () {
114-
d3.select(this).style("fill", "#b4bac6");
123+
.on("mouseout", function (_event: MouseEvent, folderPath: string) {
124+
const isFile = folderPath.includes(".");
125+
const element = d3.select(this);
126+
if (!isFile) {
127+
element.style("fill", "#b4bac6");
128+
}
129+
// 호버 끝나면 축약된 텍스트로 복원
130+
const fileName = folderPath.includes("/") ? folderPath.split("/").pop() : folderPath;
131+
const displayName = fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
132+
element.text(folderPath === "." ? "root" : displayName);
133+
});
134+
135+
// 호버 시 전체 이름 표시를 위한 추가 이벤트
136+
mainGroup
137+
.selectAll<SVGTextElement, string>(".folder-label")
138+
.on("mouseover.showfull", function (_event, folderPath) {
139+
const fileName = folderPath.includes("/") ? folderPath.split("/").pop() : folderPath;
140+
d3.select(this).text(folderPath === "." ? "root" : fileName || "unknown");
115141
});
116142

117143
// 릴리즈 축

0 commit comments

Comments
 (0)