Skip to content

fix: add +N pop animations to "Your Tab (Running)" strip#97

Merged
nitrocode merged 2 commits into
mainfrom
copilot/fix-plus-number-animation
Apr 26, 2026
Merged

fix: add +N pop animations to "Your Tab (Running)" strip#97
nitrocode merged 2 commits into
mainfrom
copilot/fix-plus-number-animation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 26, 2026

The "🍺 Your Tab (Running)" stat items (water, trees, charges, metres) incremented every second but never showed the floating +N pop animations present on every other counter — because spawnPop() was never called for them, and .session-tab-item lacked the CSS prerequisites for absolute positioning.

Changes

  • styles/scary-features.css — Added position: relative; overflow: visible to .session-tab-item, matching the same pattern used by .counter-box and .impact-stat.
  • styles/counter-milestones.css — Added .token-pop--tab colour variant (orange, matching .sti-val).
  • src/js/18-scary-features.js:
    • Extracted WATER_PER_COFFEE_L, KWH_PER_CHARGE, CO2_PER_METRE_KG constants to eliminate the duplicated magic numbers between session totals and per-second delta calculations.
    • Added _lastTabPop throttle variable and once-per-second spawnPop() calls for each of the 4 stat items, using calculateEnvironmentalImpact(rate) for per-second deltas — the same approach as the impact stats section in 02-counter.js.
if (now - _lastTabPop >= 1000) {
  _lastTabPop = now;
  const impactPerSec = calculateEnvironmentalImpact(rate);
  [
    { el: waterEl,  val: impactPerSec.waterL / WATER_PER_COFFEE_L },
    { el: treesEl,  val: impactPerSec.treesEquivalent },
    { el: chargeEl, val: impactPerSec.kWh / KWH_PER_CHARGE },
    { el: metresEl, val: impactPerSec.co2Kg / CO2_PER_METRE_KG },
  ].forEach(({ el, val }) => {
    if (!el || val < MIN_TAB_POP_THRESHOLD) return;
    spawnPop(el.closest('.session-tab-item'), '+' + fmtSmall(val), 'token-pop--tab');
  });
}

Summary by CodeRabbit

  • New Features

    • Real-time floating pop animations now display per-second environmental impact changes for tracked activities with performance optimizations.
  • Style

    • Updated styling for impact animations with enhanced visual appearance and improved positioning.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Yo, I tell ya, fool! These changes be addin' floating "+N" pop animations to the session-tab environmental impact metrics, ya feel me? The code introduces shared conversion constants and throttles the update mechanism at 1-second intervals. Plus, new orange-styled pop tokens get spawned when them per-second deltas pass the threshold, and layout properties get adjusted for absolute positioning, sucka!

Changes

Cohort / File(s) Summary
Session-Tab Pop Animation Logic
src/js/18-scary-features.js
Added shared conversion constants for coffee, smartphone, and CO₂ metrics. Updated updateSessionTabStrip() to throttle (once per second), compute per-second environmental deltas, apply thresholds, and trigger spawnPop for .session-tab-item elements with formatted increments, fool!
Pop Token Styling
styles/counter-milestones.css
New .token-pop--tab CSS class defines orange/accent-2 text color, orange glow via text-shadow, and 0.7rem font size for session-tab pop animation visuals, sucka!
Session-Tab Layout
styles/scary-features.css
Updated .session-tab-item styling with position: relative and overflow: visible to support absolutely positioned pop children elements, ya heard?

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: adding pop animations to the tab running strip with specific visual feedback (+N indicators).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch copilot/fix-plus-number-animation

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

@nitrocode nitrocode self-requested a review as a code owner April 26, 2026 23:51
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bcd649d) to head (10f8e15).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main       #97   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          242       242           
  Branches       109       109           
=========================================
  Hits           242       242           
Flag Coverage Δ
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcd649d...10f8e15. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

github-actions Bot added a commit that referenced this pull request Apr 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👁️ PR Preview

🚀 Open Preview

Deployed from commit 10f8e15 · Updates on every push to this PR
(Preview is removed automatically when the PR is closed.)

Screenshots

Desktop Mobile
Desktop Mobile

github-actions Bot added a commit that referenced this pull request Apr 26, 2026
@nitrocode nitrocode merged commit c11d5e0 into main Apr 26, 2026
8 of 9 checks passed
@nitrocode nitrocode deleted the copilot/fix-plus-number-animation branch April 26, 2026 23:54
github-actions Bot added a commit that referenced this pull request Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants