-
Notifications
You must be signed in to change notification settings - Fork 105
[new feature](view): StoryLine chart 타이틀/서브타이틀 구현 #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"; | ||
|
|
||
|
|
@@ -37,6 +38,68 @@ const FolderActivityFlow = () => { | |
|
|
||
| const breadcrumbs = useMemo(() => getBreadcrumbs(), [getBreadcrumbs]); | ||
|
|
||
| const { topContributorName, releaseRangeLabel } = useMemo(() => { | ||
| 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; | ||
|
|
@@ -84,43 +147,47 @@ const FolderActivityFlow = () => { | |
| }); | ||
| }, [totalData, releaseGroups, releaseTopFolderPaths, navigateToFolder, currentPath]); | ||
|
|
||
| const topContributorLabel = topContributorName || "..."; | ||
|
|
||
|
Comment on lines
+150
to
+151
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 중요한 건 아니지만 데이터가 없을 때 ". . ."으로 적절한지 고민해볼 필요가 있겠네요 !!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요 부분은 따로 유틸 파일로 빼서 모듈화해도 좋을 것 같아요! 이건 제가 추후에 작업해보겠습니다 ...!