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

Generic label for Programs & Events Dashboard #6061

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

bhushan354
Copy link
Contributor

@bhushan354 bhushan354 commented Dec 13, 2024

NOTE: Please review the pull request process before opening your first PR: https://github.com/WikiEducationFoundation/WikiEduDashboard/blob/master/CONTRIBUTING.md#pull-request-process

What this PR does

This PR fixes : #6057
Update link label from 'View Course Page' to 'View Page'

Screenshots

Before:
image

After:
image

Open questions and concerns

< anything you learned that you want to share, or questions you're wondering about related to this PR >

@ragesoss
Copy link
Member

It looks like this just changes it in all cases. Instead, it needs to switch behavior either based on Course type or based on Features.wiki_ed?. The locale actually already has an entry for the courses_generic version ('View Program Page'), so the necessary change is to use the correct one on Programs & Events Dashboard configuration without affecting the Wiki Education Dashboard configuration.

@ragesoss ragesoss marked this pull request as draft December 13, 2024 19:27
@bhushan354
Copy link
Contributor Author

bhushan354 commented Dec 14, 2024

@ragesoss Thanks for the feedback! I’ll update the PR to handle the behavior based on Features.wiki_ed? as you suggested.

@bhushan354
Copy link
Contributor Author

bhushan354 commented Dec 16, 2024

Hi @ragesoss ,
image

Is this the program and event dashboard, or the one that appears when we click on the username?

@ragesoss
Copy link
Member

@bhushan354 "Programs & Events Dashboard" is outreachdashboard.wmflabs.org, one of two production instances of the Dashboard. The other is Wiki Education Dashboard dashboard.wikiedu.org. The two sites have many behavior differences, mainly controlled by the wiki_education setting in application.yml (which in turn controls Features.wiki_ed?, which is used in the Ruby environment to decide which behavior to use, and Features.wikiEd in the JavaScript environment). So in a dev environment, you need to set that value to false to use Programs & Events Dashboard mode.

template.erb Outdated
@@ -1 +1,2 @@
window.stores = <%= JSON.generate(translations) %>;
window.Features = { wiki_ed: <%= Features.wiki_ed?.to_json %> };
Copy link
Member

Choose a reason for hiding this comment

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

This is normally handled in the shared _head haml template. I'm not sure what this .erb file is for but I don't think we use it in production. @TheTrio do you remember what this erb file is for? Something needed for Hot Module Reloading from #5354 ? Or maybe it's just an accident and not used for anything?

@@ -2,10 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';

const CourseDetails = ({ courses }) => {
const labelKey = window.Features.wiki_ed ? 'courses.view_page' : 'courses_generic.view_page';
Copy link
Member

Choose a reason for hiding this comment

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

window shouldn't be necessary here, as we normally call Features.wikiEd anywhere in the JS that needs to switch behavior based on this setting.

Copy link
Member

Choose a reason for hiding this comment

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

Note that we have a helper function that is built to do this kind of switching: CourseUtils.i18n. It might be that the necessary data is not directly available, but you should check whether the course_string_prefix is part of the JS state already, which will let you use that utility function instead of implementing behavior switch here.

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 have removed that. Thank you for helping me understand this!

@bhushan354
Copy link
Contributor Author

bhushan354 commented Dec 16, 2024

@bhushan354 "Programs & Events Dashboard" is outreachdashboard.wmflabs.org, one of two production instances of the Dashboard. The other is Wiki Education Dashboard dashboard.wikiedu.org. The two sites have many behavior differences, mainly controlled by the wiki_education setting in application.yml (which in turn controls Features.wiki_ed?, which is used in the Ruby environment to decide which behavior to use, and Features.wikiEd in the JavaScript environment). So in a dev environment, you need to set that value to false to use Programs & Events Dashboard mode.

Thanks for letting me know , Since the application.yml file has already been set to false, I made the changes while recompiling the webpack. Please let me know if any further enhancements are needed. Thanks !

@ragesoss ragesoss marked this pull request as ready for review December 16, 2024 19:40
@bhushan354 bhushan354 changed the title Update link label from 'View Course Page' to 'View Page' Generic label for Programs & Events Dashboard Dec 17, 2024
@ragesoss ragesoss merged commit 5220f4e into WikiEducationFoundation:master Dec 17, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants