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] Textbooks Page #890

Merged
merged 4 commits into from
Apr 30, 2024

Conversation

vladislavkeblysh
Copy link
Contributor

@vladislavkeblysh vladislavkeblysh commented Mar 12, 2024

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/raccoongang/edx-platform.git
EDX_PLATFORM_VERSION: g-glugovskiy/change_path_to_textbooks_page

TUTOR_GROVE_WAFFLE_FLAGS:
  - name: contentstore.new_studio_mfe.use_new_textbooks_page
    everyone: true

Description
This PR adds fully implemented Texbooks page.

Issue: openedx/platform-roadmap#319

Design
Figma design

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 the new Certificates page by adding a waffle flag contentstore.new_studio_mfe.use_new_textbooks_page in the CMS admin panel.
  4. Go to the Textbooks page from the Content > Pages & Resourses.
Screen.Recording.2024-03-14.at.19.08.40.mov

@vladislavkeblysh vladislavkeblysh requested a review from a team as a code owner March 12, 2024 19:08
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 12, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 12, 2024

Thanks for the pull request, @vladislavkeblysh! 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.

@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from a0f2e15 to 57e9a55 Compare March 12, 2024 19:09
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

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

Project coverage is 92.20%. Comparing base (e24fb78) to head (6e5d91c).
Report is 1 commits behind head on master.

Files Patch % Lines
src/textbooks/hooks.jsx 75.00% 6 Missing ⚠️
src/generic/modal-dropzone/useModalDropzone.jsx 71.42% 2 Missing ⚠️
src/textbooks/textbook-card/TextbooksCard.jsx 91.30% 2 Missing ⚠️
src/generic/modal-dropzone/ModalDropzone.jsx 50.00% 1 Missing ⚠️
src/textbooks/textbook-form/TextbookForm.jsx 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #890      +/-   ##
==========================================
+ Coverage   92.09%   92.20%   +0.10%     
==========================================
  Files         685      703      +18     
  Lines       12090    12334     +244     
  Branches     2609     2667      +58     
==========================================
+ Hits        11134    11372     +238     
- Misses        920      926       +6     
  Partials       36       36              

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

@vladislavkeblysh vladislavkeblysh marked this pull request as draft March 12, 2024 19:22
@vladislavkeblysh vladislavkeblysh marked this pull request as ready for review March 13, 2024 11:05
@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch 5 times, most recently from ba30003 to e3e7c5e Compare March 13, 2024 12:16
@mphilbrick211
Copy link

Hi @vladislavkeblysh! Would you mind adding a description of your changes to the top of the pull request?

@arbrandes
Copy link
Contributor

You'll probably also want to make this a draft until it's ready.

@vladislavkeblysh vladislavkeblysh marked this pull request as draft March 13, 2024 16:41
@vladislavkeblysh vladislavkeblysh marked this pull request as ready for review March 13, 2024 16:41
@vladislavkeblysh vladislavkeblysh marked this pull request as draft March 13, 2024 16:42
@vladislavkeblysh
Copy link
Contributor Author

@mphilbrick211 @arbrandes Yes, sorry, PR is not ready

