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] Certificates page #872

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

khudym
Copy link
Contributor

@khudym khudym commented Mar 7, 2024

Settings

EDX_PLATFORM_REPOSITORY: https://github.com/openedx/edx-platform.git
EDX_PLATFORM_VERSION: master

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

Description

This PR adds fully implemented Certificates page.

Issue: openedx/platform-roadmap#317

Developer notes

  • the page reloads after the user saves changes to the certificate or signature. This issue will be fixed within Group Configurations pull request;
  • temporary added ModalNotification component that should be removed after merging this PR;

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_certificates_page in the CMS admin panel.
  4. Go to the Certificates page from the Settings navbar.
new-certificates-page.mp4

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 7, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 7, 2024

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

@khudym khudym marked this pull request as ready for review March 7, 2024 07:27
@khudym khudym requested a review from a team as a code owner March 7, 2024 07:27
@GlugovGrGlib GlugovGrGlib added the create-sandbox open-craft-grove should create a sandbox environment from this PR label Mar 7, 2024
@khudym khudym removed their assignment Mar 7, 2024
@open-craft-grove
Copy link

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

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

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

Project coverage is 91.99%. Comparing base (80bf869) to head (2364f8e).
Report is 6 commits behind head on master.

Files Patch % Lines
src/generic/modal-dropzone/useModalDropzone.jsx 81.03% 11 Missing ⚠️
...ficates/certificate-details/CertificateDetails.jsx 83.33% 3 Missing ⚠️
...certificate-signatories/hooks/useEditSignatory.jsx 82.35% 3 Missing ⚠️
src/certificates/data/slice.js 85.71% 3 Missing ⚠️
src/certificates/data/thunks.js 95.00% 3 Missing ⚠️
...ificate-edit-form/hooks/useCertificateEditForm.jsx 91.30% 2 Missing ⚠️
...ertificate-signatories/signatory/SignatoryForm.jsx 93.10% 2 Missing ⚠️
src/generic/modal-dropzone/ModalDropzone.jsx 86.66% 1 Missing and 1 partial ⚠️
...ates/certificate-edit-form/CertificateEditForm.jsx 92.85% 1 Missing ⚠️
src/certificates/data/api.js 95.23% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #872      +/-   ##
==========================================
+ Coverage   91.91%   91.99%   +0.08%     
==========================================
  Files         572      612      +40     
  Lines       10169    10734     +565     
  Branches     2199     2299     +100     
==========================================
+ Hits         9347     9875     +528     
- Misses        795      830      +35     
- Partials       27       29       +2     

☔ 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

@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

@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

@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

const previewUrl = useMemo(() => {
if (!certificateWebViewUrl) { return ''; }

const url = new URL(certificateWebViewUrl, window.location.origin);
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
const url = new URL(certificateWebViewUrl, window.location.origin);
const url = () => new URL(certificateWebViewUrl, window.location.origin);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder what the benefit is, since the creation of a url instance is already optimized by React.useMemo. Plus, this is no reusable logic, the url object is used immediately. Could you please explain this decision?

Copy link
Member

Choose a reason for hiding this comment

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

There have been previous issues where URL was not created when it was not part of a function. See #706 for details about how it might throw an 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.

Thanks, i see, i will fix it now

dispatch(fetchCertificates(courseId));
}, [courseId]);

document.title = getPageHeadTitle(courseTitle, intl.formatMessage(messages.headingTitleTabText));
Copy link
Member

Choose a reason for hiding this comment

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

Remove this and use <Helmet /> in Certificates.jsx. See AccessibilityPages.jsx L20-L26. getPageHeadTitle can still be used to format the mesage.

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

Comment on lines 21 to 29
<Stack direction="horizontal" className="justify-content-center align-items-center" gap="3.5">
<span className="small">{intl.formatMessage(messages.noCertificatesText)}</span>
<Button
iconBefore={AddIcon}
onClick={handleCreateMode}
>
{intl.formatMessage(messages.setupCertificateBtn)}
</Button>
Copy link
Member

Choose a reason for hiding this comment

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

It makes more sense for this to be use ActionRow instead of Stack and ActionRow.Spacer to separate the text and button.

Copy link
Contributor Author

@khudym khudym Mar 14, 2024

Choose a reason for hiding this comment

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

Thanks, did not know.
Fixed

Is it ok if it differs from the design?
Screenshot 2024-03-14 at 14 43 05

Design
Screenshot 2024-03-14 at 14 49 38

