-
Notifications
You must be signed in to change notification settings - Fork 76
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
[FC-0036] Refined tag drawer #939
[FC-0036] Refined tag drawer #939
Conversation
Thanks for the pull request, @ChrisChV! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChrisChV Great work on this! Overall its working quite well. Just found an issue and some small nits.
When checking a tag in edit mode and adding it in the edit mode, if you click "Cancel" it gets cleared however the checkbox stays checked. See video below for reproduction:
Screen.Recording.2024-04-11.at.3.59.42.PM.mov
The same also seems to happen when removing a tag in edit mode, the previously applied tags remains checked, see below:
Screen.Recording.2024-04-11.at.4.07.22.PM.mov
These 2 are likely related, it seems like it only happens when removing. It might be helpful to use the clear
method:
const [checkedTags, { add, remove, clear }] = useCheckboxSetValues();
to clear all the checkboxes whenever tags are commit/saved and new ones are returned from the backend, and let the render handle checking the appropriate applied tags. However it might be something simpler that I am missing with the new code setup.
const taxonomiesWithData = taxonomiesList.filter( | ||
(t) => t.contentTags.length !== 0, | ||
).sort((a, b) => b.contentTags.length - a.contentTags.length); | ||
const emptyTaxonomies = taxonomiesList.filter( | ||
(t) => t.contentTags.length === 0, | ||
).sort((a, b) => a.name.localeCompare(b.name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here b48a33a
@yusuf-musleh Thanks for the review!
I fixed both cases here 1cb261e. Thanks for the suggestion |
@ChrisChV It seems like this PR is getting pretty big - is it worth splitting it up into separate PRs? |
b48a33a
to
85fa126
Compare
@bradenmacdonald Yes, you're right. I have separated the functionalities made by @yusuf-musleh and I created #947 Also I separated this #949 The other functionalities are linked to the new states created for the edit and read mode. It will be very difficult to separate them |
Update: It is necessary to merge this at the same time of: openedx/edx-platform#34490 CC @yusuf-musleh @xitij2000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 @ChrisChV Great work! And thanks for splitting up the PR and addressing the comments. I've gone through it again, and confirmed that its functioning as expected. I've tested the other PRs indivisually as well to confirm they're working as expected.
- I tested this: Tested based on PR description.
- I read through the code
- I checked for accessibility issues
-
Includes documentation
I've tried to review this, but was having trouble yesterday since the requirements were pointing to a deleted, and I my devstack broke as a results. I see that has now been fixed, so will try reviewing again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got to this pretty late so am leaving the feedback so far. Will continue the review tomorrow.
src/content-tags-drawer/messages.js
Outdated
tagsSaveToastTextTypeAddedAndRemoved: { | ||
id: 'course-authoring.content-tags-drawer.toast.added-removed', | ||
defaultMessage: '{tagsAdded} tags added. {tagsRemoved} tags removed.', | ||
description: 'Text of toast after save when the user added or removed tags.', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of having this be a separate thing. There is already one for adding and one for removing. If the text was "x tags added and y tags removed" then it might make sense, but right now you can just display the other two texts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here e06f1b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this should be a context instead of a hook. If this state is being reused at multiple levels, then I think you should make this a context so that it doesn't need to be passed around.
Having it as a hook will still cause it to be rereun in each component, especially if they're on different levels in the same hierarchy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it should be a hook, perhaps it can be broken down into smaller hooks, or functions so it's easier to follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I used a context. This update is here: dfbc6eb
@@ -5,6 +5,10 @@ | |||
.collapsible-trigger { | |||
border: none !important; | |||
} | |||
|
|||
.tags-tree { | |||
font-size: 17px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's generally a bad idea to use px sizes since they don't zoom well, perhaps we can use the closest css class or rem value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: a185fe7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the css here can be replaced with classes:
- min-vh-100
- box-shadow-up-2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here: a185fe7
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #939 +/- ##
==========================================
+ Coverage 92.02% 92.06% +0.04%
==========================================
Files 686 685 -1
Lines 11953 12055 +102
Branches 2600 2627 +27
==========================================
+ Hits 11000 11099 +99
- Misses 917 920 +3
Partials 36 36 ☔ View full report in Codecov by Sentry. |
@xitij2000 It's ready for another review. I need help to fix the CI, I don't know what to do to fix that CodeCov error |
@ChrisChV For the codecov error, you just have to try again later, or get kshitij to push your commits to the main repo instead of the open-craft fork, and open a new PR. But probably just wait. The problem is a global rate limit for all "non-token" users of codecov on GitHub. |
2e5c81f
to
cdaf7b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and it looks good to merge!
Ping me again once openedx/edx-platform#34490 is merged and I'll try to merge soon after.
@ChrisChV: Could you please squash your commits and add a more descriptive commit message? |
It contains different changes to achieve the reading and editing mode of the drawer tag: * Manage tags drawer footer with buttons added. * Creation of ContentTagsDrawerContext. * Creation of global state and global removed state to allow edit mode. * Update API client to match with openedx-learning 0.9.1: Save tags of multiple taxonomies; to save all tags added/removed on edit mode * Extract TagsTree and use it on the Tags Drawer. * Update TagsTree to allow edit mode. * Add a Toast on Tags Drawer; show the toast afert save. * Scrolling + sticky footer on tags drawer
b491d9b
to
8110861
Compare
@ChrisChV 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
Multiple refinements to tag drawer: openedx/modular-learning#190
Save
.Supporting information
Testing instructions
make requirements
on cms shell.