Skip to content

Restructure addon detail page header #13638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

KevinMind
Copy link
Contributor

@KevinMind KevinMind commented Jun 19, 2025

Fixes #15626

Description

This PR:

  • creates a promoted.js utility file for promoted related utils
  • merges PromotedBadge and Badge to have a universal badge component
  • adds the RatingBadge component to the addon header
  • Restructure and relayout the addon header
  • Remove the AddonMeta card
  • Move the Rate your experience below addon summary

Context

Given we now have multiple use cases for pilled/linked badges and to make the code more reusable, I've merged the Promotedbadge to the badge component. Now a badge is a badge and you can make it pilled, linkable small/large etc in any context. You can also easily control what UI is renedered due to the compound component API.

Testing

Screen.Recording.2025-06-20.at.17.56.46.mov

Badges are rendered in 4 locations. You'll want to test all breakpoints for all 4 locations.

Search Results

Search for "promoted" you will get promoted results for sure on dev.

image

Addon Header

Click on an addon that is promoted or has reviews. Verify on correct and incorrect and non-android to get all combination of badges.

Bonus points, check an addon that has multiple promoted groups and make sure you still only see one.

image

More Addons

Addon section suggesting more addons, if promoted should see badge with "small" variant of icon/text

image

Search Suggest

When typing in the search box on the right you will see the badge icon (only icon)

image

@KevinMind KevinMind force-pushed the kevinmind/addons/15626 branch from 10278aa to 7ceb5c8 Compare June 19, 2025 15:51
@KevinMind KevinMind changed the title This is a mess WIP restructure addon detail page header Jun 20, 2025
@KevinMind KevinMind force-pushed the kevinmind/addons/15626 branch 3 times, most recently from db7ae51 to 6fe7f25 Compare June 20, 2025 14:50
@KevinMind KevinMind force-pushed the kevinmind/addons/15626 branch from 6fe7f25 to afff8d0 Compare June 20, 2025 14:57
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 97.43590% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.27%. Comparing base (28ec69b) to head (db93824).
Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
src/amo/components/Badge/index.js 90.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13638      +/-   ##
==========================================
- Coverage   98.29%   98.27%   -0.03%     
==========================================
  Files         268      266       -2     
  Lines       10663    10638      -25     
  Branches     3280     3252      -28     
==========================================
- Hits        10481    10454      -27     
- Misses        169      171       +2     
  Partials       13       13              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@KevinMind KevinMind force-pushed the kevinmind/addons/15626 branch from 239da69 to f20b4ba Compare June 20, 2025 16:26
@KevinMind KevinMind force-pushed the kevinmind/addons/15626 branch from f20b4ba to db93824 Compare June 20, 2025 16:29
@KevinMind KevinMind requested review from a team, diox, Copilot and eviljeff and removed request for a team and diox June 21, 2025 10:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Restructure the addon detail page header by unifying badge components, extracting promoted badge logic, and adding a rating badge.

  • Introduce src/amo/utils/promoted.js and remove getPromotedBadgesLinkUrl from the main utils.
  • Merge PromotedBadge into the new universal Badge component (with BadgeIcon/BadgeContent) and update all usages and tests.
  • Refactor AddonBadges and page layout to include the new rating badge, remove AddonMeta, and adjust header styles.

Reviewed Changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/amo/utils/promoted.js New file housing promoted badge URL and props helpers
src/amo/components/Badge/index.js Universal Badge component with new API and test IDs
src/amo/components/AddonBadges/index.js Refactored badge renderer, added rating badge, removed AddonMeta
src/blog-utils/index.js Added createBrowserHistory and addQueryParamsToHistory integration
src/amo/utils/index.js Removed getPromotedBadgesLinkUrl export from general utils
Comments suppressed due to low confidence (2)

src/blog-utils/index.js:16

  • The function addQueryParamsToHistory isn't exported by src/amo/utils/index.js. Either re-export it there or import it from its actual module (e.g., amo/utils/url).
import { addQueryParamsToHistory } from 'amo/utils';

src/amo/components/AddonBadges/index.js:133

  • The type prop 'star-full' is not included in the BadgeType union definition, which may lead to Flow type errors. Consider adding 'star-full' to BadgeType or using an existing type.
      <Badge link={reviewsLink} type="star-full" label={reviewsLabel}>

@KevinMind KevinMind marked this pull request as ready for review June 23, 2025 13:36
@KevinMind
Copy link
Contributor Author

@eviljeff PR is stable and ready to verify

@KevinMind KevinMind changed the title WIP restructure addon detail page header Restructure addon detail page header Jun 23, 2025
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