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
fix: Hard-coded link in Header component changed by LMS_BASE_URL env var #186
Conversation
On index.js file of the Header component, currenly there is a hard-coded link of "https://www.edx.org". I added a new enviroment variable LOGO_DESTINATION to use it in this Header. I have also added a mechanism to use the LMS_BASE_URL environment variable if the LOGO_DESTINATION environment variable is not found or is null.
Thanks for the pull request, @ChrisChV! I've created OSPR-5806 to keep track of it in JIRA, where we prioritize reviews. 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:
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. |
@davidjoy didn't you fix this already? |
@ChrisChV Thank you for the contribution! Once you have signed our Contributor Agreement and it has been processed, you will receive a confirmation via email from our Legal team. We then will be able to review this and all your future code contributions. |
@ChrisChV Thank you for an update! They will process and get back to you soon. |
Hi @natabene. We have already been authorized as a bitmaker to contribute |
Looking around at the shared MFE header, I think we should set the logo destination to point at the dashboard for consistency:
In which case we don't need to add a new environment variable specific to gradebook. See shared header implementation here: https://github.com/edx/frontend-component-header/blob/3726792df260e72bcf9be6cd3bc921b880255604/src/Header.jsx#L82 |
@davidjoy In this case it is better to place the logo destination value in the Header as I have done now? Or pass that value through the Header props from the index file, as being done in the link you shared? |
@mattcarter FYI this PR coming. |
`index.jsx` file of Header component updated with change the hard-coded link of https://www.edx.org with a component property. `index.jsx` file of root project updated. Added the environment variable LMS BASE_URL to the parameters of the Header Component
@davidjoy Please review the new changes, I added a new logic to solve this using what you commented and without creating a new env var |
@mattcarter Do you want to have a look now? |
@mattcarter @natabene I've got some spare cycles, I can review this if you'd like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Small style suggestion
src/components/Header/index.jsx
Outdated
return ( | ||
<div className="mb-3"> | ||
<header className="d-flex justify-content-center align-items-center p-3 border-bottom-blue"> | ||
<Hyperlink destination="https://www.edx.org"> | ||
<Hyperlink {...logoProps}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the variable declarations seem unnecessary, you could just have this be <Hyperlink destination={this.props.logoDestination}>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line should just read:
<Hyperlink destination={`${getConfig().LMS_BASE_URL}/dashboard`}>
It's not really a configurable thing/there doesn't seem to be much value in passing it down from above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify this and just put the URL in the hyperlink. The index.jsx file doesn't really need to know about the URL/this code isn't reused with different URLs.
src/components/Header/index.jsx
Outdated
return ( | ||
<div className="mb-3"> | ||
<header className="d-flex justify-content-center align-items-center p-3 border-bottom-blue"> | ||
<Hyperlink destination="https://www.edx.org"> | ||
<Hyperlink {...logoProps}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line should just read:
<Hyperlink destination={`${getConfig().LMS_BASE_URL}/dashboard`}>
It's not really a configurable thing/there doesn't seem to be much value in passing it down from above.
@davidjoy It's done |
@ChrisChV 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
index.jsx
file of Header component updated with change the hard-coded link ofhttps://www.edx.org
with a component property.index.jsx
file of root project updated. Added the environment variableLMS_BASE_URL
to the parameters of the Header componentIssue: openedx/wg-build-test-release#55
What changed?
index.jsx
file of the Header component with change the hard-coded link with the component propertylogoDestination
.index.jsx
file of root project with add theLMS_BASE_URL
env var aslogoDestination
in Header component.Developer Checklist
Testing Instructions
If you start your local development server for gradebook and you load a course, when you click in the header logo, then it should redirect to the LMS dashboard.
Reviewer Checklist
Collectively, these should be completed by reviewers of this PR:
FYI: @edx/masters-devs-gta