Skip to content

Commit 8dfdd75

Browse files
committed
feat: integrate contribution heatmap into project details page
1 parent 8a82ef3 commit 8dfdd75

File tree

1 file changed

+43
-19
lines changed
  • frontend/src/app/projects/[projectKey]

1 file changed

+43
-19
lines changed

frontend/src/app/projects/[projectKey]/page.tsx

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import type { Contributor } from 'types/contributor'
1717
import type { Project } from 'types/project'
1818
import { formatDate } from 'utils/dateFormatter'
1919
import DetailsCard from 'components/CardDetailsPage'
20+
import ContributionHeatmap from 'components/ContributionHeatmap'
2021
import LoadingSpinner from 'components/LoadingSpinner'
22+
2123
const ProjectDetailsPage = () => {
2224
const { projectKey } = useParams<{ projectKey: string }>()
2325
const [isLoading, setIsLoading] = useState<boolean>(true)
@@ -88,26 +90,48 @@ const ProjectDetailsPage = () => {
8890
},
8991
]
9092

93+
// Calculate contribution heatmap date range (1 year back)
94+
const today = new Date()
95+
const oneYearAgo = new Date(today)
96+
oneYearAgo.setFullYear(today.getFullYear() - 1)
97+
const startDate = oneYearAgo.toISOString().split('T')[0]
98+
const endDate = today.toISOString().split('T')[0]
99+
91100
return (
92-
<DetailsCard
93-
details={projectDetails}
94-
entityKey={project.key}
95-
entityLeaders={project.entityLeaders}
96-
healthMetricsData={project.healthMetricsList}
97-
isActive={project.isActive}
98-
languages={project.languages}
99-
pullRequests={project.recentPullRequests}
100-
recentIssues={project.recentIssues}
101-
recentMilestones={project.recentMilestones}
102-
recentReleases={project.recentReleases}
103-
repositories={project.repositories}
104-
stats={projectStats}
105-
summary={project.summary}
106-
title={project.name}
107-
topContributors={topContributors}
108-
topics={project.topics}
109-
type="project"
110-
/>
101+
<>
102+
<DetailsCard
103+
details={projectDetails}
104+
entityKey={project.key}
105+
entityLeaders={project.entityLeaders}
106+
healthMetricsData={project.healthMetricsList}
107+
isActive={project.isActive}
108+
languages={project.languages}
109+
pullRequests={project.recentPullRequests}
110+
recentIssues={project.recentIssues}
111+
recentMilestones={project.recentMilestones}
112+
recentReleases={project.recentReleases}
113+
repositories={project.repositories}
114+
stats={projectStats}
115+
summary={project.summary}
116+
title={project.name}
117+
topContributors={topContributors}
118+
topics={project.topics}
119+
type="project"
120+
/>
121+
{project.contributionData && Object.keys(project.contributionData).length > 0 && (
122+
<div className="min-h-screen bg-white p-8 text-gray-600 dark:bg-[#212529] dark:text-gray-300">
123+
<div className="mx-auto max-w-6xl">
124+
<ContributionHeatmap
125+
contributionData={project.contributionData}
126+
startDate={startDate}
127+
endDate={endDate}
128+
title="Project Contribution Activity"
129+
unit="contributions"
130+
/>
131+
</div>
132+
</div>
133+
)}
134+
</>
111135
)
112136
}
113137

0 commit comments

Comments
 (0)