@vladislavkeblysh vladislavkeblysh marked this pull request as ready for review March 13, 2024 16:44
@vladislavkeblysh vladislavkeblysh removed the request for review from a team March 13, 2024 16:46
@vladislavkeblysh vladislavkeblysh marked this pull request as draft March 13, 2024 16:48
@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from 9bf36c0 to dd34a7a Compare March 14, 2024 17:05
@vladislavkeblysh vladislavkeblysh changed the title feat: Textbooks Page feat: [FC-0044] Textbooks Page Mar 14, 2024
@vladislavkeblysh vladislavkeblysh requested review from abdulrafey38, arbrandes, KristinAoki and a team and removed request for abdulrafey38 and a team March 14, 2024 17:22
@vladislavkeblysh vladislavkeblysh self-assigned this Mar 14, 2024
@PKulkoRaccoonGang PKulkoRaccoonGang 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 Apr 4, 2024
@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from fd3e274 to c54d011 Compare April 5, 2024 11:37
Comment on lines 46 to 47
const onPreviewTextbookClick = () => {
window.location.href = `${config.LMS_BASE_URL}/courses/${courseId}/pdfbook/${textbookIndex}/`;
Copy link
Member

Choose a reason for hiding this comment

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

I think a better user experience would be to have the preview open in a new tab.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -120,6 +121,10 @@ const CourseAuthoringRoutes = () => {
path="certificates"
element={<PageWrap><Certificates courseId={courseId} /></PageWrap>}
/>
<Route
path="/textbooks"
Copy link
Member

Choose a reason for hiding this comment

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

The redirect in edx-platform needs to be updated to match the new path

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
path="/textbooks"
path="textbooks"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -93,7 +102,9 @@ const ModalDropzone = ({
onProcessUpload={handleSelectFile}
inputComponent={inputComponent}
accept={accept}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the accept is formatted the correct way because it is not only allowing PDFs to be selected for the textbooks page. I was able to select a .docx file and was shown the invalid file type error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from e9e9e06 to 680beca Compare April 9, 2024 13:32
@KristinAoki
Copy link
Member

@vladislavkeblysh please merge in master to fix the upload to code cov causing validate/tests failure

Copy link
Member

@KristinAoki KristinAoki left a comment

Choose a reason for hiding this comment

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

I will approve this once a PR for the textbook url redirect in edx-platform is merged in.

@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from 680beca to 1eee61b Compare April 16, 2024 09:07
@vladislavkeblysh
Copy link
Contributor Author

@vladislavkeblysh please merge in master to fix the upload to code cov causing validate/tests failure

Done

@vladislavkeblysh vladislavkeblysh force-pushed the keblysh/feat/textbooks-page branch from f8af63f to 34d8fa1 Compare April 24, 2024 08:14
@GlugovGrGlib
Copy link
Member

@KristinAoki The edx-platform part for textbooks was finalized already, so this PR is good to merge, thanks!

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.

Looks like you committed webpack.dev-tutor.config.js by mistake. Other than that, a couple of minor requests for changes, and one big issue: it seems the URL that's being assumed here (as provided by https://github.com/openedx/edx-platform/blob/master/cms/djangoapps/contentstore/utils.py#L459) is not working. In a Tutor dev env, I must remove pages-and-resources from the path for the textbooks page to work. Any idea why that might be?

If I go to the URL manually, though, the feature works as expected.

@@ -30,7 +30,7 @@ const FormikControl = ({
onChange={handleChange}
onBlur={handleBlur}
onFocus={handleFocus}
isInvalid={fieldTouched && fieldError}
isInvalid={!!fieldTouched && !!fieldError}
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why was the forced boolean conversion (!!) necessary, here?

Copy link
Contributor Author

@vladislavkeblysh vladislavkeblysh Apr 29, 2024

Choose a reason for hiding this comment

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

This condition did not always work correctly, and fieldError is not a boolean value and required additional transformation

} = useTextbooks(courseId);

const {
isShow: isShowProcessingNotification,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
isShow: isShowProcessingNotification,
show: showProcessingNotification,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

</section>
</Container>
<ProcessingNotification
isShow={isShowProcessingNotification}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
isShow={isShowProcessingNotification}
isShow={showProcessingNotification}

(I have a similar issue with the isShow property in <ProcessingNotification />, but that's a refactor for another day.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

},
{
label: '',
href: `/course/${courseId}/pages-and-resources/textbooks`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be the wrong URL. I could only get it to work (in a Tutor dev environment) with:

Suggested change
href: `/course/${courseId}/pages-and-resources/textbooks`,
href: `/course/${courseId}/textbooks`,

@GlugovGrGlib GlugovGrGlib force-pushed the keblysh/feat/textbooks-page branch from a5a05e9 to 7648801 Compare April 30, 2024 18:10
@GlugovGrGlib GlugovGrGlib force-pushed the keblysh/feat/textbooks-page branch from 7648801 to 6ecab8c Compare April 30, 2024 18:25
@GlugovGrGlib GlugovGrGlib force-pushed the keblysh/feat/textbooks-page branch from 6ecab8c to 6e5d91c Compare April 30, 2024 19:04
@GlugovGrGlib
Copy link
Member

@arbrandes The review comments were addressed, PR was rebased and ready for review.
The redirect path to textbooks page was updated in the edx-platform PR openedx/edx-platform#34668

@GlugovGrGlib GlugovGrGlib requested a review from arbrandes April 30, 2024 19:18
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.

Thanks for addressing my comments! Approved.

@arbrandes
Copy link
Contributor

I went through @KristinAoki's review, and it seems all comments were addressed. So I'm going ahead and merging it. If any problems remain, we can fix them individually later.

@arbrandes arbrandes merged commit 65f45f7 into openedx:master Apr 30, 2024
6 checks passed
@openedx-webhooks
Copy link

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

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.

7 participants