seanprashad / leetcode-patterns

A pattern-based approach for learning technical interview questions
https://seanprashad.com/leetcode-patterns/
GNU General Public License v3.0
10.08k stars 1.76k forks source link

Problems pattern frequency doesn't show colors for new companies #229

Open leo-step opened 2 years ago

leo-step commented 2 years ago

These pills are gray for the newly added companies (e.g. Airbnb) while they are supposed to be colored by difficulty. The pills work correctly for the companies we previously had like Apple and Microsoft.

Expected:

Screen Shot 2022-08-07 at 6 26 55 PM

Current:

Screen Shot 2022-08-07 at 6 23 44 PM

seanprashad commented 2 years ago

Steps to reproduce:

  1. Select any company from the dropdown list under Companies
  2. Observe the pills under Problems pattern frequency

Possibly related to either https://github.com/seanprashad/leetcode-patterns/pull/214/files#diff-9aa6b25aa4aab24215ebcedc56e0ff3c2a2e481a30b42eb3ca0fcce2c7752789R402 or #227

seanprashad commented 2 years ago

One problem that I see here is from a UX perspective - the colouring is also used in the Difficulty column to denote Easy/Medium/Hard questions.

Here, we use the same colour schema, but for a different purpose:

https://github.com/seanprashad/leetcode-patterns/blob/bdbb042f1514a5bf836e133226ec338020446073/src/components/PatternFrequencies/index.js#L31-L35

Since we have two different contexts, we should look into a better colouring scheme when revisiting this!

seanprashad commented 2 years ago

More breadcrumbs: https://github.com/seanprashad/leetcode-patterns/blob/2409a6018fc903d596a28be15c551f956370f450/src/components/PatternFrequencies/index.js#L47

seanprashad commented 2 years ago

Looks like some companies, like Apple, show up correctly:

image
leo-step commented 2 years ago

The issue is in this line: https://github.com/seanprashad/leetcode-patterns/blob/2409a6018fc903d596a28be15c551f956370f450/src/components/PatternFrequencies/index.js#L27

The colors will only show up if a given company has a category of questions (e.g. heap) that has a frequency of at least three. I tested this with Airbnb by adding the company and the "Heap" pattern to the first question in questions.json (Contains Duplicate), and the colors immediately show for all of them.

Screen Shot 2022-08-13 at 11 28 54 PM

How do we want the colors to be in these cases?

seanprashad commented 2 years ago

How do we want the colors to be in these cases?

Hmm well, I'm not sure to be honest. Ideally, I think some sort of coloured gradient would look nice, where a darker shade maps to a pattern that is more frequent. There's a bunch of websites to help do the CSS, like https://coolors.co/gradient-maker.

Edit: On second thought, let's choose something easy - red if the frequency is >=5 and orange for everything else. We can fiddle around with an appropriate colour scheme after fixing this bug!