Skip to content

feat: implement theme-aware coding personality calculator widget#562

Open
Sushma-1206 wants to merge 2 commits into
GitMetricsLab:mainfrom
Sushma-1206:feature/night-owl-calculator
Open

feat: implement theme-aware coding personality calculator widget#562
Sushma-1206 wants to merge 2 commits into
GitMetricsLab:mainfrom
Sushma-1206:feature/night-owl-calculator

Conversation

@Sushma-1206
Copy link
Copy Markdown

@Sushma-1206 Sushma-1206 commented May 27, 2026

Related Issue


Description

Implements a responsive, theme-aware "Night Owl vs. Early Bird" coding personality analyzer widget on the Tracker dashboard.

  • Created a robust UTC-based parsing utility to categorize issues and pull requests by chronological contribution time blocks (Morning, Night, and Mid-day).
  • Designed a polished, responsive UI card featuring a dynamic progress distribution bar layout.
  • Integrated fully with Material UI's useTheme context hook to support flawless light and dark mode switching automatically.

How Has This Been Tested?

  • Verified logic functionality locally on multiple user profiles (including Sushma-1206) across 12+ loaded chronological records.
  • Tested hot-reloading responsiveness and component theme switching across light and dark display modes.

Screenshots (if applicable)

(Tip: You can literally drag and drop or paste your browser screenshot right here to show off your beautiful widget!)


Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Added a "Coding Persona" widget that analyzes your contributions and shows early-bird vs night-owl percentages with a dual-segment progress indicator; appears on Dashboard and Tracker when data is available.
  • Bug Fixes

    • Persona calculations now use local time and ignore invalid timestamps so percentages reflect only valid contributions.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 27, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 5f671ae
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1856d4db7a500008f904cc
😎 Deploy Preview https://deploy-preview-562--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @Sushma-1206 for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0df988d6-d87b-4915-8f94-d6b670a9277f

📥 Commits

Reviewing files that changed from the base of the PR and between 5803321 and 5f671ae.

📒 Files selected for processing (1)
  • src/utils/persona.ts

📝 Walkthrough

Walkthrough

Adds a local-time coding persona calculator that skips invalid timestamps, a themed React widget displaying Early Bird vs Night Owl percentages, and integrates the widget into Dashboard and Tracker with conditional rendering when datasets are present.

Changes

Coding Persona Feature

Layer / File(s) Summary
Persona calculation types and logic
src/utils/persona.ts
calculateCodingPersona filters out invalid parsed dates, uses local Date.getHours() to bucket contributions (Early Bird 05–11, Night Owl 22–04, Mid-Day otherwise), computes rounded percentages from valid timestamps, and selects a persona title only on strict dominance.
CodingPersonaWidget component
src/components/CodingPersonaWidget.tsx
New MUI-themed component that merges issues and pullRequests, calls calculateCodingPersona, returns null when totalCount is zero, and otherwise renders persona title, early/night percentages, and a two-segment progress bar styled by theme.
Dashboard integration
src/components/Dashboard.tsx
Imports CodingPersonaWidget, partitions data into passingIssues (no pull_request) and passingPrs (has pull_request), and renders the widget above existing pie/bar charts.
Tracker page integration
src/pages/Tracker/Tracker.tsx
Renders CodingPersonaWidget with issues and prs arrays when !loading and datasets exist, positioned above tabs/table UI to avoid pagination interference.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

type:feature

Poem

🐰 I nibble timestamps at break of day,

and count late-night commits that stay,
With local hours I sort the score,
Early bird or owl — who could want more? 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: implementing a theme-aware coding personality calculator widget, which matches the primary objective of adding the Night Owl vs. Early Bird feature.
Description check ✅ Passed The description follows the template with Related Issue, Description, Testing, and Type of Change sections completed. All key objectives are documented and testing approach is described.
Linked Issues check ✅ Passed The implementation successfully fulfills issue #543 requirements: extracts timestamps from contributions [#543], categorizes into Early Bird (05:00-11:59) and Night Owl (22:00-04:59) buckets [#543], displays a responsive analytics card with personality badge and progress bar [#543], and integrates Material UI theming for light/dark mode support.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #543 objectives: new CodingPersonaWidget component, persona.ts utility for time-bucket calculations, Dashboard and Tracker integration for display. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/persona.ts`:
- Around line 26-27: The code currently uses UTC hours via the const hour =
date.getUTCHours() statement which conflicts with the local-time objective;
change this to use the local hour (e.g., date.getHours()) or accept/convert
using a provided timezone parameter before bucketing so persona reflects user
local activity timing—update the reference in the function that contains hour
(the line with const hour = date.getUTCHours()) and adjust any downstream logic
that uses hour for bucketing accordingly.
- Around line 24-43: The code uses date = new Date(dateString) then hour =
date.getUTCHours() without validating the Date, so invalid dateStrings produce
NaN and always fall into the else (midDay) bucket; fix by validating the parsed
Date immediately after const date = new Date(dateString) using
isNaN(date.getTime()) (or Number.isNaN(hour)) and, for invalid timestamps, skip
bucketing (e.g., continue the loop or return early) without touching
earlyBirdCount, nightOwlCount, midDayCount, or validTimestampsCount; optionally
increment or log an invalidTimestampCount for metrics.
- Line 4: The persona bucketing code is counting invalid dates as valid and
placing them into the “Mid-Day” bucket because it uses new Date(dateString)
without validating; update the logic that parses timestamps (the code that
constructs Date from the incoming timestamp used with getUTCHours()) to first
check for invalid dates via isNaN(date.getTime()) and skip/ignore (and do not
increment validTimestampsCount) when invalid. Also tighten the ContributionItem
type by removing or narrowing the [key: string]: any index signature if
possible, and confirm whether the bucketing should use UTC (getUTCHours()) or
local time (getHours()) and switch accordingly or add explicit timezone handling
so the intended local-time behavior is enforced.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8e23419-ac52-4abb-ad51-5a9c437742f7

📥 Commits

Reviewing files that changed from the base of the PR and between 4ae0ef6 and 5803321.

📒 Files selected for processing (4)
  • src/components/CodingPersonaWidget.tsx
  • src/components/Dashboard.tsx
  • src/pages/Tracker/Tracker.tsx
  • src/utils/persona.ts

Comment thread src/utils/persona.ts
Comment thread src/utils/persona.ts
Comment thread src/utils/persona.ts Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add "Night Owl vs. Early Bird" coding personality calculator widget to Tracker dashboard

1 participant