Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,60 +66,75 @@ export const renderClusterVisualization = ({
.domain([0, d3.max(contributorActivities, (d) => d.changes) || 1])
.range([3, 12]);

const colorScale = d3.scaleOrdinal().domain(uniqueContributors).range(d3.schemeCategory10);
const svgElement = svg.node();
const parentElement = svgElement?.parentElement;
const chartColors = Array.from({ length: 10 }, (_, i) =>
getComputedStyle(parentElement || document.documentElement)
.getPropertyValue(`--chart-color-${i + 1}`)
.trim()
);

const colorScale = d3.scaleOrdinal().domain(uniqueContributors).range(chartColors);

const mainGroup = svg.append("g");

// 폴더 레인 그리기
mainGroup
.selectAll(".folder-lane")
.selectAll(".folder-label")
.data(topFolders)
.enter()
.append("g")
.attr("class", "folder-lane")
.each(function (this: SVGGElement, d: FolderActivity) {
const lane = d3.select(this);

lane
.append("rect")
.attr("class", "lane-background")
.attr("x", DIMENSIONS.margin.left)
.attr("y", yScale(d.folderPath) || 0)
.attr("width", DIMENSIONS.width - DIMENSIONS.margin.left - DIMENSIONS.margin.right)
.attr("height", yScale.bandwidth())
.attr("fill", "#f8f9fa")
.attr("stroke", "#dee2e6")
.attr("stroke-width", 1);

lane
.append("text")
.attr("class", "folder-label clickable")
.attr("x", DIMENSIONS.width - DIMENSIONS.margin.right + 10)
.attr("y", (yScale(d.folderPath) || 0) + yScale.bandwidth() / 2)
.attr("text-anchor", "start")
.attr("dominant-baseline", "middle")
.text(() => {
if (d.folderPath === ".") return "root";

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

return fileName && fileName.length > 15 ? `${fileName.substring(0, 12)}...` : fileName || "unknown";
})
.style("font-size", "12px")
.style("fill", "#495057")
.style("font-weight", "500")
.style("cursor", "pointer")
.on("click", () => {
if (d.folderPath !== ".") {
onFolderClick(d.folderPath);
}
})
.on("mouseover", function () {
d3.select(this).style("fill", "#007bff");
})
.on("mouseout", function () {
d3.select(this).style("fill", "#495057");
});
.append("text")
.attr("class", (d: FolderActivity) => {
const isFile = d.folderPath.includes(".");
return isFile ? "folder-label" : "folder-label clickable";
})
.attr("x", DIMENSIONS.width - DIMENSIONS.margin.right + 10)
.attr("y", (d: FolderActivity) => (yScale(d.folderPath) || 0) + yScale.bandwidth() / 2)
.attr("text-anchor", "start")
.attr("dominant-baseline", "middle")
.text((d: FolderActivity) => {
if (d.folderPath === ".") return "root";

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

return fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
})
.style("font-size", "12px")
.style("fill", "#b4bac6")
.style("font-weight", "500")
.style("cursor", (d: FolderActivity) => {
const isFile = d.folderPath.includes(".");
return isFile ? "default" : "pointer";
})
.on("click", (_event: MouseEvent, d: FolderActivity) => {
const isFile = d.folderPath.includes(".");
if (!isFile && d.folderPath !== ".") {
onFolderClick(d.folderPath);
}
})
.on("mouseover", function (_event: MouseEvent, d: FolderActivity) {
const isFile = d.folderPath.includes(".");
if (!isFile) {
d3.select(this).style("fill", "#e06091");
}
})
.on("mouseout", function (_event: MouseEvent, d: FolderActivity) {
const isFile = d.folderPath.includes(".");
const element = d3.select(this);
if (!isFile) {
element.style("fill", "#b4bac6");
}
// 호버 끝나면 축약된 텍스트로 복원
const fileName = d.folderPath.includes("/") ? d.folderPath.split("/").pop() : d.folderPath;
const displayName = fileName && fileName.length > 15 ? `${fileName.substring(0, 15)}...` : fileName || "unknown";
element.text(d.folderPath === "." ? "root" : displayName);
});

// 호버 시 전체 이름 표시를 위한 추가 이벤트
mainGroup
.selectAll<SVGTextElement, FolderActivity>(".folder-label")
.on("mouseover.showfull", function (_event, d) {
const fileName = d.folderPath.includes("/") ? d.folderPath.split("/").pop() : d.folderPath;
d3.select(this).text(d.folderPath === "." ? "root" : fileName || "unknown");
});

// 클러스터 축
Expand Down Expand Up @@ -151,9 +166,7 @@ export const renderClusterVisualization = ({
.attr("cy", (d: ContributorActivity) => (yScale(d.folderPath) || 0) + yScale.bandwidth() / 2)
.attr("r", (d: ContributorActivity) => sizeScale(d.changes))
.attr("fill", (d: ContributorActivity) => colorScale(d.contributorName) as string)
.attr("fill-opacity", 0.8)
.attr("stroke", "#fff")
.attr("stroke-width", 1);
.attr("fill-opacity", 0.8);

// 툴팁 이벤트
dots
Expand Down Expand Up @@ -198,7 +211,7 @@ export const renderClusterVisualization = ({
.attr("dominant-baseline", "bottom")
.text((d: ContributorActivity) => d.contributorName)
.style("font-size", "10px")
.style("fill", "#495057")
.style("fill", "#f7f7f7")
.style("font-weight", "500")
.style("pointer-events", "none");

Expand All @@ -215,5 +228,5 @@ export const renderClusterVisualization = ({
.attr("fill", "none")
.attr("stroke", (d) => colorScale(d.contributorName) as string)
.attr("stroke-width", 2)
.attr("stroke-opacity", 0.4);
.attr("stroke-opacity", 1);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
@import "../../styles/colors";

.folder-activity-flow {
// Chart color palette for contributors
--chart-color-1: #e06091; // githru-pri
--chart-color-2: #8840bb; // githru-sec
--chart-color-3: #ffd08a; // githru-ter
--chart-color-4: #07bebe; // githru-suc
--chart-color-5: #456cf7; // hacker-pri
--chart-color-6: #0687a3; // aqua-sec
--chart-color-7: #ffcccb; // cotton-pri
--chart-color-8: #feffd1; // cotton-sec
--chart-color-9: #3a4776; // mono-sec
--chart-color-10: #aa4b72; // mono-fai

Comment on lines 3 to +15

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

색 조합 너무 예쁜 것 같습니다✨


padding: 1rem;
margin-bottom: 2rem;
background: #ffffff;
background: $color-background;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Githru 스타일 통일 너무 좋습니닷ㅎㅎㅎ

border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

Expand All @@ -16,13 +31,13 @@
margin: 0 0 0.5rem 0;
font-size: 1.2rem;
font-weight: 600;
color: #212529;
color: $color-white;
}

&__subtitle {
margin: 0 0 0.5rem 0;
font-size: 0.875rem;
color: #6c757d;
color: $color-light-gray;
}

&__mode-toggle {
Expand All @@ -41,53 +56,54 @@
&__breadcrumb {
margin: 0 0 1rem 0;
padding: 0.5rem;
background: #f8f9fa;
background: $color-dark-gray;
border-radius: 4px;
font-size: 0.875rem;
display: flex;
align-items: center;
gap: 0.5rem;

.separator {
color: #6c757d;
color: $color-light-gray;
}

.clickable {
color: #007bff;
color: #456cf7;
cursor: pointer;
text-decoration: underline;

&:hover {
color: #0056b3;
color: #e06091;
}
}

.current {
color: #212529;
color: $color-white;
font-weight: 600;
}
}

&__back-btn {
margin-left: auto;
padding: 0.25rem 0.5rem;
background: #007bff;
background: #456cf7;
color: white;
border: none;
border-radius: 4px;
font-size: 0.75rem;
cursor: pointer;

&:hover {
background: #0056b3;
background: #e06091;
}
}

&__chart {
display: block;
margin: 0 auto;
cursor: grab;

background: $color-background;

&:active {
cursor: grabbing;
}
Expand Down Expand Up @@ -122,21 +138,21 @@

.lane-background {
transition: fill 0.2s ease;

&:hover {
fill: #e9ecef;
fill: #757880;
}
}

.folder-label {
font-weight: 500;

&.clickable {
cursor: pointer;
transition: fill 0.2s ease;

&:hover {
fill: #007bff !important;
fill: #e06091 !important;
}
}
}
Expand All @@ -158,11 +174,11 @@
.x-axis {
.domain,
.tick line {
stroke: #dee2e6;
stroke: $color-medium-gray;
}

.tick text {
fill: #6c757d;
fill: $color-light-gray;
font-size: 11px;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const FolderActivityFlow = () => {
className={index === getBreadcrumbs().length - 1 ? "current" : "clickable"}
onClick={() => navigateToBreadcrumb(index, getBreadcrumbs().length)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
navigateToBreadcrumb(index, getBreadcrumbs().length);
}
Expand Down
Loading