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

Company as another filtering criteria for LC questions #13

Closed
mm1705 opened this issue May 31, 2020 · 3 comments · Fixed by #21
Closed

Company as another filtering criteria for LC questions #13

mm1705 opened this issue May 31, 2020 · 3 comments · Fixed by #21

Comments

@mm1705
Copy link
Contributor

mm1705 commented May 31, 2020

Currently, Companies are shown for each problem. If we hover over the icon, the company name is displayed.
How about when we hover over the company icon, we provide an option to click which results in a list of filtered LC questions for the current company?
We may also change Companies to a dropdown like Pattern and Difficulty.

@seanprashad
Copy link
Owner

I think this would be pretty cool @mm1705 - I will have to play around with react table, the library I use to render the entire chart, to see if invoking a filter is possible via clicking an icon.

There are a handful of simple and more complex examples that would be a good starting point to see if this is possible.

@seanprashad
Copy link
Owner

seanprashad commented Jun 5, 2020

Good news! It looks like this is possible:

image

There are some edge cases that I'm looking into. For example, when a company only has hard questions and the user had easy previously selected, it will show 0 questions (which is correct), but the filtering will not work properly for future selections.

Edit:

  1. Click Trie from the Pattern dropdown
  2. Click Hard from the Difficulty dropdown
  3. Click Lyft from the Companies dropdown
  4. Observe 1 question (as intended)
  5. Observe that the Difficulty dropdown shows All and Easy, Medium, and Hard
  6. Observe that Easy and Medium difficulties are shown as options in the Difficulty dropdown - they should not be there as Lyft does not have any Easy or Medium questions for the Trie pattern

See below:

image

seanprashad pushed a commit that referenced this issue Jun 5, 2020
The `Difficulty` filter is now hard-coded, as to avoid running into edge
cases using preFilteredRows/filteredRows (see
https://github.com/tannerlinsley/react-table/blob/master/docs/api/useFilters.md#column-properties).

All filters have been refactored out to a seperate file (filters.js), to
reduce code clutter in the Table component.

The question list is now sorted by difficulty by default when being
exported from src/data/index.js.

Fixes #13
seanprashad pushed a commit that referenced this issue Jun 5, 2020
The `Difficulty` filter is now hard-coded, as to avoid running into edge
cases using preFilteredRows/filteredRows (see
https://github.com/tannerlinsley/react-table/blob/master/docs/api/useFilters.md#column-properties).

All filters have been refactored out to a seperate file (filters.js), to
reduce code clutter in the Table component.

The question list is now sorted by difficulty by default when being
exported from src/data/index.js.

Fixes #13
seanprashad pushed a commit that referenced this issue Jun 5, 2020
The `Difficulty` filter is now hard-coded, as to avoid running into edge
cases using preFilteredRows/filteredRows (see
https://github.com/tannerlinsley/react-table/blob/master/docs/api/useFilters.md#column-properties).

All filters have been refactored out to a seperate file (filters.js), to
reduce code clutter in the Table component.

The question list is now sorted by difficulty by default when being
exported from src/data/index.js.

Fixes #13
@seanprashad
Copy link
Owner

seanprashad commented Jun 5, 2020

Sweet - so I was able to get this working pretty nicely @mm1705! There were some edge cases with how the question list was being populated under certain criteria (like here) but I fixed it by always showing Easy, Medium, and Hard for the Difficulty dropdown, instead of populating dropdown list values based on what questions were visible.

Please let me know if you run into any bugs/unintended side effects - thanks! ✌🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants