Skip to content
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

chore: Remove sorting button (#1392) #1396

Merged
merged 2 commits into from
Nov 25, 2024
Merged

chore: Remove sorting button (#1392) #1396

merged 2 commits into from
Nov 25, 2024

Conversation

alexdigdir
Copy link
Collaborator

@alexdigdir alexdigdir commented Nov 25, 2024

Hva er endret?

Related Issue(s)

Dokumentasjon / Storybook / testdekning

  • Dokumentasjon er oppdatert eller ikke relevant / nødvendig.
  • Ny komponent har en eller flere stories i Storybook, eller så er ikke dette relevant.
  • Det er blitt lagt til nye tester / eksiterende tester er blitt utvidet, eller tester er ikke relevant.

Skjermbilder eller GIFs (valgfritt)

Summary by CodeRabbit

  • New Features

    • The toolbar now focuses solely on filtering and saving actions, with the sorting feature removed.
  • Bug Fixes

    • Removed references to sorting functionality, simplifying the user experience in the Inbox component.
  • Documentation

    • Updated localization files to reflect the removal of sorting options in both English and Norwegian.
  • Chores

    • Deleted unused components and styles related to sorting, streamlining the codebase.

@alexdigdir alexdigdir requested a review from a team as a code owner November 25, 2024 10:15
Copy link

coderabbitai bot commented Nov 25, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request implements significant changes by removing the sorting functionality from the FosToolbar and related components. The SortOrderDropdown component and its associated styles have been deleted, along with the relevant localization entries for sorting. Modifications in the Inbox component eliminate sorting logic and references, simplifying the user interface to focus solely on filtering. Additionally, the handling of sorting through URL parameters has been removed, indicating a complete shift away from sorting features in the application.

Changes

File Path Change Summary
packages/frontend/src/components/FosToolbar/FosToolbar.tsx Removed onSortBtnClick prop and associated functionality; updated FosToolbarProps interface.
packages/frontend/src/components/SortOrderDropdown/*.tsx Deleted SortOrderDropdown.tsx, which included sorting dropdown logic and associated types.
packages/frontend/src/components/SortOrderDropdown/index.ts Deleted index.ts, removing export for SortOrderDropdown component.
packages/frontend/src/components/SortOrderDropdown/sortOrderDropdown.module.css Deleted CSS file containing styles for the dropdown component.
packages/frontend/src/components/index.ts Removed export for SortOrderDropdown component.
packages/frontend/src/i18n/resources/en.json Removed localization entry for the "Sort" button.
packages/frontend/src/i18n/resources/nb.json Removed localization entry for the "Sorter" button.
packages/frontend/src/pages/Inbox/Inbox.tsx Removed SortOrderDropdown, sorting logic, and related state management.
packages/frontend/src/pages/Inbox/queryParams.ts Removed import for SortingOrder type and the getSortingOrderFromQueryParams function.

Suggested labels

dev

Suggested reviewers

  • seanes

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 084d048 and 9e9c21f.

📒 Files selected for processing (1)
  • packages/storybook/src/stories/SortOrderDropdown/sortOrderDropdown.stories.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/storybook/src/stories/SortOrderDropdown/sortOrderDropdown.stories.tsx

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
packages/frontend/src/components/FosToolbar/FosToolbar.tsx (2)

13-18: Update JSDoc comment to remove sorting references

The component's documentation still mentions sorting functionality that has been removed.

Apply this change to the JSDoc comment:

 /*
- * FosToolbar is a floating toolbar that is only visible on mobile and contains action buttons for filtering, sorting and saving search.
+ * FosToolbar is a floating toolbar that is only visible on mobile and contains action buttons for filtering and saving search.
  * @param onFilterBtnClick - Function that is called when the filter button is clicked.
  * @param onSaveBtnClick - Function that is called when the save button is clicked.
  * @param hideSaveButton - Optional boolean that determines if the save button should be hidden. Default is false
- * @returns A floating toolbar with action buttons for filtering, sorting and saving search.
+ * @returns A floating toolbar with action buttons for filtering and saving search.
  */

Sorting functionality removal needs attention

The verification reveals some remaining sort-related code that needs to be addressed:

  • The SortOrderDropdown component still exists in Storybook (packages/storybook/src/stories/SortOrderDropdown/)
  • Sort-related translations are present in both en.json and nb.json
  • The FosToolbar component's JSDoc still mentions "sorting" functionality
  • There are sort-related utility functions in dateInfo.ts

The sorting functionality hasn't been completely removed from the codebase. Please:

  1. Remove the SortOrderDropdown story from Storybook
  2. Clean up sort-related translations from i18n files
  3. Update FosToolbar's documentation to remove sorting references
  4. Review if the sort functions in dateInfo.ts are still needed
🔗 Analysis chain

Line range hint 1-36: Verify complete removal of sorting functionality

Let's ensure there are no remaining references to sorting functionality in connected components or features.


Let me gather more information to verify if there are any remaining sort-related components or implementation files.


Let me try one more search with a different approach to check for any remaining sort-related implementation code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to sorting in the codebase
echo "Checking for remaining sort-related code..."
rg -i "sort" --type tsx --type ts

echo "Checking for any remaining imports of removed SortOrderDropdown..."
rg -i "SortOrderDropdown"

echo "Checking for any remaining sort-related translations..."
rg -i "sort" --glob "*.json"

Length of output: 1665


Script:

#!/bin/bash
# Check for any SortOrderDropdown component files
fd -e tsx -e ts "SortOrderDropdown"

# Check for any sort-related component files
fd -e tsx -e ts -i "sort"

# Look for sort-related code in the frontend package
rg -i "sort" --type ts --type tsx packages/frontend/src/

Length of output: 225


Script:

#!/bin/bash
# Search for sort-related code in frontend package using find and grep
find packages/frontend/src -type f -name "*.tsx" -o -name "*.ts" | xargs grep -i "sort"

# Check if SortOrderDropdown component still exists in frontend
find packages/frontend/src -type f -name "SortOrderDropdown*"

# Look for any sort-related props or interfaces
ast-grep --pattern 'interface $_ {
  $$$
  sort$_?: $_
  $$$
}'

Length of output: 1469

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 77b065a and 084d048.

📒 Files selected for processing (9)
  • packages/frontend/src/components/FosToolbar/FosToolbar.tsx (1 hunks)
  • packages/frontend/src/components/SortOrderDropdown/SortOrderDropdown.tsx (0 hunks)
  • packages/frontend/src/components/SortOrderDropdown/index.ts (0 hunks)
  • packages/frontend/src/components/SortOrderDropdown/sortOrderDropdown.module.css (0 hunks)
  • packages/frontend/src/components/index.ts (0 hunks)
  • packages/frontend/src/i18n/resources/en.json (0 hunks)
  • packages/frontend/src/i18n/resources/nb.json (0 hunks)
  • packages/frontend/src/pages/Inbox/Inbox.tsx (3 hunks)
  • packages/frontend/src/pages/Inbox/queryParams.ts (0 hunks)
💤 Files with no reviewable changes (7)
  • packages/frontend/src/components/SortOrderDropdown/SortOrderDropdown.tsx
  • packages/frontend/src/components/SortOrderDropdown/index.ts
  • packages/frontend/src/components/SortOrderDropdown/sortOrderDropdown.module.css
  • packages/frontend/src/components/index.ts
  • packages/frontend/src/i18n/resources/en.json
  • packages/frontend/src/i18n/resources/nb.json
  • packages/frontend/src/pages/Inbox/queryParams.ts
🔇 Additional comments (4)
packages/frontend/src/components/FosToolbar/FosToolbar.tsx (1)

Line range hint 19-36: Implementation changes look good

The sorting functionality has been cleanly removed while maintaining the existing filter and save features. The component structure remains clear and focused.

packages/frontend/src/pages/Inbox/Inbox.tsx (3)

33-33: LGTM: Import statement correctly updated

The import statement has been properly updated to remove sorting-related imports while maintaining necessary filter functionality.


79-79: LGTM: State management simplified

The state management has been correctly simplified by removing sorting-related state while maintaining necessary search parameter functionality for filters.


102-103: LGTM: Data processing simplified

The itemsToDisplay memoization has been correctly simplified to only handle filtering, aligning with the removal of sorting functionality.

Let's verify that the filterDialogs function doesn't contain any residual sorting logic:

✅ Verification successful

Verification complete: No sorting logic present in filterDialogs

After examining the implementation of filterDialogs, I can confirm that the function only handles filtering logic and contains no sorting-related code. The function:

  • Groups filters by their IDs
  • Applies AND logic across different filter groups
  • Applies OR logic within each filter group
  • Handles specific filtering for senders, receivers, dates, and status
  • Returns filtered results without any sorting operations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if filterDialogs function contains any sorting-related code
# Expected: No sorting-related terms in the implementation

rg -i "sort" "packages/frontend/src/pages/Inbox/filters.ts"

Length of output: 57


Script:

#!/bin/bash
# Let's first check if the file exists and see its content
fd "filters.ts" packages/frontend/src/pages/Inbox/

# If the file exists, let's examine the filterDialogs function implementation
ast-grep --pattern 'export function filterDialogs($_) {
  $$$
}'

# As a fallback, let's search for any file containing filterDialogs function
rg -A 10 "function filterDialogs"

Length of output: 198


Script:

#!/bin/bash
# Let's examine the content of the filters.ts file
cat packages/frontend/src/pages/Inbox/filters.ts

Length of output: 4962

@alexdigdir alexdigdir merged commit bbb66cc into main Nov 25, 2024
23 checks passed
@alexdigdir alexdigdir deleted the chore/remove-sorting branch November 25, 2024 10:45
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.

2 participants