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

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

Open
leo-step opened this issue Aug 7, 2022 · 6 comments
Open

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

leo-step opened this issue Aug 7, 2022 · 6 comments

Comments

@leo-step
Copy link
Contributor

leo-step commented Aug 7, 2022

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
Copy link
Owner

seanprashad commented Aug 7, 2022

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
Copy link
Owner

seanprashad commented Aug 7, 2022

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:

const frequencyRate = {
easy: Math.round(highestFrequency / 3),
medium: Math.round((highestFrequency / 3) * 2),
hard: highestFrequency,
};

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

@seanprashad
Copy link
Owner

More breadcrumbs:

className={`${getFrequencyClass(patternsMap[pattern])}`}

@seanprashad
Copy link
Owner

seanprashad commented Aug 11, 2022

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

@leo-step
Copy link
Contributor Author

The issue is in this line:

if (highestFrequency / 3 < 1) {

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
Copy link
Owner

seanprashad commented Aug 14, 2022

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!

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

No branches or pull requests

2 participants