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

UI fixes for Sort Library Component [FC-0059] #1222

Merged
merged 6 commits into from
Aug 24, 2024

Conversation

pomegranited
Copy link
Contributor

@pomegranited pomegranited commented Aug 21, 2024

Description

Addresses issues raised during acceptance testing for #1038, specifically:

  • Use "Recently Modified" as the default sort option when no keyword is entered.
  • Use "Most Relevant" as the default sort option when a keyword is entered.
    Hide this sort option if no keyword is entered.
  • Reorder sort options as per pic.
  • Change the "Sort by" dropdown title to match the selected sort option.
  • Show "Sort by" in the drop-down itself as a Dropdown.Header.
  • Don't change the sort option when "clear filters" is clicked.
    Instead, remove a sort filter by clicking on the current "sort by" selection.
    For example, clicking on Sort > "Title, A,Z" will sort by that, clicking it again will remove that Sort and take the user back to default.

Screenshots

See #1147 for previous screenshots.

  • Default sort is "Recently Modified" (when no search keywords):

    default_sort

  • Default sort is "Most Relevant" (when search keywords provided):

    default_sort_w_keyword

Supporting information

See discussion from comment.

Private-ref: FAL-3811

Testing instructions

  1. Create a new library
  2. Add components to the library, and Publish.
  3. Add more components, but leave them unpublished.

To test this change:

  1. Navigate to the new library from http://apps.local.edly.io:2001/course-authoring/libraries/
  2. Check that the default component sort option is "Recently Modified".
  3. Enter a search keyword, and note that the default component sort option is now "Most Relevant".
  4. Change the sort options and note changes in the Components list.
    For any non-default sort option, there should be a ?sort=... entry added to the query string.
  5. Click on the Components tab, and note sort option stays the same as previously selected.
  6. Change sort options and note changes in the components list.
  7. Select "Recently Published" -- should omit unpublished components from the list.
  8. Clicking "clear filters" should not change the selected sort option.

When search keyword(s) are entered, use "Most Relevant" as default.

Also

* Hides "Most Relevant" option if no keyword is entered.
* Re-orders the sort menu options
* Ensures the default sort option is not stored in the query string
* Shows the selected sort option on the drop-down toggle button
* Shows "Sort By" as a header inside the drop-down menu
Instead, reset sort option to default if the selected sort option is re-clicked.
* Updates sort components tests to verify changes.
* "Recently Modified" now appears as the default sort option in the
  toggle button, and as a header on the Home page, so we need to count
  them both.
* Fewer queries were executed with the updated code.
@pomegranited pomegranited requested a review from a team as a code owner August 21, 2024 10:46
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Aug 21, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @pomegranited!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-tnl. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@pomegranited pomegranited added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed open-source-contribution PR author is not from Axim or 2U labels Aug 21, 2024
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Aug 21, 2024
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.01%. Comparing base (3e0f7b5) to head (ce94232).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1222      +/-   ##
==========================================
- Coverage   93.03%   93.01%   -0.02%     
==========================================
  Files         756      756              
  Lines       13716    13722       +6     
  Branches     2969     2966       -3     
==========================================
+ Hits        12760    12764       +4     
- Misses        920      923       +3     
+ Partials       36       35       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

Copy link
Member

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

👍 @pomegranited Works really well, great work! Just left a small comment about the new styles.

  • I tested this: Followed the testing instructions
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@@ -62,13 +86,18 @@ export const SearchSortWidget: React.FC<Record<never, never>> = () => {
size="sm"
>
<Icon src={SwapVert} className="d-inline" />
{searchSortLabel}
<div className="search-sort-toggle-label">{toggleLabel}</div>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className="search-sort-toggle-label">{toggleLabel}</div>
<div className="py-0 px-1">{toggleLabel}</div>

You can achieve the same styling by using the bootstrap classes without the need to add the new CSS file SearchSortWidget.scss

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ach, thank you @yusuf-musleh ! Much cleaner this way.

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

// Call 1: To fetch searchable/filterable/sortable library data
// Call 2: To fetch the recently modified components only
await waitFor(() => { expect(fetchMock).toHaveFetchedTimes(2, searchEndpoint, 'post'); });
await waitFor(() => { expect(fetchMock).toHaveFetchedTimes(1, searchEndpoint, 'post'); });
Copy link
Contributor

Choose a reason for hiding this comment

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

@pomegranited One question: what changes here to decrease the number of calls of the searchEndpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I wish I knew for sure.. Maybe it's something to do with the default sort option not being empty anymore (since it's created:desc now), and maybe the search manager was setting it twice before for some reason?

But the premise in those deleted comments is not correct -- yes, we make 2 queries, but they're done as part of a single hit to the /multi-search endpoint. So it should have been 1 hit all along.

That's my theory, anyway.

@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Aug 22, 2024
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ChrisChV ChrisChV merged commit 259a50c into openedx:master Aug 24, 2024
8 checks passed
@openedx-webhooks
Copy link

@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants