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

Feature: Add Weapon Affinities to Favorites #52

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

Conversation

pushtov
Copy link

@pushtov pushtov commented Sep 26, 2024

A new feature has been implemented that allows users to add individual weapon affinities to their favorites.

Currently, the project offers a weapon search feature where users can specify multiple weapon names to display them in a table. Searching by a specific weapon name returns a list of all its affinities. However, this method has some limitations:

  • There is no quick way to toggle filters for weapon names while keeping the selected values intact.
  • Users cannot isolate specific affinities in the results. Combining affinity and weapon name filters doesn’t fully solve this issue. For example, if a user wants to compare the Magic Grave Scythe and Magic Stone Club, applying both filters results in extra, unwanted items in the list. The more weapons included in the search, the more irrelevant entries appear in the results.

From my own experience (I’m currently playing the game), it would be helpful to add individual weapon affinities to a favorites list. To address this, I’ve implemented a feature that allows users to do just that.

A new column, Favorites, has been added to the weapon table. Each row now contains a checkbox that allows users to add individual weapons to their favorites.

At the top of the table, there’s a three-state checkbox (checked, indeterminate, unchecked). When unchecked or indeterminate, clicking the checkbox adds all visible weapons on the page to the favorites list. When checked, clicking the checkbox removes all visible weapons from the favorites list.

A new Favorites only checkbox has been added to the sidebar filters. When checked, only favorited weapons will be displayed. This filter works seamlessly with other filters. For example, if the Weapons field contains values, the favorites filter will apply to those results first. If the Weapons field is empty, the favorites filter will take precedence over the Weapons type filter. Additionally, filters like Include DLC weapons, Effective only, and Affinity will refine the favorites list accordingly.

This makes it easy to toggle between a favorites list and the full weapon list, as well as to mass add or remove weapons based on filter criteria.

Implementation Notes:

  1. It was challenging to pass additional data to the row renderer. I had to extend the accepted tuple to pass the favorite flag and the onFavoriteChange handler. This could have been resolved using the useAppState hook in the checkbox component, but I couldn’t due to the hook’s limitations.
  2. I had to refactor the header field in the WeaponTableColumnDef type into a function, similar to how the render function works, to handle clicks on the header checkbox.

Lastly, as a backend developer, I acknowledge that the UI design for this feature isn’t perfect. If this feature is accepted, I’m open to working with the community to refine the user interface to an acceptable standard.

- Introduced Favorites column with checkboxes in the weapon table
- Added mass favorite toggle via header checkbox (checked, indeterminate, unchecked states)
- Implemented "Favorites only" filter in the sidebar
- Integrated favorites with existing weapon and affinity filters
- Refactored row renderer to pass favorite state and event handler
- Modified WeaponTableColumnDef header for checkbox click handling
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.

1 participant