fix static urls (#43)
This commit is contained in:
@@ -59,6 +59,8 @@ exports[`LearnerDashboardHeader snapshots without collapsed 1`] = `
|
||||
className="d-flex"
|
||||
>
|
||||
<Button
|
||||
as="a"
|
||||
href="http://localhost:18000/dashboard/programs"
|
||||
iconBefore={[MockFunction icons.Program]}
|
||||
variant="inverse-tertiary"
|
||||
>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Button, Image } from '@edx/paragon';
|
||||
|
||||
import topBanner from 'assets/top_stripe.svg';
|
||||
import MasqueradeBar from 'containers/MasqueradeBar';
|
||||
import urls from 'data/services/lms/urls';
|
||||
|
||||
import AuthenticatedUserDropdown from './AuthenticatedUserDropdown';
|
||||
import GreetingBanner from './GreetingBanner';
|
||||
@@ -16,6 +17,8 @@ import { useIsCollapsed } from './hooks';
|
||||
import messages from './messages';
|
||||
import './index.scss';
|
||||
|
||||
const { programsUrl } = urls;
|
||||
|
||||
export const UserMenu = () => {
|
||||
const { authenticatedUser } = useContext(AppContext);
|
||||
return authenticatedUser ? (<AuthenticatedUserDropdown username={authenticatedUser.username} />) : null;
|
||||
@@ -35,7 +38,7 @@ export const LearnerDashboardHeader = () => {
|
||||
<header className="learner-dashboard-header">
|
||||
<div className="d-flex">
|
||||
{(!isCollapsed) && (
|
||||
<Button variant="inverse-tertiary" iconBefore={Program}>
|
||||
<Button as="a" href={programsUrl} variant="inverse-tertiary" iconBefore={Program}>
|
||||
{formatMessage(messages.switchToProgram)}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -18,7 +18,7 @@ exports[`LookingForChallengeWidget snapshots default 1`] = `
|
||||
<h5>
|
||||
<Hyperlink
|
||||
className="d-flex align-items-center"
|
||||
destination="#"
|
||||
destination="course-search-url"
|
||||
variant="brand"
|
||||
>
|
||||
<format-message-function
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Card, Hyperlink, Icon } from '@edx/paragon';
|
||||
import { ArrowForward } from '@edx/paragon/icons';
|
||||
|
||||
import { hooks } from 'data/redux';
|
||||
import moreCoursesSVG from 'assets/more-courses-sidewidget.svg';
|
||||
|
||||
import messages from './messages';
|
||||
@@ -12,6 +13,7 @@ export const arrowIcon = (<Icon className="mx-1" src={ArrowForward} />);
|
||||
|
||||
export const LookingForChallengeWidget = () => {
|
||||
const { formatMessage } = useIntl();
|
||||
const { courseSearchUrl } = hooks.usePlatformSettingsData();
|
||||
return (
|
||||
<Card orientation="horizontal" id="looking-for-challenge-widget">
|
||||
<Card.ImageCap
|
||||
@@ -23,7 +25,7 @@ export const LookingForChallengeWidget = () => {
|
||||
{formatMessage(messages.lookingForChallengePrompt)}
|
||||
</h4>
|
||||
<h5>
|
||||
<Hyperlink variant="brand" destination="#" className="d-flex align-items-center">
|
||||
<Hyperlink variant="brand" destination={courseSearchUrl} className="d-flex align-items-center">
|
||||
{formatMessage(messages.findCoursesButton, { arrow: arrowIcon })}
|
||||
</Hyperlink>
|
||||
</h5>
|
||||
|
||||
@@ -2,6 +2,14 @@ import { shallow } from 'enzyme';
|
||||
|
||||
import LookingForChallengeWidget from '.';
|
||||
|
||||
jest.mock('data/redux', () => ({
|
||||
hooks: {
|
||||
usePlatformSettingsData: () => ({
|
||||
courseSearchUrl: 'course-search-url',
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
describe('LookingForChallengeWidget', () => {
|
||||
describe('snapshots', () => {
|
||||
test('default', () => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { configuration } from 'config';
|
||||
|
||||
const baseUrl = `${configuration.LMS_BASE_URL}`;
|
||||
|
||||
const api = `${baseUrl}/api/`;
|
||||
const api = `${baseUrl}/api`;
|
||||
|
||||
// const init = `${api}learner_home/mock/init`; // mock endpoint for testing
|
||||
const init = `${api}learner_home/init`;
|
||||
const init = `${api}/learner_home/init`;
|
||||
|
||||
const courseUnenroll = `${baseUrl}/change_enrollment`;
|
||||
const updateEmailSettings = `${api}/change_email_settings`;
|
||||
@@ -15,6 +15,9 @@ const entitlementEnrollment = (uuid) => `${api}/entitlements/v1/entitlements/${u
|
||||
const baseAppUrl = (url) => baseUrl + url;
|
||||
const learningMfeUrl = (url) => configuration.LEARNING_MICROFRONTEND_URL + url;
|
||||
|
||||
// static view url
|
||||
const programsUrl = baseAppUrl('/dashboard/programs');
|
||||
|
||||
export default StrictDict({
|
||||
api,
|
||||
init,
|
||||
@@ -23,4 +26,5 @@ export default StrictDict({
|
||||
entitlementEnrollment,
|
||||
baseAppUrl,
|
||||
learningMfeUrl,
|
||||
programsUrl,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user