src/certificates/certificate-signatories/messages.js Outdated Show resolved Hide resolved
src/certificates/certificate-signatories/messages.js Outdated Show resolved Hide resolved
src/certificates/certificate-signatories/messages.js Outdated Show resolved Hide resolved
},
editCertificateConfirmBtnText: {
id: 'course-authoring.certificates.details.confirm.edit.btn.text',
defaultMessage: 'Yes, continue',
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: 'Yes, continue',
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.

Fixed

Just for context, this is the message for the modal that appears when you click on the edit button at the top of the activated certificate.
Long text forced us to change the modal size, as the button text does not fit inside the button.

As it is now on the old site
Screenshot 2024-03-14 at 09 29 40

Example with large text
Screenshot 2024-03-14 at 09 38 59

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 great for the most part, but I do have a couple of questions and requests for changes.

</Card.Section>
<Card.Footer className="justify-content-start">
<Button type="submit">
{intl.formatMessage(commonMesages.saveTooltip)}
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
{intl.formatMessage(commonMesages.saveTooltip)}
{intl.formatMessage(commonMessages.saveTooltip)}

Even if this was an inherited typo, I believe we should fix it as part of this 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.

Sure, fixed

handleBlur: PropTypes.func,
setFieldValue: PropTypes.func,
setEditModes: PropTypes.func,
arrayHelpers: PropTypes.shape({}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the shape of arrayHelpers unpredictable?

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

id: 'course-authoring.certificates.sidebar.about2.title',
defaultMessage: 'Issuing certificates to learners',
},
about_2_Description_1: {
Copy link
Contributor

Choose a reason for hiding this comment

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

These message identifiers aren't very descriptive. Can we try and come up with some less generic ones? (It's bad enough that none of the messages have descriptions, but I'm not going to hold the PRs up on this... for now.)

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

Is this more appropriate?)

 workingWithCertificatesTitle: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.title',
    defaultMessage: 'Working with certificates',
  },
  workingWithCertificatesFirstParagraph: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.first-paragraph',
    defaultMessage: 'Specify a course title to use on the certificate if the course\'s official title is too long to be displayed well.',
  },
  workingWithCertificatesSecondParagraph: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.second-paragraph',
    defaultMessage: 'For verified certificates, specify between one and four signatories and upload the associated images. To edit or delete a certificate before it is activated, hover over the top right corner of the form and select {strongText} or the delete icon.',
  },

Copy link
Contributor Author

@khudym khudym left a comment

Choose a reason for hiding this comment

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

Thank you for the review!
Fixed most of the comments but also left a couple questions

},
editCertificateConfirmBtnText: {
id: 'course-authoring.certificates.details.confirm.edit.btn.text',
defaultMessage: 'Yes, continue',
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

Just for context, this is the message for the modal that appears when you click on the edit button at the top of the activated certificate.
Long text forced us to change the modal size, as the button text does not fit inside the button.

As it is now on the old site
Screenshot 2024-03-14 at 09 29 40

Example with large text
Screenshot 2024-03-14 at 09 38 59

</Card.Section>
<Card.Footer className="justify-content-start">
<Button type="submit">
{intl.formatMessage(commonMesages.saveTooltip)}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixed

handleBlur: PropTypes.func,
setFieldValue: PropTypes.func,
setEditModes: PropTypes.func,
arrayHelpers: PropTypes.shape({}),
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

src/certificates/certificate-signatories/messages.js Outdated Show resolved Hide resolved
src/certificates/certificate-signatories/messages.js Outdated Show resolved Hide resolved
Comment on lines 21 to 29
<Stack direction="horizontal" className="justify-content-center align-items-center" gap="3.5">
<span className="small">{intl.formatMessage(messages.noCertificatesText)}</span>
<Button
iconBefore={AddIcon}
onClick={handleCreateMode}
>
{intl.formatMessage(messages.setupCertificateBtn)}
</Button>
Copy link
Contributor Author

@khudym khudym Mar 14, 2024

Choose a reason for hiding this comment

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

Thanks, did not know.
Fixed

Is it ok if it differs from the design?
Screenshot 2024-03-14 at 14 43 05

Design
Screenshot 2024-03-14 at 14 49 38

dispatch(fetchCertificates(courseId));
}, [courseId]);

document.title = getPageHeadTitle(courseTitle, intl.formatMessage(messages.headingTitleTabText));
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

id: 'course-authoring.certificates.sidebar.about2.title',
defaultMessage: 'Issuing certificates to learners',
},
about_2_Description_1: {
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

Is this more appropriate?)

 workingWithCertificatesTitle: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.title',
    defaultMessage: 'Working with certificates',
  },
  workingWithCertificatesFirstParagraph: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.first-paragraph',
    defaultMessage: 'Specify a course title to use on the certificate if the course\'s official title is too long to be displayed well.',
  },
  workingWithCertificatesSecondParagraph: {
    id: 'course-authoring.certificates.sidebar.working-with-certificates.second-paragraph',
    defaultMessage: 'For verified certificates, specify between one and four signatories and upload the associated images. To edit or delete a certificate before it is activated, hover over the top right corner of the form and select {strongText} or the delete icon.',
  },

const previewUrl = useMemo(() => {
if (!certificateWebViewUrl) { return ''; }

const url = new URL(certificateWebViewUrl, window.location.origin);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder what the benefit is, since the creation of a url instance is already optimized by React.useMemo. Plus, this is no reusable logic, the url object is used immediately. Could you please explain this decision?

@khudym khudym requested a review from a team as a code owner March 14, 2024 18:16
@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

@khudym khudym removed their assignment Mar 15, 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

@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 Mar 15, 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

@khudym
Copy link
Contributor Author

khudym commented Mar 18, 2024

This PR depends on BE

@khudym khudym marked this pull request as draft March 18, 2024 09:15
@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 Mar 18, 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

@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

@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 Mar 18, 2024
@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

@open-craft-grove
Copy link

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

@khudym
Copy link
Contributor Author

khudym commented Mar 28, 2024

In sandbox there is an issue with white background for subheader that comes from css overrides.

Screenshot 2024-03-28 at 10 59 09

This case doesnt reproduce locally (devstack)

Screenshot 2024-03-28 at 10 58 26

@open-craft-grove
Copy link

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

Copy link
Member

Choose a reason for hiding this comment

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

Please add descriptions to messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Member

Choose a reason for hiding this comment

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

Please add descriptions to messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Member

Choose a reason for hiding this comment

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

Please add descriptions to messages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@open-craft-grove
Copy link

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

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.

Works for me!

@KristinAoki KristinAoki merged commit e306b62 into openedx:master Apr 4, 2024
5 of 6 checks passed
@openedx-webhooks
Copy link

@khudym 🎉 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