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

Refactor no results message component 4903 #5298

Merged

Conversation

bphan002
Copy link
Member

@bphan002 bphan002 commented Aug 24, 2023

Fixes #4903

What changes did you make?

  • The initial action was to extract the HTML code from toolkit.js, but that was already done and moved to current-guides.html. No style was needed.
  • A noResultsMessageComponent function was created and placed under /assets/js/elements/noResultsMessageFilter.js as a reusable function for any pages that have a left-column filter. The first parameter takes the filterParams, and the second is the text color of the results since the various pages have different background colors.

Why did you make the changes (we will use this info to test)?

  • A no-result message message does not display currently on the home or project page if the filter finds no results.
  • Changes to the current message displayed used switch statements and were manually set depending on filterParams arguments passed. I temporarily removed this since I do not think this is a good way of doing it if we want a reusable function. Currently, the display is just the parameters argument passed in, which isn't ideal.
  • The home page and project page use the same _includes file. Since this is the case I only showed the visual for the Project Page, but the functionality is the same for the Home Page.
Visuals before changes are applied to Projects Page

Screenshot 2023-08-24 at 1 14 58 AM

Visuals before changes are applied to Toolkit Page

Screenshot 2023-08-24 at 1 12 03 AM

Visuals after changes are applied to Projects Page(Notice the title before colon are dependent on the parameters passed into the function)

Screenshot 2023-08-24 at 1 27 57 AM

Visuals after changes are applied to toolkit Page(Notice the title before colon are dependent on the parameters passed into the function)

Screenshot 2023-08-24 at 1 25 40 AM

Revision may be needed if we want the parameters to be named differently. I'm opened to suggestions on how to tackle this.

NOTE TO REVIEWERS: The automated "Lint SCSS / Lint SCSS (pull_request)" check below should be ignored for your review. The linter itself is causing the scss error. - Will G.

@github-actions
Copy link

Want to review this pull request? Take a look at this documentation for a step by step guide!

From your project repository, check out a new branch and test the changes.

git checkout -b bphan002-refactor-no-results-message-component-4903 gh-pages
git pull https://github.com/bphan002/hackforLAforkwebsite.git refactor-no-results-message-component-4903

@github-actions github-actions bot added role: front end Tasks for front end developers P-Feature: Toolkit https://www.hackforla.org/toolkit/ time sensitive Needs to be worked on by a particular timeframe P-Feature: Home page https://www.hackforla.org/ P-Feature: Projects page https://www.hackforla.org/projects/ size: 3pt Can be done in 13-18 hours Complexity: Extra Large labels Aug 24, 2023
@kwangric
Copy link
Member

kwangric commented Aug 31, 2023

ETA: 9/6
Availability: All day 9/4 through 9/6

@Adastros
Copy link
Member

Adastros commented Sep 7, 2023

Availability (PST): 10 - 11 PM 07SEP2023, 2 - 3 PM 09SEP2023, 10 - 11 PM 11-12SEP2023
Review ETA (PST): End of day 12SEP2023

Copy link
Member

@kwangric kwangric left a comment

Choose a reason for hiding this comment

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

Hey @bphan002, thanks for taking on this extra large issue! I've had some time to briefly look at your pull request, but my week has been busier than anticipated and I probably won't finish a full review until this week.

One of the first things I noticed was that the search function on the Projects and Home page don't seem to be working anymore. Performing the search does add the parameter to the URL, but doesn't actually change the results of the projects or add the tags. Additionally, after attempting a search, the filters don't work correctly until the page is refreshed.

I'll take a closer look at the code to see what is causing this later this weekend, just wanted to let you know my findings in case you have a better idea of the cause.

Copy link
Member

@Adastros Adastros left a comment

Choose a reason for hiding this comment

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

Hi @bphan002, thanks for taking the time to work on this issue!

I agree with @kwangric's findings. Based on my investigation, the issue stems from how the "Search" key from filterParams is handled. Functions such as updateCategoryCounter and updateProjectCardDisplayState will throw an undefined error trying to use the 'Search' key.

Looking at what has changed in current-projects.js, it seems that a lot of the code involving the search bar were removed. The best way to fix this would be to bring back some or all of the code used for the search bar. This includes bringing back the use of "AND", "OR", and "-" to refine the search (if this is currently handled somewhere else in your code let me know!).

You can also implement a different approach to handle the errors/ search functionality if you like.

See issue #4136 for the search bar requirements.

@Adastros
Copy link
Member

Also, could you update your fork/ branch to include the latest updates from the website repository? It looks like there is a merge conflict with the 'current-projects.js' file. Code involving the tools category of the filter was updated while this pull request was pending review.

@bphan002
Copy link
Member Author

bphan002 commented Sep 12, 2023 via email

@bphan002
Copy link
Member Author

I have re-added the original search function that was removed. I'm not sure why I removed it in the first place, but I think it is working now. The original comments with my first pull request are still an issue I would like guidance on.

Thank you

@Adastros
Copy link
Member

Availability (PST): 10 - 11 PM 21SEP23, 3 - 4 PM 23SEP23, 10 - 11:30 PM 25SEP23
Review ETA (PST): End of day 25SEP23

Copy link
Member

@kwangric kwangric 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 making the changes!

  • The code for the message was modified to be reusable for each page with filters.
  • The no results message displays correctly on the home, projects, and tooltip page when no cards are displayed.
  • The message shows all the filters and searches used.

I think that the parameters names are fine. For the tooltip message, we will want to either add an additional step before passing in the filter params to fix the text. Or change how the page handles the filters so it will work similar to the projects page. This can be done with a future issue I believe.

Overall great work with completing the issue!

Copy link
Member

@Adastros Adastros left a comment

Choose a reason for hiding this comment

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

Hi @bphan002, thank you for fixing the searchbar functionality!

  • The searchbar functions as expected
  • The no results message appears and correctly displays the search terms/ keywords used that led to the no results message
  • No issues were found with the no results message at different viewport widths
  • works on Firefox and Chrome

One thing that I want to mention is that the original intention of the first task in the issue I created was to move lines 13 - 24 in noResultsMessageFilter.js into a new HTML file in the _includes directory. From there, the the new HTML file would be included in the projects and toolkit page HTML files using Liquid (see lines 48 - 53 in current-guides.html for an example). Reading the issue I created, I should have made that more clear.

That being said, the current implementation does make the no results message a reusable component. Instead of implementing it as mentioned above, it is implemented through JavaScript through noResultsMessageFilter.js, which is included in the relevant HTML page files as an extra script tag.

Since this issue is time sensitive and does make the no results message into a working reusable component, I'm okay with the changes in this pull request.

In regards to parameter names in the no results message on the toolkit page, I agree with @kwangric. That can be addressed in a new, separate issue.

Good job and thank you for working on the issue!

@Adastros Adastros merged commit 8b028ca into hackforla:gh-pages Sep 26, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Extra Large P-Feature: Home page https://www.hackforla.org/ P-Feature: Projects page https://www.hackforla.org/projects/ P-Feature: Toolkit https://www.hackforla.org/toolkit/ role: front end Tasks for front end developers size: 3pt Can be done in 13-18 hours time sensitive Needs to be worked on by a particular timeframe
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor "No Results" Message from the Toolkit Filter and Reuse it for the Projects Filter
3 participants