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

allow choosing of no color #4008

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kaze-droid
Copy link
Contributor

Context

Resolves #3999

Implementation

Provides an additional option of no color for the color picker by introducing an additional colorIndex for transparent cells

noColor

Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nusmods-export ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 4:19pm
nusmods-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 4:19pm

Copy link

vercel bot commented Feb 3, 2025

@kaze-droid is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.90%. Comparing base (988c6fd) to head (7d60294).
Report is 80 commits behind head on master.

Files with missing lines Patch % Lines
website/src/views/timetable/TimetableCell.tsx 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4008      +/-   ##
==========================================
+ Coverage   54.52%   54.90%   +0.38%     
==========================================
  Files         274      276       +2     
  Lines        6076     6327     +251     
  Branches     1455     1548      +93     
==========================================
+ Hits         3313     3474     +161     
- Misses       2763     2853      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jloh02 jloh02 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 the updates! Looks great just have a few comments for minor aesthetic and quality improvements

@@ -51,7 +51,7 @@ const ColorPicker = memo<Props>((props) => {
className={classnames(styles.palette, { [styles.isClosed]: !isOpen })}
{...getMenuProps()}
>
{_.range(NUM_DIFFERENT_COLORS).map((index: ColorIndex) => (
{_.range(TOTAL_COLORS).map((index: ColorIndex) => (
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Since the 8 colors currently form a 4x2 grid, the 9th cell makes it look kinda strange. Should we try to make the current color change to transparent color on click (e.g. if the current course color is blue, clicking on the originally blue cell should disable the color?)

@@ -5,8 +5,12 @@ import { ColorMapping } from 'types/reducers';
import { ModuleCode } from 'types/modules';

export const NUM_DIFFERENT_COLORS = 8;
export const TRANSPARENT_COLOR_INDEX = NUM_DIFFERENT_COLORS;
Copy link
Member

Choose a reason for hiding this comment

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

Interestingly, -1 as a color index also appears to force transparent colors. Would this complicate the code less? If so, is that a better alternative than to create the relevant additional scss code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I've adjusted the color index to use -1 but kept the additional scss code (renamed to transparentColor) so that the button opening the colorPicker is not completely transparent

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.

Allow choosing of "No Color" for color picker
2 participants