Skip to content

Commit

Permalink
feat: Add 2U recommendations in dashboard [VAN-1094] (openedx#31026)
Browse files Browse the repository at this point in the history
  • Loading branch information
syedsajjadkazmii authored Sep 22, 2022
1 parent 62fd296 commit 96f6174
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 0 deletions.
17 changes: 17 additions & 0 deletions common/djangoapps/student/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@ def should_show_amplitude_recommendations():
return ENABLE_AMPLITUDE_RECOMMENDATIONS.is_enabled()


# Waffle flag to enable 2U Recommendations
# .. toggle_name: student.enable_2u_recommendations
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: Supports rollout of a POC for 2U recommendations.
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2022-09-20
# .. toggle_target_removal_date: None
# .. toggle_warning: None
# .. toggle_tickets: VAN-1094
ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.enable_2u_recommendations', __name__)


def should_show_2u_recommendations():
return ENABLE_2U_RECOMMENDATIONS_ON_DASHBOARD.is_enabled()


# Waffle flag to enable redesigned course enrollment confirmation email.
# .. toggle_name: student.enable_redesign_enrollment_confirmation_email
# .. toggle_implementation: WaffleFlag
Expand Down
6 changes: 6 additions & 0 deletions common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from edx_django_utils import monitoring as monitoring_utils
from edx_django_utils.plugins import get_plugins_view_context
from edx_toggles.toggles import WaffleFlag
from ipware.ip import get_client_ip
from opaque_keys.edx.keys import CourseKey
from openedx_filters.learning.filters import DashboardRenderStarted
from pytz import UTC
Expand Down Expand Up @@ -50,6 +51,7 @@
get_dashboard_consent_notification,
get_enterprise_learner_portal_context,
)
from openedx.core.djangoapps.geoinfo.api import country_code_from_ip
from common.djangoapps.student.api import COURSE_DASHBOARD_PLUGIN_VIEW_NAME
from common.djangoapps.student.helpers import cert_info, check_verify_status_by_course, get_resume_urls_for_enrollments
from common.djangoapps.student.models import (
Expand Down Expand Up @@ -778,6 +780,9 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem
if fbe_is_on:
enrollments_fbe_is_on.append(course_key)

ip_address = get_client_ip(request)[0]
country_code = country_code_from_ip(ip_address).upper()

context = {
'urls': urls,
'programs_data': programs_data,
Expand Down Expand Up @@ -832,6 +837,7 @@ def student_dashboard(request): # lint-amnesty, pylint: disable=too-many-statem
'course_info': get_dashboard_course_info(user, course_enrollments),
# TODO START: clean up as part of REVEM-199 (END)
'disable_unenrollment': disable_unenrollment,
'country_code': country_code,
}

# Include enterprise learner portal metadata and messaging
Expand Down
7 changes: 7 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5252,3 +5252,10 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring

######################## Settings for cancel retirement in Support Tools ########################
COOL_OFF_DAYS = 14

URLS_2U_LOBS = {
'executive_education': 'https://www.edx.org/executive-education',
'masters_degree': 'https://www.edx.org/masters',
'bachelors_degree': 'https://www.edx.org/bachelors',
'boot_camps': 'https://www.edx.org/boot-camps',
}
178 changes: 178 additions & 0 deletions lms/static/js/learner_dashboard/Static2UCallouts.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
/* global gettext */
import React from 'react';

class Static2UCallouts extends React.Component {
render() {
return (
<div className="static-callouts-main">
<div className="static-callouts-header">
<div className="static-callouts-heading">
<h2 className="static-callouts-heading-black">
{gettext('More opportunities for you')}
<h2 className="static-callouts-heading-red">{gettext(' to learn')}</h2>
</h2>
</div>
<p className="static-callouts-subheading">
{gettext('We\'ve added 500+ learning opportunities to create one of the world\'s most '
+ 'comprehensive free-to-degree online learning platforms.')}
</p>
</div>
<div className="static-callouts-cards">
<a
href={`${this.props.executiveEducationUrl}?vanguards_click=execed`}
target="_blank"
rel="noopener noreferrer"
className={
this.props.countryCode !== 'US' ? (
'static-callouts-card static-callouts-card-no-bootcamp'
) : 'static-callouts-card'
}
>
<div className="static-callouts-card-badge">
New
</div>
<h3 className="static-callouts-card-heading">
Executive Education
</h3>
<div className="static-callouts-card-description">
Short courses to develop leadership skills
<svg
width="30"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
role="img"
focusable="false"
aria-hidden="true"
>
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
</svg>
</div>
</a>
<div
className={
this.props.countryCode !== 'US' ? (
'static-callouts-cards-divider static-callouts-cards-divider-no-bootcamp'
) : 'static-callouts-cards-divider'
}
>
<svg viewBox="2 0 25 95">
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
</svg>
</div>
<a
href={`${this.props.mastersDegreeUrl}?vanguards_click=masters`}
target="_blank"
rel="noopener noreferrer"
className={
this.props.countryCode !== 'US' ? (
'static-callouts-card static-callouts-card-no-bootcamp'
) : 'static-callouts-card'
}
>
<div className="static-callouts-card-badge">
New
</div>
<h3 className="static-callouts-card-heading">
Master’s Degrees
</h3>
<div className="static-callouts-card-description">
Online degree programs from top universities
<svg
width="30"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
role="img"
focusable="false"
aria-hidden="true"
>
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
</svg>
</div>
</a>
<div
className={
this.props.countryCode !== 'US' ? (
'static-callouts-cards-divider static-callouts-cards-divider-no-bootcamp'
) : 'static-callouts-cards-divider static-callouts-cards-break'
}
>
<svg viewBox="2 0 25 95">
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
</svg>
</div>
<a
href={`${this.props.bachelorsDegreeUrl}?vanguards_click=bachelors`}
target="_blank" rel="noopener noreferrer"
className={
this.props.countryCode !== 'US' ? (
'static-callouts-card static-callouts-card-no-bootcamp'
) : 'static-callouts-card'
}
>
<div className="static-callouts-card-badge">
New
</div>
<h3 className="static-callouts-card-heading">
Bachelor’s Degrees
</h3>
<div className="static-callouts-card-description">
Begin or complete a degree; fully online
<svg
width="30"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
role="img"
focusable="false"
aria-hidden="true"
>
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
</svg>
</div>
</a>
{this.props.countryCode === 'US' && (
<div className="static-callouts-cards-divider">
<svg viewBox="2 0 25 95">
<path d="M 0 120 l 30 -150" stroke="#EAE6E5" strokeWidth="4" fill="none" />
</svg>
</div>
)}
{this.props.countryCode === 'US' && (
<a href={`${this.props.bootCampsUrl}?vanguards_click=bootcamps`}
target="_blank"
className="static-callouts-card">
<div className="static-callouts-card-badge">
New
</div>
<h3 className="static-callouts-card-heading">
Boot Camps
</h3>
<div className="static-callouts-card-description">
Intensive, hands-on, project-based training
<svg
width="30"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
role="img"
focusable="false"
aria-hidden="true"
>
<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z" fill="currentColor" />
</svg>
</div>
</a>
)}
</div>
</div>
);
}
}

export { Static2UCallouts };
1 change: 1 addition & 0 deletions webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ module.exports = Merge.smart({
AxiosJwtTokenService: './lms/static/js/jwt_auth/AxiosJwtTokenService.js',
EnterpriseLearnerPortalModal: './lms/static/js/learner_dashboard/EnterpriseLearnerPortalModal.jsx',
RecommendationsPanel: './lms/static/js/learner_dashboard/RecommendationsPanel.jsx',
Static2UCallouts: './lms/static/js/learner_dashboard/Static2UCallouts.jsx',

// Learner Dashboard
EntitlementFactory: './lms/static/js/learner_dashboard/course_entitlement_factory.js',
Expand Down

0 comments on commit 96f6174

Please sign in to comment.