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

Fix issue 6194 #6627

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open

Conversation

SuperAKWA
Copy link

Title

Fix: Implement "Apply Filters" functionality in search filters (#6194)

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #6194

Description

This pull request implements the functionality to apply filters on the search page. When users modify filters (e.g., duration, time, type) and click on the "Apply" button:

The filter panel closes automatically.
The search results are refreshed to reflect the selected filters without requiring an additional click on the search bar.
The functionality is achieved by:

Adding a new applyFilters action in utils.js to trigger the search refresh.
Modifying FtSearchFilters.vue to include an "Apply" button with the appropriate behavior.
Updating top-nav.js to handle the search re-execution with the new filter settings.

Screenshots

Before:

  • Filters could be adjusted, but there was no 'Apply' button. Clicking the 'Close' button only made the filters window disappear but did not refresh the search. Users had to manually click the search icon in the search bar or press 'Enter'.
screen-before-modification

After:

  • Clicking "Apply" now refreshes the search results immediately based on the selected filters.
screen-after-modifications

Testing

Manual Testing:

  • Tested the "Apply" button behavior with various combinations of filters (e.g., duration, time, type, features).
  • Verified that the search results refresh correctly based on the applied filters.

Automated Testing:

  • Ran yarn run lint and yarn run test to ensure no issues were introduced.

Lint Results:

No errors or warnings.

Remaining Tests:

All test suites passed successfully.

Desktop

  • OS: macOS
  • OS Version: Sequoia 15.2
  • FreeTube version: Latest development branch (rebased with upstream master)

Additional context

  • The PR includes updates to English translations (en-GB.yaml and en-US.yaml) to add the new "Apply" button label.
  • Changes were rebased against the latest master branch to include dependencies updated in the upstream repository.

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) January 24, 2025 12:44
@github-actions github-actions bot added PR: dependencies Pull requests that update a dependency file PR: waiting for review For PRs that are complete, tested, and ready for review labels Jan 24, 2025
@kommunarr
Copy link
Collaborator

I recommend deleting your branches & fetching them from scratch, setting git config pull.rebase false, and git cherry-picking the relevant commits.

@absidue absidue added PR: changes requested PR: WIP and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Jan 24, 2025
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

auto-merge was automatically disabled January 25, 2025 02:47

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) January 25, 2025 02:48
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@SuperAKWA
Copy link
Author

Hi guys,

I hope you're doing well.
I addressed the requested changes and resolved the conflicts earlier this weekend. If there's still an issue or anything else that needs adjusting, please feel free to let me know.

Thank you in advance for your feedback !

Copy link
Collaborator

@kommunarr kommunarr left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Left a suggestion as to the triggering the top nav function from the modal, although it's possible a teammate will have an even better alternative in mind for that.

@@ -116,6 +116,8 @@ Search Filters:
Location: Location
HDR: HDR
VR180: VR180
Apply: 'Apply'
Close: 'Close'
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue: This Close label seems to be vestigial and should be removed

Comment on lines +69 to +71
getTopNavInstance(state) {
return state.topNavInstance
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

issue: Storing a reference to the instance in state is an antipattern and should be avoided. One way to do this instead would be to watch an applySearchFilters boolean store property from top-nav.js and unset it after use. My colleagues can probably think of something better than that, but that should at least be a start.

@@ -1,3 +1,4 @@
<!-- eslint-disable @intlify/vue-i18n/no-missing-keys -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not be needed after aforementioned unused key is removed.

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc removed PR: dependencies Pull requests that update a dependency file PR: WIP labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add apply button to search filters modal
4 participants