[WEB-5574]chore: notification card refactor
Description
This update refactors notification card render to use map improving the structure and extensibility of the render logic.
Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Feature (non-breaking change which adds functionality)
- [ ] Improvement (change that would cause existing functionality to not work as expected)
- [x] Code refactoring
- [ ] Performance improvements
- [ ] Documentation update
Screenshots and Media (if applicable)
Test Scenarios
References
Summary by CodeRabbit
- Refactor
- Enhanced notification content system with improved extensibility and configurability.
- Optimized activity filtering logic for better performance and maintainability.
- Streamlined notification rendering architecture for consistent field handling.
✏️ Tip: You can customize this high-level summary in your review settings.
[!IMPORTANT]
Review skipped
Draft detected.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
Refactoring introduces an extensible map-based notification content system for core notifications with CE-specific extensions, while extracting base activity filter types to a shared constants package for reuse across components.
Changes
| Cohort / File(s) | Summary |
|---|---|
Shared Constants Extraction packages/constants/src/issue/filter.ts |
Adds BASE_ACTIVITY_FILTER_TYPES constant containing ACTIVITY, STATE, ASSIGNEE, and DEFAULT filter types for centralized reuse. |
Core Notification Content System apps/web/core/components/workspace-notifications/sidebar/notification-card/content.tsx |
Introduces TNotificationFieldData, TNotificationContentDetails, TNotificationContentHandler, TNotificationContentMap types and BASE_NOTIFICATION_CONTENT_MAP constant; refactors rendering logic from inline conditionals to map-based field handler lookup with extensibility hooks for additional content maps. |
CE Notification Extensions apps/web/ce/components/workspace-notifications/notification-card/content.ts |
Adds ADDITIONAL_NOTIFICATION_CONTENT_MAP extension point with helper functions: renderAdditionalAction, renderAdditionalValue, shouldShowConnector, shouldRender to augment core notification behavior. |
Activity Filter Refactoring apps/web/core/components/issues/issue-detail/issue-activity/activity-comment-root.tsx |
Consolidates imports of EActivityFilterType to type-only and adds named import of BASE_ACTIVITY_FILTER_TYPES; removes local constant definition and uses imported shared constant. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Areas requiring focus:
- Verify BASE_NOTIFICATION_CONTENT_MAP field handler logic correctly mirrors previous inline rendering behavior
- Confirm getNotificationContentDetails resolution order and fallback behavior between base and additional maps
- Check that CE extension hooks (renderAdditionalAction, renderAdditionalValue, shouldRender, shouldShowConnector) are properly integrated with core rendering flow
- Validate activity filter constant extraction maintains filter behavior in activity-comment-root component
Poem
🐰 Maps and constants, oh what delight!
Extensible patterns, refactored just right.
From inline to handlers, we've cleared up the mess,
CE extensions bloom—this codebase is blessed! 🌱
Pre-merge checks and finishing touches
❌ Failed checks (1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | ❓ Inconclusive | The description covers the main purpose (refactoring to use map-based rendering) and correctly identifies the change type, but lacks detail on implementation and reasoning. | Expand the description to explain why the map-based approach improves extensibility and include how this enables CE extensions through the ADDITIONAL_NOTIFICATION_CONTENT_MAP pattern. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately summarizes the main change: refactoring the notification card component to use a map-based rendering approach. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.