Skip to content

feat: implement dynamic category icon mapping and unit tests#224

Merged
dDevAhmed merged 1 commit into
DigiNodes:mainfrom
yunus-dev-codecrafter:fix/category-icon-mapping
Jun 1, 2026
Merged

feat: implement dynamic category icon mapping and unit tests#224
dDevAhmed merged 1 commit into
DigiNodes:mainfrom
yunus-dev-codecrafter:fix/category-icon-mapping

Conversation

@yunus-dev-codecrafter

Copy link
Copy Markdown
Contributor

closes #177

Title: Refine and implement: Incorrect category icon mapping

Description

This PR addresses the incorrect category icon mapping identified during the audit (Internal Ref #FE-177). It replaces hardcoded icons with a centralized, dynamic mapping system that supports various claim categories and includes a robust fallback mechanism.

Changes

  • Centralized Mapping Utility: Created category-icons.tsx to manage the association between categories and Lucide icons.
  • Dynamic Icon Retrieval: Implemented getCategoryIcon with normalization logic (case-insensitive, trimming) to ensure reliable matching.
  • UI Integration:
    • Updated ActiveClaimsTable.tsx to display category-specific icons in the main feed.
    • Updated ClaimStats.tsx to replace generic icons with specific ones in the claim detail view.
  • Unit Testing: Added category-icons.test.tsx to verify mapping accuracy, normalization, and fallback behavior.

Mapped Categories

Category Icon
Climate Cloud
Health Activity
Technology Cpu
Misinformation AlertCircle
Fraud AlertTriangle
Politics Globe
Others (Fallback) FileText

Verification & Testing

  • Unit Tests: All tests passed, covering exact matches, case variations, and empty inputs.
  • UI/UX: Verified that icons render correctly across different components without regressions.
  • Integrity: Ensured no impact on the underlying data structures or protocol invariants.

@dDevAhmed dDevAhmed merged commit 7093786 into DigiNodes:main Jun 1, 2026
1 check failed
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.

Incorrect category icon mapping

2 participants