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: [FC-0044] Unit page - display xblock components #857

Conversation

ihor-romaniuk
Copy link
Contributor

@ihor-romaniuk ihor-romaniuk commented Feb 28, 2024

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/raccoongang/edx-platform.git
EDX_PLATFORM_VERSION: ruzniaievdm/feat/unit-children

TUTOR_GROVE_WAFFLE_FLAGS:
  - name: contentstore.new_studio_mfe.use_new_unit_page
    everyone: true
  - name: new_core_editors.use_new_problem_editor
    everyone: true
  - name: new_core_editors.use_new_video_editor
    everyone: true
  - name: new_core_editors.use_new_text_editor
    everyone: true

TUTOR_GROVE_MFE_LMS_COMMON_SETTINGS:
  MFE_CONFIG:
    ENABLE_UNIT_PAGE: true
    ENABLE_NEW_EDITOR_PAGES: true

Description

This merge request introduces a new feature that enhances page rendering by incorporating dynamic components. The key components include:

Component Header:

  • Title: Displays the title of the xblock.
  • Edit Button: Allows users to edit the xblock.
  • Dropdown Menu: Provides a dropdown menu with various actions for additional functionalities like copy, duplicate, move, manage access and delete.

Component Content:
As a first iteration, xblock content is displayed as a placeholder block. The next iteration will change the rendering of the content by displaying HTML and resources received from the legacy endpoint (not using an iframe).

Issue: openedx/platform-roadmap#321

Depends on:

Design

https://www.figma.com/file/YeKFwSpyLaJFDs3f3p3TSa/Studio-1%3A1-mock-ups?node-id=599%3A23595

Screenshot at Feb 28 16-54-29

Testing instructions

  1. Run master devstack.
  2. Start platform make dev.up.lms+cms+frontend-app-course-authoring and make checkout on this branch.
  3. Enable new Unit page by adding a waffle flad contentstore.new_studio_mfe.use_new_unit_page in CMS admin panel.
  4. Go to Course Unit page from the Course Outline page.
  5. Make sure the course you are viewing is not outdated.
  6. Publish all sections on the Course Outline page.

@ihor-romaniuk ihor-romaniuk requested a review from a team as a code owner February 28, 2024 16:13
@openedx-webhooks
Copy link

Thanks for the pull request, @ihor-romaniuk! 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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 28, 2024
@arbrandes arbrandes self-requested a review February 28, 2024 16:15
@arbrandes arbrandes added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Feb 28, 2024
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/unit-page/display-xblock-components branch 3 times, most recently from ce76609 to e1c89b0 Compare February 28, 2024 17:11
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 90.64%. Comparing base (17b1360) to head (c8c8cad).

Files Patch % Lines
src/course-unit/header-title/HeaderTitle.jsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #857   +/-   ##
=======================================
  Coverage   90.64%   90.64%           
=======================================
  Files         578      578           
  Lines       10037    10037           
  Branches     2142     2142           
=======================================
  Hits         9098     9098           
  Misses        899      899           
  Partials       40       40           

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

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/unit-page/display-xblock-components branch from e1c89b0 to 62ae4b5 Compare February 28, 2024 17:30
@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Feb 28, 2024
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Feb 28, 2024
Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

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

Just nitpicking, as usual. :) Haven't tested the functionality yet.

package.json Outdated
@@ -46,6 +46,7 @@
"@edx/frontend-platform": "7.0.1",
"@edx/openedx-atlas": "^0.6.0",
"@openedx/paragon": "^21.5.7",
"@edx/react-unit-test-utils": "^1.7.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rather we stuck to vanilla react-testling-library, if at all possible. I'm not sure if react-unit-test-utils is maintained anymore. Does it make our lives much easier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part of the code has been removed for this MR.
In the future, this functionality will be added to further MPs with appropriate changes.

