-
Notifications
You must be signed in to change notification settings - Fork 75
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: tag sections, subsections, and the whole course (FC-0053) #879
feat: tag sections, subsections, and the whole course (FC-0053) #879
Conversation
Thanks for the pull request, @rpenido! 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. |
6944de6
to
2b09ef1
Compare
47c2f4f
to
d928dda
Compare
const StatusBarItem = ({ title, children }) => ( | ||
<div className="d-flex flex-column justify-content-between"> | ||
<h5>{title}</h5> | ||
<div className="d-flex align-items-center"> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
|
||
StatusBarItem.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
children: PropTypes.node, | ||
}; | ||
|
||
StatusBarItem.defaultProps = { | ||
children: null, | ||
}; | ||
|
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 created this component to avoid the repetition of the code below:
<div className="d-flex flex-column justify-content-between">
<h5>{title}</h5>
....
1b57202
to
c13b2c5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #879 +/- ##
==========================================
+ Coverage 91.87% 91.93% +0.05%
==========================================
Files 572 571 -1
Lines 10058 10179 +121
Branches 2160 2205 +45
==========================================
+ Hits 9241 9358 +117
- Misses 790 794 +4
Partials 27 27 ☔ View full report in Codecov by Sentry. |
b1c18e1
to
d454fc6
Compare
d454fc6
to
d1bad89
Compare
|
||
const isDisabledPublish = (status === ITEM_BADGE_STATUS.live | ||
|| status === ITEM_BADGE_STATUS.publishedNotLive) && !hasChanges; | ||
|
||
const { data: contentTagCount } = useContentTagsCount(cardId); |
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.
@rpenido Will we follow the method of making a call on each card? I'm still leaning toward the approach of fetch tag counts of the entire course.
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.
The current code fetches tags for the entire course, but the hook returns the value only for the requested contentId
.
See:
Added some comments here: e6bc92d
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.
Ohh, I understand, thanks 👍
f89ea10
to
e6bc92d
Compare
@rpenido When open the tag drawer in the course header, the drawer title keeps loading (You can see it in the GIF on the description) |
ac1b94c
to
dac33de
Compare
dac33de
to
e39955a
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.
@rpenido Looks good! 👍
- I tested this: I followed the testing instructions.
- I read through the code and considered the security, stability and performance implications of the changes.
- I tested that the UI can be used with a keyboard only (tab order, keyboard controls).
- Includes tests for bugfixes and/or features added.
- Includes documentation
@@ -41,6 +41,14 @@ const messages = defineMessages({ | |||
id: 'course-authoring.course-outline.status-bar.highlight-emails.link', | |||
defaultMessage: 'Learn more', | |||
}, | |||
courseTagsTitle: { | |||
id: 'course-authoring.course-outline.status-bar.course-tags', | |||
defaultMessage: 'Course 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.
This is a friendly advance warning that soon we'll be requiring descriptions to be added to messages: openedx/frontend-build#517. For now I'm not going to block the PR, but it would be nice if you added some. :)
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! Done: f0001a4
src/content-tags-drawer/data/api.js
Outdated
@@ -30,6 +31,7 @@ export const getTaxonomyTagsApiUrl = (taxonomyId, options = {}) => { | |||
}; | |||
export const getContentTaxonomyTagsApiUrl = (contentId) => new URL(`api/content_tagging/v1/object_tags/${contentId}/`, getApiBaseUrl()).href; | |||
export const getXBlockContentDataApiURL = (contentId) => new URL(`/xblock/outline/${contentId}`, getApiBaseUrl()).href; | |||
export const getCourseContentDataApiURL = (contentId) => new URL(`/api/courses/v1/courses/${contentId}/`, getLmsApiBaseUrl()).href; |
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.
Is there a Studio API you can use for this? It's better not to use LMS APIs for the "Course Authoring" frontend if we don't have to.
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 not sure @bradenmacdonald.
I used the same endpoint that brings the course info to the outline:
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.
OK I guess you can leave it for now then, but I've asked on Slack if there's a better way. I'll let you know if I hear anything better.
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.
You can use /api/contentstore/v1/course_settings/:course_id
which is a CMS API returns the display_name
. But I guess either way is fine.
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.
Nice! Fixed here: 1f14240
cbb9879
to
95300f2
Compare
95300f2
to
a9fd664
Compare
97f3c87
to
7f58c5a
Compare
Hi @xitij2000 ! I rebased this PR with the last changes. |
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.
This is a big PR with a lot of changes. I've tested it and it seems to work, but I will need to continue the review on monday.
// FixMe: remove code below | ||
// queryClient.invalidateQueries({ queryKey: ['contentTaxonomyTagsCount', contentId] }); |
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 guess this is left behind by mistake?
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! Sorry for that @xitij2000!
Fixed: 643cc1e
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.
Looks good! Just a minor point, and then it's good to go from my side.
<a | ||
className="small ml-2" | ||
href="#" | ||
onClick={() => openManageTagsDrawer()} |
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.
Why not make this a button? Additionally, you can simplify the call to onClick={openManageTagsDrawer}
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 was following the Figma design. It is possible to have the same appearance using a button component (that way we can remove the eslint warning)?
Fixed the function assignment here: dd7fdc2
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.
Does the figma design specific that it has to be a link? I don't know the advantage of using a link here since it's being used like a button here with an onClick handler and the actual link usage is being supperessed.
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.
@rpenido 🎉 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
Adds the Manage tags menu item and TagCount button to Sections, Subsections and the whole Course.
More Infomation
Testing Instructions
Manage Tags
in the course header and add some tagsManage tags
menu item in the three dots to add tags to Sections, Subsections and UnitsPrivate ref: FAL-3678