Skip to content

Redesign the monthly badges popover - #812

Draft
ilicfilip wants to merge 4 commits into
developfrom
filip/monthly-badges-popover
Draft

ilicfilip wants to merge 4 commits into
developfrom
filip/monthly-badges-popover

Conversation

@ilicfilip

@ilicfilip ilicfilip commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Implements https://github.com/ProgressPlanner/progress-planner-pro/issues/191 (step 1: the monthly badges popover)

Design: Figma popover-badges, frames "stats page popover monthly" (+ "info" for spacing), "Component 2" (missed hover) and "badge + icon 1" (in-progress hover).

What this does

  • Widget link: "Show all badges" → "Show all my monthly badges!" (monthly widget only).
  • Top row: intro card ("You've worked on your site with Progress Planner for N months now.") and two totals: monthly badges earned and tasks completed.
  • Per year, newest first: badges in a 4-column grid, with "badges earned" and "tasks completed" cards beside it. The layout steps down for narrower popovers (container queries).
  • Missed badge hover (previous two months, not complete — the rule from pro#155): the badge shows in colour and a "! N points to go" pill appears. "Points", not "tasks", because some tasks are worth more than one point (e.g. the Yoast workouts give 3). N matches the widget's "N more points to go".
  • In progress hover (current month, not complete): the badge shows in colour, wobbles briefly (CSS only, per pro#88) and its label changes to "In progress". No wobble with prefers-reduced-motion.
  • Badges with a hover state are focusable, so keyboard users get the same states.
  • The white ring around the missed-badge "!" uses --prpl-background-paper instead of #fff.
  • All colours use existing variables; no new names.

Deliberately not changed (until pro#190)

The design shows only monthly badges. The content and streak badge groups, and the progress_planner_popover_after_badge_groups hook pp-hosts uses for its onboarding badges, stay below the monthly section for now: the streak and content widgets still open this popover, and pp-hosts still renders into it. They move out when pro#190 gives them their own popovers.

Notes for design

  1. Intro copy uses "You can find the results of your hard work here!" (the design has "find result").
  2. Months are counted as started months: a site activated this month shows "1 month".
  3. "Tasks completed" counts every completed recommendation and golden to-do task in that year.
  4. Already the case on develop: the popover is rendered three times on the page (once by each of the monthly, content and streak widgets). This goes away with pro#190.

Follow-up outside this repo

  • branding-api tokens.json: add progress-planner to readBy of --prpl-font-size-xl (used for the year headings; the tokens check warns about it).

Testing

  1. Open the Progress Planner dashboard and click "Show all my monthly badges!".
  2. Check the summary cards and the per-year sections.
  3. Hover (or Tab to) a missed badge: the pill shows the points left. Hover the current month's badge if it is not complete yet: "In progress" and a wobble.
  4. Narrow the window: the cards and grid rearrange without overflowing.

Checked in the browser on the Zonnet brand at 1400px, 800px and 420px; console clean. Multiple years were checked by temporarily setting the activation date to November 2024 (2026, 2025 and Nov–Dec 2024 shown; settings restored afterwards). New PHPUnit tests cover the months count, the missed / in-progress / complete states and the per-year counts; the full suite passes. composer check-cs, PHPStan and CSS lint pass.

Screenshots

Screenshot 2026-11-25 at 12 05 46

The popover now opens with three cards: how long the site has used
Progress Planner, the monthly badges earned and the tasks completed.
Each year follows, newest first, with its badges in a four-column grid
and its own badges-earned and tasks-completed numbers.

Hovering (or tabbing to) a badge that can still be earned shows how
many points are left; the current month's badge shows "In progress"
with a short wobble, which is off for reduced motion. The widget link
now reads "Show all my monthly badges!".

The content and streak badges, and the hook pp-hosts uses to add its
onboarding badges, stay below the monthly section until they get their
own popovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Test on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Plugin readme preview

Open preview · Commit 9bf62d3

35 passed · 0 warnings · 2 notes

Notes (2)
  • screenshot-8.png has no caption in the Screenshots section.
  • screenshot-9.png has no caption in the Screenshots section.
Passed checks (35)
  • 144 / 150 characters in the short description.
  • Plugin name header recognized.
  • License header recognized: GPL3+.
  • 4 tags accepted within the five-tag limit.
  • Description is within the parser’s word limit.
  • Installation is within the parser’s word limit.
  • Faq is within the parser’s word limit.
  • Changelog is within the parser’s word limit.
  • Tested up to 7.1, the latest WordPress major release.
  • Stable tag is declared: 1.10.1.
  • The PHP Version header is declared: 1.10.1.
  • Stable tag matches the PHP Version header: 1.10.1.
  • The readme “Requires at least” value is valid: 6.7.
  • The PHP “Requires at least” header is a numeric version: 6.7.
  • “Requires at least” matches between the readme and PHP header: 6.7.
  • The readme “Requires PHP” value is valid: 7.4.
  • The PHP “Requires PHP” header is a numeric version: 7.4.
  • “Requires PHP” matches between the readme and PHP header: 7.4.
  • “Tested up to” 7.1 meets the minimum WordPress version 6.7.
  • Installation content is present.
  • FAQ content is present.
  • Changelog content is present.
  • Screenshot captions are present.
  • The first changelog release matches Stable tag: 1.10.1.
  • The first changelog release matches PHP Version: 1.10.1.
  • Banner image loaded.
  • Plugin icon loaded.
  • Screenshot 1 has a matching image and caption.
  • Screenshot 2 has a matching image and caption.
  • Screenshot 3 has a matching image and caption.
  • Screenshot 4 has a matching image and caption.
  • Screenshot 5 has a matching image and caption.
  • Screenshot 6 has a matching image and caption.
  • Screenshot 7 has a matching image and caption.
  • Plugin PHP header loaded.

Readme and PHP-header checks only; this does not test plugin runtime compatibility.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 35.69% 📉
Base Coverage 35.07%
Difference 📈 0.62%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

📊 File-level Coverage Changes (3 files)

📈 Coverage Improved

Class Before After Change
Progress_Planner\Admin\Widgets\Monthly_Badges 0.00% 61.96% +61.96%
Progress_Planner\Badges\Monthly 75.76% 93.94% +18.18%

📉 Coverage Decreased

Class Before After Change
Progress_Planner\Badges 67.21% 52.46% -14.75%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

@github-actions

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

ilicfilip and others added 2 commits November 25, 2026 12:35
32px inside the popover (--prpl-gap) and 6px between a badge and its
name. No spacing variable gives 6px, so it is set directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The popover asked each badge for its progress up to three times (for the
yearly numbers, the template and the hover state), and the hover state
also re-checked the previous two months for every badge. Each call on an
unfinished badge saves its progress, so one render tried to write the
settings 23 times on a site with four badges. Progress and hover state
are now worked out once per badge in get_popover_stats(), and the
template reads them from there: 5 writes on the same site.

The yearly "tasks completed" counted from 1 January, but the first
year's badges start later (November 2024, or the month of activation),
so earlier tasks were counted too. It now counts from the first badge
month of that year.

The hover details ("N points to go", "In progress") also show on focus,
so a tap on a touch screen reveals them; the outline stays for keyboard
focus only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ilicfilip

Copy link
Copy Markdown
Collaborator Author

Review pass: what changed and why

Re-checked against pro#191 and the Figma spacing frame ("stats page popover monthly info"), and had the code reviewed again.

Spacing from the design (0894ec4)

  • 32px inside the popover, using var(--prpl-gap). It was the shared 20px.
  • 6px between a badge and its name. No spacing variable gives 6px (--prpl-gap / --prpl-padding with the usual / 2, / 4, * 1.5 steps), so it's set directly with a comment. The badge's own 8px grid gap is removed inside the popover so the 6px is the only space.

Work out each badge once (3a5d7bf)

  • The popover asked each badge for its progress up to three times: for the yearly numbers, the template and the hover state. The hover state also re-checked the previous two months for every badge.
  • Every call on an unfinished badge saves its progress, which writes the plugin settings.
  • On a test site with 4 badges, one render tried 23 settings writes; it's now 5. A site active since 2024 has about 26 badges, so the saving grows with it. Before this PR the popover was also rendered 3 times per page.
  • Progress and hover state are now worked out once per badge in get_popover_stats(), and the template reads them from there.

Yearly "tasks completed" (3a5d7bf)

  • It counted from 1 January, but the first year's badges start later (November 2024, or the month of activation). Tasks from before that were counted too. It now counts from the first badge month of that year.

Touch screens (3a5d7bf)

  • "N points to go" and "In progress" only showed on hover or keyboard focus, so touch users never saw them. They now also show on focus, which a tap gives. The focus outline stays for keyboard users only.

Not changed

  • Counting tasks with a SQL COUNT(*) instead of loading the rows: query_activities() drops duplicate activities, so a raw count could disagree with the badge numbers. The query is cached.

New tests cover the first-badge-month count and the per-badge data. The full suite passes, and the popover was checked in the browser.

The tour opens the monthly badges popover on one step. A popover sits
above everything else, including the tour box, and the redesigned
popover is taller: on a 1280x720 screen it covered the tour's Next
button (the e2e tour test failed on that). While the tour shows it, the
popover now stays at the top with a lower maximum height, so the tour
box fits below.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ilicfilip

Copy link
Copy Markdown
Collaborator Author

CI: e2e tour test fixed (9bf62d3)

Why it failed: the tour opens the monthly badges popover on one step. A popover sits above everything else, including the tour box. The redesigned popover is taller, and on Playwright's 1280×720 screen it covered the tour's "Next" button. On develop the button was clear by only a few pixels.

Fix: while the tour shows the popover, it stays at the top of the screen with a lower maximum height, so the tour box fits below it. Checked in the browser at 1280×720: every tour step's "Next" button is clickable. This also helps real users on short screens, not just the test.

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.

1 participant