import React from 'react'; import PropTypes from 'prop-types'; import { useIntl } from '@edx/frontend-platform/i18n'; import { Button } from '@openedx/paragon'; import { Search } from '@openedx/paragon/icons'; import { baseAppUrl } from 'data/services/lms/urls'; import { reduxHooks } from 'hooks'; import track from './track'; import CourseCard from './components/CourseCard'; import messages from './messages'; import './index.scss'; import { usePaintedDoorExperimentContext } from '../RecommendationsPaintedDoorBtn/PaintedDoorExperimentContext'; import { RECOMMENDATIONS_PANEL } from '../RecommendationsPaintedDoorBtn/constants'; import RecommendationsPaintedDoorBtn from '../RecommendationsPaintedDoorBtn'; export const LoadedView = ({ courses, isControl, }) => { const { formatMessage } = useIntl(); const { courseSearchUrl } = reduxHooks.usePlatformSettingsData(); const { experimentVariation, isPaintedDoorWidgetBtnVariation, experimentLoading, } = usePaintedDoorExperimentContext(); return (

{isControl === false ? formatMessage(messages.recommendationsHeading) : formatMessage(messages.popularCoursesHeading)}

{courses.map((course) => ( ))}
{!experimentLoading && isPaintedDoorWidgetBtnVariation ? ( ) : ( )}
); }; LoadedView.defaultProps = { isControl: true, }; LoadedView.propTypes = { courses: PropTypes.arrayOf(PropTypes.shape({ courseKey: PropTypes.string, title: PropTypes.string, logoImageUrl: PropTypes.string, marketingUrl: PropTypes.string, })).isRequired, isControl: PropTypes.oneOf([true, false, null]), }; export default LoadedView;