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 @@ -14,48 +14,65 @@
--chart-color-9: #3a4776; // mono-sec
--chart-color-10: #aa4b72; // mono-fai

--title-left-offset: 30px;
--title-icon-size: 34px;
--title-gap: 4px;


padding: 1rem;
margin-bottom: 2rem;
background: $color-background;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

&__header {
&__head {
margin-top: 40px;
margin-left: var(--title-left-offset);
display: flex;
justify-content: space-between;
flex-direction: column;
align-items: flex-start;
margin-bottom: 1rem;
gap: 0.25rem;
}

&__title {
margin: 0 0 0.5rem 0;
font-size: 1.2rem;
font-weight: 600;
display: flex;
align-items: center;
column-gap: var(--title-gap);
color: $color-white;
font-size: 34px;
letter-spacing: 0.25px;
line-height: 42px;
font-weight: $font-weight-regular;
white-space: nowrap;
}

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

&__mode-toggle {
transition: all 0.2s ease;
&__title-icon {
font-size: var(--title-icon-size);
width: var(--title-icon-size);
height: var(--title-icon-size);
transform: translateY(-2px);
color: $color-white;

&:hover {
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
&.MuiSvgIcon-root {
font-size: var(--title-icon-size);
}
}

&:active {
transform: translateY(0);
}
&__title-text {
display: flex;
align-items: center;
}

&__subtitle {
color: $color-white;
font-size: 20px;
font-weight: $font-weight-regular;
}

&__breadcrumb {
padding-left: 50px;
display: flex;
align-items: center;
margin-bottom: 0.5rem;

.MuiBreadcrumbs-separator {
color: $color-white;
Expand All @@ -72,6 +89,7 @@
font-size: $font-size-body;
font-weight: $font-weight-regular;
text-decoration: none;
cursor: pointer;

&:hover {
color: $color-white;
Expand Down Expand Up @@ -196,4 +214,4 @@
font-size: 11px;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Breadcrumbs from "@mui/material/Breadcrumbs";
import Link from "@mui/material/Link";
import Typography from "@mui/material/Typography";
import NavigateNextIcon from "@mui/icons-material/NavigateNext";
import WorkspacePremiumRoundedIcon from "@mui/icons-material/WorkspacePremiumRounded";

import { useDataStore } from "store";

Expand Down Expand Up @@ -37,6 +38,68 @@ const FolderActivityFlow = () => {

const breadcrumbs = useMemo(() => getBreadcrumbs(), [getBreadcrumbs]);

const { topContributorName, releaseRangeLabel } = useMemo(() => {

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.

요 부분은 따로 유틸 파일로 빼서 모듈화해도 좋을 것 같아요! 이건 제가 추후에 작업해보겠습니다 ...!

if (!totalData || totalData.length === 0 || releaseTopFolderPaths.length === 0) {
return {
topContributorName: null,
releaseRangeLabel: "...",
};
}

const currentDepth = currentPath === "" ? 1 : currentPath.split("/").length + 1;
const releaseContributorActivities = extractReleaseBasedContributorActivities(
totalData,
releaseTopFolderPaths,
currentDepth
);

if (releaseContributorActivities.length === 0) {
return {
topContributorName: null,
releaseRangeLabel: "...",
};
}

const contributorClocs = new Map<string, number>();
releaseContributorActivities.forEach((activity) => {
const current = contributorClocs.get(activity.contributorName) || 0;
contributorClocs.set(activity.contributorName, current + activity.changes);
});

let maxCloc = 0;
let mostActiveContributor = "";
contributorClocs.forEach((cloc, name) => {
if (cloc > maxCloc) {
maxCloc = cloc;
mostActiveContributor = name;
}
});

const releaseIndices = Array.from(
new Set(releaseContributorActivities.map((activity) => activity.releaseIndex))
).sort((a, b) => a - b);
const releaseTagByIndex = new Map<number, string>();
releaseContributorActivities.forEach((activity) => {
if (!releaseTagByIndex.has(activity.releaseIndex)) {
releaseTagByIndex.set(activity.releaseIndex, activity.releaseTag);
}
});

const resolvedTags = releaseIndices.map((index) => {
const tag = releaseTagByIndex.get(index);
return tag && tag.trim().length > 0 ? tag : `Release ${index}`;
});

const firstReleaseLabel = resolvedTags[0] || "...";
const lastReleaseLabel = resolvedTags[resolvedTags.length - 1] || firstReleaseLabel;
const rangeLabel = resolvedTags.length <= 1 ? firstReleaseLabel : `${firstReleaseLabel} to ${lastReleaseLabel}`;

return {
topContributorName: mostActiveContributor || null,
releaseRangeLabel: rangeLabel || "...",
};
}, [totalData, releaseTopFolderPaths, currentPath]);

useEffect(() => {
if (!totalData || totalData.length === 0) {
return;
Expand Down Expand Up @@ -84,43 +147,47 @@ const FolderActivityFlow = () => {
});
}, [totalData, releaseGroups, releaseTopFolderPaths, navigateToFolder, currentPath]);

const topContributorLabel = topContributorName || "...";

Comment on lines +150 to +151

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.

중요한 건 아니지만 데이터가 없을 때 ". . ."으로 적절한지 고민해볼 필요가 있겠네요 !!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

앗 맞아요!! 어떻게 하는게 좋을지...
일단 이대로 머지 하겠습니당!

return (
<div
className="folder-activity-flow"
ref={containerRef}
>
<div className="folder-activity-flow__header">
<div>
<p className="folder-activity-flow__title">Contributors Folder Activity Flow</p>
<div className="folder-activity-flow__subtitle">Contributors moving between folders across releases</div>
<div className="folder-activity-flow__head">
<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
className="folder-activity-flow__breadcrumb"
>
{breadcrumbs.map((crumb, index) => {
const isLast = index === breadcrumbs.length - 1;

if (isLast) {
return <Typography key={crumb}>{crumb}</Typography>;
}

return (
<Link
key={crumb}
underline="none"
component="button"
onClick={() => navigateToBreadcrumb(index, breadcrumbs.length)}
>
{crumb}
</Link>
);
})}
</Breadcrumbs>

<div className="folder-activity-flow__title">
<WorkspacePremiumRoundedIcon className="folder-activity-flow__title-icon" />
<span className="folder-activity-flow__title-text">Top contributor is {topContributorLabel}</span>
</div>

<div className="folder-activity-flow__subtitle">{releaseRangeLabel}</div>
</div>

<Breadcrumbs
separator={<NavigateNextIcon fontSize="small" />}
aria-label="breadcrumb"
className="folder-activity-flow__breadcrumb"
>
{breadcrumbs.map((crumb, index) => {
const isLast = index === breadcrumbs.length - 1;

if (isLast) {
return <Typography key={crumb}>{crumb}</Typography>;
}

return (
<Link
key={crumb}
underline="none"
component="button"
onClick={() => navigateToBreadcrumb(index, breadcrumbs.length)}
sx={{ cursor: "pointer" }}
>
{crumb}
</Link>
);
})}
</Breadcrumbs>
<svg
className="folder-activity-flow__chart"
ref={svgRef}
Expand Down