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

feat: Add tags to info sidebar of library component [FC-0062] #1299

Merged

Conversation

ChrisChV
Copy link
Contributor

@ChrisChV ChrisChV commented Sep 19, 2024

Description

This:

  • Adds the drawer (default) and component variants for ContentTagsDrawer.
  • Adds ContentTagsDawer in the info sidebar of library components.
  • Which edX user roles will this change impact? "Course Author"

image

Supporting information

Github Issue: #1286
Internal ticket: FAL-3847

Testing instructions

  • Run this script to add taxonomies and tags: https://github.com/open-craft/taxonomy-sample-data
  • Go to studio and create a new library if you don't have one created.
  • Go to the library home of your library.
  • Create a new component on your library
  • Click on the component card to open the component info. Go to Manage tab.
  • Verify that the ContentTagsDrawer is rendered. Click on Manage tags and add some tags. Save.
  • Verify that the tag count on the component card and the component info sidebar is updated.
  • Play with the ContentTagsDrawer (add more tags, delete tags, etc)

@ChrisChV ChrisChV requested a review from a team as a code owner September 19, 2024 01:39
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 19, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Sep 19, 2024

Thanks for the pull request, @ChrisChV!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/2u-tnl. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@ChrisChV ChrisChV marked this pull request as draft September 19, 2024 01:39
@ChrisChV ChrisChV changed the title feat: Add tags to info sidebar of library component feat: Add tags to info sidebar of library component [FC-0062] Sep 19, 2024
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label Sep 23, 2024
Copy link

codecov bot commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 95.16129% with 9 lines in your changes missing coverage. Please review.

Project coverage is 92.72%. Comparing base (053a9b1) to head (54f272d).
Report is 18 commits behind head on master.

Files with missing lines Patch % Lines
src/content-tags-drawer/ContentTagsDrawer.tsx 93.75% 5 Missing and 2 partials ⚠️
src/content-tags-drawer/data/api.mocks.ts 96.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1299      +/-   ##
==========================================
+ Coverage   92.47%   92.72%   +0.25%     
==========================================
  Files        1025     1036      +11     
  Lines       18976    19351     +375     
  Branches     3977     4036      +59     
==========================================
+ Hits        17548    17944     +396     
+ Misses       1363     1343      -20     
+ Partials       65       64       -1     

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

@ChrisChV ChrisChV marked this pull request as ready for review September 24, 2024 02:11
Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thank you for your work @ChrisChV !

  • I tested this using the instructions from the PR
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

I left some comments/suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you have some time, could you please update these tests to use the mock API instead of mocking the hooks?

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, let me check 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated: a505f8c

src/content-tags-drawer/ContentTagsDrawer.tsx Outdated Show resolved Hide resolved
src/content-tags-drawer/ContentTagsDrawer.tsx Show resolved Hide resolved
src/content-tags-drawer/ContentTagsDrawer.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

@ChrisChV Can you please just add a test that covers the code in tagsCount? And then I'll approve + merge this for you.

@@ -86,6 +87,9 @@ describe('<ContentTagsDrawer />', () => {
isError: false,
mutate: mockMutate,
});
useParams.mockReturnValue({
contentId,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that you can use the new testUtils to pass actual react-router params instead of mocking, if you want:

* render(<LibraryLayout />, { path: '/library/:libraryId/*', params: { libraryId: 'lib:Axim:testlib' } });

Might be too big of refactor to bother with now though; just making sure you're aware :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I made the refactor here: a505f8c, to create the testing for tagsCount: be07463

return (
<div>
{ tagsByTaxonomy.map((data) => (
<div key={`taxonomy-tags-collapsible-${data.id}`}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: React keys aren't rendered into the DOM and don't have to be globally unique; just unique within this parent element. So <div key={data.id}> would be perfectly fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated: ff7bd2a

bradenmacdonald added a commit to open-craft/frontend-app-authoring that referenced this pull request Sep 25, 2024
@bradenmacdonald
Copy link
Contributor

Note: I deployed this to the sandbox, because I think it's ready to go other than needing slightly more test coverage.

@ChrisChV
Copy link
Contributor Author

@bradenmacdonald It's ready for another review and merge

Copy link
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Nice work @ChrisChV. Thanks for refactoring those test cases!

@bradenmacdonald bradenmacdonald merged commit 2cd77ce into openedx:master Sep 27, 2024
7 checks passed
@bradenmacdonald bradenmacdonald deleted the chris/FAL-3847-add-tags-sidebar branch September 27, 2024 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants