Simplify heatmap data checks for contributions and communications#3315
Simplify heatmap data checks for contributions and communications#3315SidharthxNST wants to merge 1 commit intoOWASP:mainfrom
Conversation
Summary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughModified render guards for two heatmap components to check for any positive count values instead of non-empty key sets. This prevents heatmaps from displaying when entities have zero contributions, addressing visual clutter for new projects. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
frontend/src/app/board/[year]/candidates/page.tsx (2)
460-472: Logic change correctly hides heatmaps when all contribution counts are zero.The switch from checking
Object.keys(...).length > 0toObject.values(...).some(count => count > 0)properly addresses the issue where heatmaps appeared confusing for entities with zero contributions.Minor nit: the indentation of the callback and closing parenthesis appears slightly off.
🔧 Optional: align indentation
{snapshot.contributionHeatmapData && - Object.values(snapshot.contributionHeatmapData).some( - (count) => count > 0 - ) && ( + Object.values(snapshot.contributionHeatmapData).some((count) => count > 0) && ( <div className="mt-3">
623-637: Consistent application of the same logic for communication heatmap.The condition correctly prevents displaying the communication heatmap when there's no actual engagement data (all zeros).
Minor nit: similar indentation inconsistency as the contribution heatmap check.
🔧 Optional: align indentation
{snapshot?.communicationHeatmapData && - Object.values(snapshot.communicationHeatmapData).some( - (count) => count > 0 - ) && ( + Object.values(snapshot.communicationHeatmapData).some((count) => count > 0) && ( <div className="mt-4 w-full border-t border-gray-200 pt-4 dark:border-gray-700">
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/app/board/[year]/candidates/page.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1633
File: frontend/src/components/HealthMetrics.tsx:30-30
Timestamp: 2025-06-20T16:12:59.256Z
Learning: In the DetailsCard component (frontend/src/components/CardDetailsPage.tsx), there's a length check before rendering HealthMetrics: `healthMetricsData.length > 0`. This ensures that when HealthMetrics is rendered, the data array has at least one element, making accessing data[0] safe within the HealthMetrics component.
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1633
File: frontend/src/components/HealthMetrics.tsx:30-30
Timestamp: 2025-06-20T16:12:59.256Z
Learning: In the DetailsCard component (frontend/src/components/CardDetailsPage.tsx), there's a safety check that ensures HealthMetrics component is only rendered when healthMetricsData exists and has at least one element: `healthMetricsData && healthMetricsData.length > 0`. This makes accessing data[0] safe within the HealthMetrics component.
📚 Learning: 2025-06-20T16:12:59.256Z
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1633
File: frontend/src/components/HealthMetrics.tsx:30-30
Timestamp: 2025-06-20T16:12:59.256Z
Learning: In the DetailsCard component (frontend/src/components/CardDetailsPage.tsx), there's a length check before rendering HealthMetrics: `healthMetricsData.length > 0`. This ensures that when HealthMetrics is rendered, the data array has at least one element, making accessing data[0] safe within the HealthMetrics component.
Applied to files:
frontend/src/app/board/[year]/candidates/page.tsx
|
Closed in favor of #3314 |



Resolves: #3262
This PR improves the user experience for projects or chapters that don’t yet have any activity. When an entity has zero contributions, the contribution section (stats and heatmap) is no longer shown, preventing empty or confusing UI elements.
The solution adds a simple check to see whether any contribution data actually exists before rendering the contribution section. If there’s no activity, the entire section is skipped, so users only see meaningful information.
This is a UI-only change. It doesn’t modify backend logic or alter the behavior for entities that already have contribution data — those continue to work exactly as before.
Test Plan
Manual verification of contribution rendering logic
Entities with zero contributions do not render stats or heatmap
Entities with contribution data render as before
Checklist
make check-testlocally: all warnings addressed, tests passed