Skip to content

feat: [FC-0044] Certificates page - #872

Merged
KristinAoki merged 2 commits into
openedx:masterfrom
raccoongang:hudym/certificates-page
Apr 4, 2024
Merged

feat: [FC-0044] Certificates page#872
KristinAoki merged 2 commits into
openedx:masterfrom
raccoongang:hudym/certificates-page

Conversation

@khudym

@khudym khudym commented Mar 7, 2024

Copy link
Copy Markdown
Contributor

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

openedx-webhooks commented Mar 7, 2024

Copy link
Copy Markdown

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 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
Copy Markdown

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

@codecov

codecov Bot commented Mar 7, 2024

Copy link
Copy Markdown

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
Copy Markdown

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

@open-craft-grove

Copy link
Copy Markdown

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
Copy Markdown

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 force-pushed the hudym/certificates-page branch from 42210e0 to 75e7835 Compare March 12, 2024 09:46
@open-craft-grove

Copy link
Copy Markdown

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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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.

@khudym khudym Mar 14, 2024

Copy link
Copy Markdown
Contributor Author

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

Comment thread src/certificates/certificate-signatories/messages.js Outdated
Comment thread src/certificates/certificate-signatories/messages.js Outdated
Comment thread src/certificates/certificate-signatories/messages.js Outdated
},
editCertificateConfirmBtnText: {
id: 'course-authoring.certificates.details.confirm.edit.btn.text',
defaultMessage: 'Yes, continue',

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

Comment thread src/certificates/certificate-signatories/CertificateSignatories.jsx Outdated

@arbrandes arbrandes left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixed

Comment thread src/certificates/certificate-signatories/CertificateSignatories.jsx Outdated
handleBlur: PropTypes.func,
setFieldValue: PropTypes.func,
setEditModes: PropTypes.func,
arrayHelpers: PropTypes.shape({}),

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.',
  },

@khudym khudym left a comment

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, fixed

Comment thread src/certificates/certificate-signatories/CertificateSignatories.jsx Outdated
handleBlur: PropTypes.func,
setFieldValue: PropTypes.func,
setEditModes: PropTypes.func,
arrayHelpers: PropTypes.shape({}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment thread src/certificates/certificate-signatories/messages.js Outdated
Comment thread src/certificates/certificate-signatories/messages.js Outdated
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>

@khudym khudym Mar 14, 2024

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 force-pushed the hudym/certificates-page branch from 75e7835 to 2c22c7c Compare March 14, 2024 18:16
@khudym
khudym requested a review from a team as a code owner March 14, 2024 18:16
@open-craft-grove

Copy link
Copy Markdown

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 force-pushed the hudym/certificates-page branch from 42e3f41 to 28baed5 Compare March 15, 2024 15:40
@khudym khudym removed their assignment Mar 15, 2024
@open-craft-grove

Copy link
Copy Markdown

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

@peterkulko peterkulko 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
Copy Markdown

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

Copy link
Copy Markdown
Contributor Author

This PR depends on BE

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

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
Copy Markdown

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

@peterkulko peterkulko 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
Copy Markdown

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

@khudym
khudym marked this pull request as ready for review March 20, 2024 07:42
@khudym
khudym force-pushed the hudym/certificates-page branch from 28baed5 to fdc514a Compare March 25, 2024 16:40
@open-craft-grove

Copy link
Copy Markdown

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

@khudym
khudym requested review from KristinAoki and arbrandes March 26, 2024 08:32
@open-craft-grove

Copy link
Copy Markdown

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

@khudym
khudym force-pushed the hudym/certificates-page branch from fdc514a to 77173dd Compare March 28, 2024 08:17
@open-craft-grove

Copy link
Copy Markdown

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

@khudym

khudym commented Mar 28, 2024

Copy link
Copy Markdown
Contributor Author

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

@khudym
khudym force-pushed the hudym/certificates-page branch from 77173dd to 5d6a68a Compare April 2, 2024 11:10
@open-craft-grove

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown

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

@arbrandes arbrandes left a comment

Copy link
Copy Markdown
Contributor

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
@openedx-webhooks

Copy link
Copy Markdown

@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