.unit-iframe-wrapper .alert-danger {
margin-bottom: 0;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this file to CourseXBlock.scss, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

@arbrandes
Copy link
Contributor

Got an error in testing in the sandbox.

image

image

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

const messages = defineMessages({
blockAltButtonEdit: {
id: 'course-authoring.course-unit.xblock.button.edit.alt',
defaultMessage: 'Edit Item',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
defaultMessage: 'Edit Item',
defaultMessage: 'Edit',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

alt={intl.formatMessage(messages.blockAltButtonEdit)}
iconAs={EditIcon}
size="md"
onClick={() => {}}
Copy link
Member

Choose a reason for hiding this comment

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

Is this being handled in another PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will be realized in the future iteration of making Edit button functional

size="md"
onClick={() => {}}
/>
<Dropdown>
Copy link
Member

Choose a reason for hiding this comment

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

The functionality of the dropdown is great, but the text color should not be colored like it is a link. Additionally the hover state for the dropdown item should not be blue. Currently it creates a contrast error which is an accessibility concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It causes because to override custom styles which were added to this instance edx-simple-theme/common/_overrides.scss and it affects the all dropdowns on the page. I think, we need to make changes in the _overrides.scss file instead of adding new extra styles of this page.
image

<Dropdown.Item>
{intl.formatMessage(messages.blockLabelButtonMove)}
</Dropdown.Item>
<Dropdown.Item>
Copy link
Member

Choose a reason for hiding this comment

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

Confirming that this functionality will be addressed in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, it will be done in next iterations.

<Dropdown.Item onClick={() => unitXBlockActions.handleDuplicate(id)}>
{intl.formatMessage(messages.blockLabelButtonDuplicate)}
</Dropdown.Item>
<Dropdown.Item>
Copy link
Member

Choose a reason for hiding this comment

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

Confirming that this functionality will be addressed in another PR

Copy link
Member

Choose a reason for hiding this comment

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

Requested mocks for Jon Fay for the move modal because there are none in th current Figma

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will be done in next iterations.

return (
<div ref={courseXBlockElementRef} {...props}>
<Card className="mb-1">
<Card.Header
Copy link
Member

Choose a reason for hiding this comment

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

Missing drag handle. Is that in scope for this ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the Drag&Drop functionality will be done in next iterations.

@arbrandes
Copy link
Contributor

This is now working in the sandbox! A couple of initial observations:

  • When I add a Text, Problem, or Video block, I get taken to a blank page. If I press back, I can see the blocks were added, though.
  • When I add a Dropdown or ORA block, they appear immediately (as one would expect).
  • When I add a Problem block, I can't choose between the different types: I just get a blank one.

Let me know if any of these are out of scope to be addressed or implemented here.

@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@KristinAoki
Copy link
Member

This is now working in the sandbox! A couple of initial observations:

  • When I add a Text, Problem, or Video block, I get taken to a blank page. If I press back, I can see the blocks were added, though.
  • When I add a Dropdown or ORA block, they appear immediately (as one would expect).
  • When I add a Problem block, I can't choose between the different types: I just get a blank one.

Let me know if any of these are out of scope to be addressed or implemented here.

Text, Video, and Problem blocks automatically open their new editors (removing the uneccessary extra edit click). The new problem editor contains the ability to chose the different problem types.

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/unit-page/display-xblock-components branch from 1cb7f79 to 32cfc78 Compare February 29, 2024 15:22
@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Feb 29, 2024
@open-craft-grove
Copy link

Sandbox deployment failed 💥
Please check the settings and requirements.
Retry deployment by pushing a new commit or updating the requirements/settings in the pull request's description.
📜 Failure Logs
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@arbrandes
Copy link
Contributor

@KristinAoki

Text, Video, and Problem blocks automatically open their new editors

That makes sense. Should they be working, then, though?

@ihor-romaniuk
Copy link
Contributor Author

@arbrandes It should work.
I tried to add required settings to display new_core_editors but sandbox deployment failed.
Could you take a look at this problem, please?

TUTOR_GROVE_WAFFLE_FLAGS:
  - name: contentstore.new_studio_mfe.use_new_unit_page
    everyone: true
  - name: new_core_editors.use_new_problem_editor
    everyone: true
  - name: new_core_editors.use_new_video_editor
    everyone: true
  - name: new_core_editors.use_new_text_editor
    everyone: true

@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Mar 1, 2024
@GlugovGrGlib GlugovGrGlib added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Mar 6, 2024
@ihor-romaniuk ihor-romaniuk added create-sandbox open-craft-grove should create a sandbox environment from this PR and removed create-sandbox open-craft-grove should create a sandbox environment from this PR labels Mar 6, 2024
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@ihor-romaniuk
Copy link
Contributor Author

ihor-romaniuk commented Mar 11, 2024

Hi @arbrandes @KristinAoki
We may have accidentally accepted this feature in another PR #832.
I solved all conflicts and we can merge fixes for this feature.

@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/unit-page/display-xblock-components branch from 32cfc78 to 93e0c27 Compare March 11, 2024 10:49
@ihor-romaniuk ihor-romaniuk force-pushed the romaniuk/unit-page/display-xblock-components branch from 93e0c27 to c8c8cad Compare March 11, 2024 10:51
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@KristinAoki KristinAoki merged commit bec59e5 into openedx:master Mar 12, 2024
5 of 6 checks passed
@openedx-webhooks
Copy link

@ihor-romaniuk 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@ihor-romaniuk ihor-romaniuk deleted the romaniuk/unit-page/display-xblock-components branch March 13, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-sandbox open-craft-grove should create a sandbox environment from this PR 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.

6 participants