Skip to content

Refactor ProfileCard to render Meshmate badges dynamically via frontm… - #7893

Open
debkarma wants to merge 2 commits into
layer5io:masterfrom
debkarma:fix/profile-card
Open

Refactor ProfileCard to render Meshmate badges dynamically via frontm…#7893
debkarma wants to merge 2 commits into
layer5io:masterfrom
debkarma:fix/profile-card

Conversation

@debkarma

@debkarma debkarma commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Description
This PR fixes #7885

The ProfileCard component was previously using hardcoded member names (e.g. name === "Nikhil Ladha") to conditionally render "Meshmate of the Year" SVG badges.

This PR refactors the logic to be completely dynamic:

  1. Created a meshmateBadges dictionary to map badge strings to their imported SVGs.
  2. The component now loops over the badges array passed from the member's markdown frontmatter.
  3. If a badge in the frontmatter matches a key in the dictionary (e.g. meshmate2020 or meshmate2021), the corresponding SVG is rendered.
  4. Added the meshmate2021 badge to aditya-chatterjee/index.mdx so his badge renders correctly without hardcoding his name.

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • New Features
    • Added support for dynamically rendering “meshmate of the year” badges on profile cards based on each profile’s configured badge tags.
    • Profile cards now automatically show the matching badge icon when available, removing prior hardcoded badge logic.
  • Updates
    • Added the 2021 Meshmate badge to Aditya Chatterjee’s profile.
    • Profiles can now display the correct badge set using the badge configuration.

…atter

Signed-off-by: Debajyoti Karmakar <debkarma97@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cfa32269-f130-477e-b9bb-6eec4baeeeed

📥 Commits

Reviewing files that changed from the base of the PR and between c1cc6f4 and 2d81632.

📒 Files selected for processing (1)
  • src/components/Profile-card/index.js

📝 Walkthrough

Walkthrough

The profile adds a meshmate2021 badge, and ProfileCard now renders Meshmate badges from frontmatter data using a badge-to-icon lookup instead of name-specific conditions.

Changes

Dynamic Meshmate badges

Layer / File(s) Summary
Badge frontmatter and dynamic rendering
src/collections/members/aditya-chatterjee/index.mdx, src/components/Profile-card/index.js
The profile declares meshmate2021; ProfileCard maps badge identifiers to SVG icons and renders matching linked images dynamically.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: dynamic Meshmate badge rendering from frontmatter.
Linked Issues check ✅ Passed The component now removes hardcoded name checks and uses frontmatter badges for dynamic Meshmate rendering.
Out of Scope Changes check ✅ Passed The changes stay focused on Meshmate badge rendering and the related profile frontmatter update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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/components/Profile-card/index.js`:
- Around line 29-42: Update the badge image alt text in the badges.map callback
of the Profile card so it identifies the specific badge represented by each
badge key, such as “MeshMate 2020 badge” or “MeshMate 2021 badge,” instead of
using the same generic text for every image. Keep the existing generic icon
behavior unchanged.
- Around line 14-16: Update the ProfileCard component signature to destructure
frontmatter and cardlink directly from its props, then derive name, status,
image_path, meshmate, and badges from the destructured frontmatter while using
cardlink directly. Remove the intermediate props access and preserve the
existing rendering behavior.
- Around line 20-43: Move the badge link rendering in the profile-card component
outside the outer Link to={link}, including the meshmate and mapped badge links,
so they are not nested anchors. Preserve each badge’s existing
/community/meshmates destination and rendering behavior while keeping the
profile content linked through the outer Link.
🪄 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 Plus

Run ID: 2ae90766-cf64-41d6-a8ab-0524815a052f

📥 Commits

Reviewing files that changed from the base of the PR and between 34aed4c and c1cc6f4.

📒 Files selected for processing (2)
  • src/collections/members/aditya-chatterjee/index.mdx
  • src/components/Profile-card/index.js

Comment thread src/components/Profile-card/index.js Outdated
Comment thread src/components/Profile-card/index.js Outdated
Comment thread src/components/Profile-card/index.js Outdated
Signed-off-by: Debajyoti Karmakar <debkarma97@gmail.com>
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.

[Profile-card] Refactor component to remove hardcoded Meshmate names

1 participant