-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[WEB - 2779] feat: Added sort order for issue activity #6087
Conversation
WalkthroughA new React functional component named Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (4)
web/ce/components/issues/worklog/activity/sort-root.tsx (1)
9-12
: Consider enhancing type definitions for better maintainability.While the types are functionally correct, consider these improvements:
- Extract the sort order type to a reusable enum
- Add JSDoc comments to document the purpose and usage
+/** Sort order options for activity list */ +export enum ActivitySortOrder { + ASC = 'asc', + DESC = 'desc' +} +/** Props for ActivitySortRoot component + * @property {ActivitySortOrder} sortOrder - Current sort direction + * @property {() => void} toggleSort - Callback to toggle sort direction + */ export type TActivitySortRoot = { - sortOrder: 'asc' | 'desc' + sortOrder: ActivitySortOrder toggleSort: () => void }web/ce/store/issue/issue-details/activity.store.ts (1)
112-114
: Consider a more concise implementation.While the implementation is correct, it could be more concise.
Consider this improvement:
- toggleSortOrder = ()=>{ - this.sortOrder = this.sortOrder === 'asc' ? 'desc' : 'asc'; - } + toggleSortOrder = () => this.sortOrder = this.sortOrder === 'asc' ? 'desc' : 'asc';web/core/components/issues/issue-detail/issue-activity/root.tsx (2)
47-47
: Consider adding type annotations for sort-related properties.While the hook usage is correct, adding TypeScript type annotations for
sortOrder
andtoggleSortOrder
would improve type safety and documentation.- activity: { sortOrder, toggleSortOrder}, + activity: { sortOrder: 'asc' | 'desc', toggleSortOrder: () => void },
167-167
: Consider adding ARIA labels for accessibility.While the sort control integration looks good, consider enhancing accessibility by adding appropriate ARIA labels to help screen reader users understand the sorting functionality.
- <ActivitySortRoot sortOrder={sortOrder} toggleSort={toggleSortOrder}/> + <ActivitySortRoot + sortOrder={sortOrder} + toggleSort={toggleSortOrder} + aria-label="Sort issue activities" + aria-controls="issue-activity-list" + />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
web/ce/components/issues/worklog/activity/sort-root.tsx
(1 hunks)web/ce/store/issue/issue-details/activity.store.ts
(4 hunks)web/core/components/issues/issue-detail/issue-activity/root.tsx
(3 hunks)
🔇 Additional comments (8)
web/ce/components/issues/worklog/activity/sort-root.tsx (2)
1-8
: LGTM! Imports are well-organized and appropriate.
The imports are properly structured with external dependencies first, followed by internal utilities.
1-19
: Verify integration with issue activity sorting.
The component implements a generic sort UI, but we should verify its integration with the issue activity sorting by creation date.
✅ Verification successful
Sort implementation correctly integrates with issue activity creation date sorting
The verification confirms that:
- The
ActivitySortRoot
component is properly integrated with the activity store - The activity store implements sorting by creation date using
orderBy(activityComments, (e)=>new Date(e.created_at||''), this.sortOrder)
- The sort order toggle functionality is correctly wired from the UI component through to the store
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the implementation of sorting by creation date in the parent components and stores
# Check for sort implementation in related files
echo "Checking sort implementation in activity store..."
rg -l "sortOrder" --type typescript web/ce/store/issue/issue-details/
# Check for creation date usage in sorting
echo "Checking creation date sorting..."
rg -l "createdAt|created_at.*sort" --type typescript web/ce/store/issue/issue-details/
Length of output: 414
Script:
#!/bin/bash
# Let's try a different approach to find the sorting implementation
# Search for activity-related files and sort implementation
echo "Searching for activity-related files with sort implementation..."
rg -l "sortOrder|sort.*activity" web/
# Look for creation date sorting in the codebase
echo "Searching for creation date sorting..."
rg -l "createdAt.*sort|created_at.*sort" web/
# Check for activity store implementations
echo "Looking for activity store files..."
fd "activity|activities" web/ce/store/
Length of output: 922
Script:
#!/bin/bash
# Let's examine the activity store implementation to verify the sorting logic
# Check the activity store implementation
echo "Examining activity store sorting implementation..."
rg -A 10 "sortOrder|sort.*activity" web/ce/store/issue/issue-details/activity.store.ts
# Check the activity root component to understand the integration
echo "Checking activity root component..."
rg -A 10 "sortOrder|sort.*activity" web/core/components/issues/issue-detail/issue-activity/root.tsx
Length of output: 2608
web/ce/store/issue/issue-details/activity.store.ts (4)
5-5
: LGTM!
The orderBy
import from lodash is appropriate for implementing the sorting functionality.
32-32
: LGTM!
The interface changes are well-defined with appropriate types for the sorting functionality.
Also applies to: 40-40
45-45
: LGTM!
The store property and MobX decorators are correctly implemented following MobX patterns.
Also applies to: 56-56, 62-62
Line range hint 1-150
: Verify integration with UI components.
The store changes look good, but let's verify the integration with the UI components mentioned in the AI summary.
✅ Verification successful
Integration with UI components is properly implemented
The verification confirms that:
- The
ActivitySortRoot
component is correctly implemented with the required props (sortOrder
andtoggleSort
) - The component is properly integrated in the issue activity root component, passing the store's
sortOrder
andtoggleSortOrder
values - The sorting functionality is correctly wired up through the component hierarchy
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the integration of sorting functionality in UI components
# Check ActivitySortRoot component usage
echo "Checking ActivitySortRoot component usage:"
rg -A 5 "ActivitySortRoot" web/
# Check usage of toggleSortOrder in IssueActivity component
echo "Checking toggleSortOrder usage in IssueActivity:"
rg -A 5 "toggleSortOrder" "web/core/components/issues/issue-detail/issue-activity/root.tsx"
Length of output: 3088
web/core/components/issues/issue-detail/issue-activity/root.tsx (2)
22-22
: LGTM! Import statement follows project conventions.
The import statement for ActivitySortRoot follows the established project structure and naming conventions.
167-167
: Verify sort integration with IssueActivityCommentRoot.
The sort functionality appears to be properly integrated in the UI, but let's verify if the IssueActivityCommentRoot component is consuming the sort order correctly.
Also applies to: 183-196
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mathalav55 , please check the coderabbit comments and run the lint and build locally.
Description
Sorting functionality for Issue activity.
Implementation
Added sort button for issue activity. Issues are sorted by either ascending or descending Created date.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation