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

Content Libraries: Advanced Component Info & OLX Editor [FC-0062] #1346

Merged

Conversation

bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Sep 28, 2024

Description

This PR adds a new "Advanced details" section to the "Details" tab of library components in the Authoring MFE. This replaces the previous "developer info" panel that was only visible in development builds. This one is visible to everyone, but hidden behind a collapsible widget.

Collapsed (default) Expanded
Screenshot











Screenshot

It includes the OLX editor, with a warning that you need to be very careful using it:

Screenshot

If you make a mistake in the OLX and it's invalid, you'll get an error message like this:

Screenshot

I also added a list of assets, though it depends on this WIP:

Screenshot 2024-09-28 at 7 15 02 PM

TODO before merging

Private ref: FAL-3880

@bradenmacdonald bradenmacdonald requested a review from a team as a code owner September 28, 2024 21:05
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald!

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 28, 2024
@bradenmacdonald bradenmacdonald changed the title Content Libraries: Advanced Component Info & OLX Editor Content Libraries: Advanced Component Info & OLX Editor [FC-0062] Sep 28, 2024
@bradenmacdonald bradenmacdonald added the FC Relates to an Axim Funded Contribution project label Sep 28, 2024
Copy link

codecov bot commented Sep 28, 2024

Codecov Report

Attention: Patch coverage is 93.02326% with 6 lines in your changes missing coverage. Please review.

Project coverage is 92.94%. Comparing base (b957f3b) to head (413259e).

Files with missing lines Patch % Lines
src/generic/CodeEditor.tsx 90.90% 2 Missing ⚠️
...authoring/component-info/ComponentAdvancedInfo.tsx 95.12% 2 Missing ⚠️
...rary-authoring/component-info/ComponentPreview.tsx 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1346      +/-   ##
==========================================
- Coverage   92.97%   92.94%   -0.04%     
==========================================
  Files        1036     1037       +1     
  Lines       19427    19509      +82     
  Branches     4131     4084      -47     
==========================================
+ Hits        18063    18133      +70     
- Misses       1299     1313      +14     
+ Partials       65       63       -2     

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

@bradenmacdonald bradenmacdonald force-pushed the braden/advanced-component-info branch 3 times, most recently from 8312613 to f2b5ef7 Compare October 5, 2024 19:06
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.

Hi @bradenmacdonald, this is looking good!

I found a small bug and added one possible solution. Let me know what you think!

*/}
</Alert>
)}
<CodeEditor readOnly={!isEditingOLX} editorRef={editorRef}>{olx}</CodeEditor>
Copy link
Contributor

@rpenido rpenido Oct 7, 2024

Choose a reason for hiding this comment

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

Small bug: If you click on another component, the CodeEditor is not updating.

We can fix that making the CodeEditor rerender when we change the usageKey.

Suggested change
<CodeEditor readOnly={!isEditingOLX} editorRef={editorRef}>{olx}</CodeEditor>
<CodeEditor key={usageKey} readOnly={!isEditingOLX} editorRef={editorRef}>{olx}</CodeEditor>

@@ -0,0 +1,55 @@
/* eslint-disable import/prefer-default-export */
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can go as we are also exporting the type here.

Suggested change
/* eslint-disable import/prefer-default-export */

@@ -0,0 +1,122 @@
/* eslint-disable no-nested-ternary */
/* eslint-disable import/prefer-default-export */
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not directly related here, but is there a reason why we don't remove this lint rule upstream?
Personally, I also prefer named exports.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I guess I've just been lazy, but it's time to do that. openedx/eslint-config#164

title={intl.formatMessage(messages.advancedDetailsTitle)}
>
<dl>
<dt><FormattedMessage {...messages.advancedDetailsUsageKey} /></dt>
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this matters for the MVP, but we are using a different style across the sidebar

Suggested change
<dt><FormattedMessage {...messages.advancedDetailsUsageKey} /></dt>
<h3 className="h5"><FormattedMessage {...messages.advancedDetailsUsageKey} /></h3>

@bradenmacdonald
Copy link
Contributor Author

@rpenido Thanks! I addressed your comments.

Copy link
Contributor

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

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

Looks good. Waiting for the review of @rpenido to merge

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, @bradenmacdonald!

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

CC @ChrisChV

@bradenmacdonald bradenmacdonald merged commit 75f937e into openedx:master Oct 8, 2024
6 checks passed
@bradenmacdonald bradenmacdonald deleted the braden/advanced-component-info branch October 8, 2024 16:41
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
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants