-
Notifications
You must be signed in to change notification settings - Fork 80
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: xblock status component and copy & paste unit option #807
feat: xblock status component and copy & paste unit option #807
Conversation
Thanks for the pull request, @navinkarkera! 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. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #807 +/- ##
==========================================
+ Coverage 90.60% 90.67% +0.06%
==========================================
Files 511 521 +10
Lines 8901 9113 +212
Branches 1918 1971 +53
==========================================
+ Hits 8065 8263 +198
- Misses 811 825 +14
Partials 25 25 ☔ View full report in Codecov by Sentry. |
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 looking good. Just a few comments. I haven't tested it yet, but though I'd give an early round of feedback
.grading-mismatch-alert { | ||
background: #FFFADB; | ||
font-size: 14px; | ||
font-weight: 400; | ||
color: #454545; | ||
} |
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 equivalent to:
bg-warning-100 small font-weight-normal text-gray-700
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.
I don't think you need most of these classes for highlights-badge, you can replace them with the following classes:
d-flex justify-content-center align-items-center font-weight-bold
This will leave just he height, width and border radius. I think the font size can be skipped, 1 rem is just resetting the size to the root size so it should be the default anyway.
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.
Removed most of the custom styles.
I think the font size can be skipped, 1 rem is just resetting the size to the root size so it should be the default anyway
For some reason, the font becomes smaller when we remove it.
font-weight: 700; | ||
} | ||
} | ||
|
||
.section-card__content { | ||
margin-left: 1.7rem; |
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 this very specific margin needed? If not, you can go for ml-4 for 1.5rem or ml-4.5 for 2rem.
Additionally, I think this style of class naming is used by Paragon and libraries but isn't the convention in the apps.
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.
borderLeft: '5px solid #000000', | ||
}; |
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 pattern here is not good for theming. What I'd recommend instead is to have this function return classes.
Create a new class called border-l-5
with the following:
.border-5 {
boder-left-width: 5px;
border-left-style: solid;
}
This is common styling for all, and after that, you can have the following code to get the style:
const getItemStatusBorder = (status) => {
const statusBorder = {
[ITEM_BADGE_STATUS.live]: 'border-info-500',
[ITEM_BADGE_STATUS.publishedNotLive]: 'border-success-500',
[ITEM_BADGE_STATUS.gated]: 'border-black',
[ITEM_BADGE_STATUS.staffOnly]: 'border-black',
[ITEM_BADGE_STATUS.unpublishedChanges]: 'border-accent-b',
[ITEM_BADGE_STATUS.draft]: 'border-accent-b',
};
return statusBorder[status] ?? '';
};
Then the consumer can just apply border-l-5 along with the above class.
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 agree but the consumer is a component called SortableItem from frontend-lib-content-components and it only accepts css style object.
import messages from './messages'; | ||
import { COURSE_BLOCK_NAMES } from '../constants'; | ||
|
||
const XBlockStatus = ({ |
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.
Can we split this component into multiple parts? Currently, it's too large.
Here is what I'd suggest breaking each function insider the component into its own react component. They can all be in the same file but it'll clean up things a bit.
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.
Also, I think instead of a generic name like item
perhaps it could be called blockData
or something more descriptive.
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.
Done. Let me know if it the file still seems big, we can probably split into multiple files.
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 there is too much reliance on query/find/getByTestId
. Using a test-id should be the last resort, and it isn't needed in most cases. I'll give a few alternates.
4e12e3e
to
9269a61
Compare
253bc91
to
734b58b
Compare
I've created issue TNL-11410 in the private 2U Jira. |
@KristinAoki This is ready for you. The CI is failing due to some issue with TaxonomyListPage which is not related to this PR. Combined open-craft#29 which implements copy & paste units feature |
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 tested this: tested on tutor master
- I read through the code
01b94bd
to
bd13693
Compare
} | ||
|
||
const renderBlockLink = (props) => ( | ||
<Popover |
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 element should be a <ModalPopup>
because <Popover>
should not contain interactive elements due to accessibility.
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.
Used Popover
just for the arrow icon but ModalPopup
doesn't seem to work nicely with hover events. Removed Popover
and added the arrow icon via css and made the Hyperlink popup using overlay component directly. The div is accessible similar to how it was in legacy.
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.
Updated z-index.
<XBlockStatus | ||
isSelfPaced={isSelfPaced} | ||
isCustomRelativeDatesActive={isCustomRelativeDatesActive} | ||
blockData={section} | ||
/> |
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.
Move this below the section highlights
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.
It is above section highlights in legacy, do we want to change it here?
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.
Yes
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.
Done.
f15707d
to
c9fc9c4
Compare
7646fc8
to
018dcef
Compare
feat: add custom relative dates flag to state refactor: add gated status type refactor: alert style feat: add status text to units test: add tests fix: lint issues refactor: break up xblock status component fix: selector for isCustomRelativeDatesActive fix: prereq default value
refactor: paste component fix: lint issues and delete unused hook test: add test fix: update api for npm broadcast channel
018dcef
to
a1d669a
Compare
@navinkarkera 🎉 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 status text under each item in the outline. Screenshot from legacy UI for reference:
The reference logic for displaying this text can be found in https://github.com/openedx/edx-platform/blob/master/cms/templates/js/course-outline.underscore.
Also combines open-craft#29
MFE Screenshot:
Test instructions:
make {lms,cms}-up
.npm start
.Depends on: openedx/edx-platform#34058