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

Added an option to add color to the learning path #382

Merged
merged 15 commits into from
Jul 18, 2024

Conversation

Coder-Srinivas
Copy link
Contributor

Added an option for the admin to add color for a learning path, based on the ticket

  • Used combobox as the input rather than select as each option can be modified individually.
  • Study cards PR needs to be updated once this gets merged, as learning path color is given by the server.

@@ -4,6 +4,7 @@ def change
t.string :label, null: false
t.string :description, null: false
t.string :badge_id
t.string :color, null: false
Copy link
Collaborator

@chrisbendel chrisbendel Jul 12, 2024

Choose a reason for hiding this comment

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

rather than adding this to an old file, we will need to add a new migration to add the new column. check this documentation on creating a new migration here and let me know if you have any questions. It should be pretty simple for adding just one column :)

You will have to remove these changes from this file and the populate_learning_path_data.rb file as well

@@ -432,6 +432,7 @@ CREATE TABLE public.learning_paths (
label character varying NOT NULL,
description character varying NOT NULL,
badge_id character varying,
color character varying NOT NULL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will get auto generated once you run the new migration file, so remove this

@@ -309,6 +320,41 @@ const LearningPathForm: FC<{
label='Order'
{...form.getInputProps('order')}
/>

Copy link
Collaborator

Choose a reason for hiding this comment

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

One question for @iccgoncalves is will we allow for users to select custom colors as well? or only from this predefined list.

Regardless, mantine has a nifty little color input component that you can disallow input on and just set swatches of colors as the options

We can just use that disallowInput prop whether or not we want them to have the ability to store custom colors. let me know what you think of this vs the combobox

Choose a reason for hiding this comment

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

Thank you for this question @chrisbendel ;)
We do not want to allow for custom color selection - the provided list of colors is associated with the badges color, so we want to keep it within that list. Thanks so much!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrisbendel Should I continue with the combobox or use the color input component

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Coder-Srinivas i kinda like the look of the color picker - it looks a little simpler visually. would you be willing to try it out and see how it goes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll use the color picker

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the implementation of the component will be a bit simpler too, compared to the combobox

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, Combobox was a little difficult to implement

@chrisbendel
Copy link
Collaborator

Looking good - just have to hit a couple of the comments I left! 😄

@Coder-Srinivas
Copy link
Contributor Author

@chrisbendel can you please review this PR, as this needs to be merged first for the study card redesign to be merged, as the borders for the mutli session cards are based on the color of the learning path

Copy link
Collaborator

@chrisbendel chrisbendel left a comment

Choose a reason for hiding this comment

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

Looks good - feel free to merge!

@Coder-Srinivas Coder-Srinivas merged commit 712d548 into main Jul 18, 2024
4 checks passed
@Coder-Srinivas Coder-Srinivas deleted the study-path-colors branch July 18, 2024 14:51
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.

3 participants