diff --git a/.env b/.env
index 59fbc88a..3c0d416b 100644
--- a/.env
+++ b/.env
@@ -4,6 +4,7 @@ BASE_URL=null
CREDENTIALS_BASE_URL=null
CSRF_TOKEN_API_PATH=null
ECOMMERCE_BASE_URL=null
+INSIGHTS_BASE_URL=
LANGUAGE_PREFERENCE_COOKIE_NAME=null
LMS_BASE_URL=null
LOGIN_URL=null
@@ -13,4 +14,5 @@ ORDER_HISTORY_URL=null
REFRESH_ACCESS_TOKEN_ENDPOINT=null
SEGMENT_KEY=null
SITE_NAME=null
+STUDIO_BASE_URL=
USER_INFO_COOKIE_NAME=null
diff --git a/.env.development b/.env.development
index d5dca1ed..2bc0c1c1 100644
--- a/.env.development
+++ b/.env.development
@@ -1,5 +1,4 @@
NODE_ENV='development'
-PORT=2000
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
BASE_URL='localhost:2000'
CREDENTIALS_BASE_URL='http://localhost:18150'
@@ -11,7 +10,9 @@ LOGIN_URL='http://localhost:18000/login'
LOGOUT_URL='http://localhost:18000/logout'
MARKETING_SITE_BASE_URL='http://localhost:18000'
ORDER_HISTORY_URL='localhost:1996/orders'
+PORT=2000
REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
SEGMENT_KEY=null
SITE_NAME='edX'
+STUDIO_BASE_URL='http://localhost:18010'
USER_INFO_COOKIE_NAME='edx-user-info'
diff --git a/.env.test b/.env.test
index 4b8d98e0..3fae7f5b 100644
--- a/.env.test
+++ b/.env.test
@@ -1,5 +1,6 @@
+NODE_ENV='test'
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
-BASE_URL='localhost:1995'
+BASE_URL='localhost:2000'
CREDENTIALS_BASE_URL='http://localhost:18150'
CSRF_TOKEN_API_PATH='/csrf/api/v1/token'
ECOMMERCE_BASE_URL='http://localhost:18130'
@@ -9,7 +10,9 @@ LOGIN_URL='http://localhost:18000/login'
LOGOUT_URL='http://localhost:18000/logout'
MARKETING_SITE_BASE_URL='http://localhost:18000'
ORDER_HISTORY_URL='localhost:1996/orders'
+PORT=2000
REFRESH_ACCESS_TOKEN_ENDPOINT='http://localhost:18000/login_refresh'
SEGMENT_KEY=null
SITE_NAME='edX'
+STUDIO_BASE_URL='http://localhost:18010'
USER_INFO_COOKIE_NAME='edx-user-info'
diff --git a/src/courseware/course/Course.jsx b/src/courseware/course/Course.jsx
index d294a046..a02bba89 100644
--- a/src/courseware/course/Course.jsx
+++ b/src/courseware/course/Course.jsx
@@ -72,6 +72,7 @@ function Course({
/>
{isStaff && (
)}
diff --git a/src/courseware/course/InstructorToolbar.jsx b/src/courseware/course/InstructorToolbar.jsx
index ac10c698..0fbe5362 100644
--- a/src/courseware/course/InstructorToolbar.jsx
+++ b/src/courseware/course/InstructorToolbar.jsx
@@ -1,37 +1,68 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import { Collapsible } from '@edx/paragon';
+
+import { getConfig } from '@edx/frontend-platform';
+
+function getInsightsUrl(courseId) {
+ const urlBase = getConfig().INSIGHTS_BASE_URL;
+ let urlFull;
+ if (urlBase) {
+ urlFull = `${urlBase}/courses`;
+ // This shouldn't actually be missing, at present,
+ // but we're providing a reasonable fallback,
+ // in case of either error or extension.
+ if (courseId) {
+ urlFull += `/${courseId}`;
+ }
+ }
+ return urlFull;
+}
+
+function getStudioUrl(courseId, unitId) {
+ const urlBase = getConfig().STUDIO_BASE_URL;
+ let urlFull;
+ if (urlBase) {
+ if (unitId) {
+ urlFull = `${urlBase}/container/${unitId}`;
+ } else if (courseId) {
+ urlFull = `{$urlBase}/course/${courseId}`;
+ }
+ }
+ return urlFull;
+}
function InstructorToolbar(props) {
- if (!props.activeUnitLmsWebUrl) {
- return null;
- }
-
+ const {
+ courseId,
+ unitId,
+ } = props;
+ const urlInsights = getInsightsUrl(courseId);
+ const urlLms = props.activeUnitLmsWebUrl;
+ const urlStudio = getStudioUrl(courseId, unitId);
return (
-
- You are currently previewing the new learning sequence experience.
-
-
- More info →
-
-
-
- This preview is to allow for early content testing, especially for custom content blocks, with the goal of ensuring it renders as expected in the next experience. You can learn more through the following Partner Portal post. Please report any issues or provide feedback using the linked form.
-
-
- Close ×
-
-
-
-
-
-
+ {urlLms && (
+
+ )}
+
+ {urlStudio && (
+
+ )}
+
+ {urlInsights && (
+
+ )}
);
@@ -39,10 +70,14 @@ function InstructorToolbar(props) {
InstructorToolbar.propTypes = {
activeUnitLmsWebUrl: PropTypes.string,
+ courseId: PropTypes.string,
+ unitId: PropTypes.string,
};
InstructorToolbar.defaultProps = {
activeUnitLmsWebUrl: undefined,
+ courseId: undefined,
+ unitId: undefined,
};
const mapStateToProps = (state, props) => {
diff --git a/src/index.jsx b/src/index.jsx
index 21f3461d..d8491164 100755
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -3,6 +3,7 @@ import 'regenerator-runtime/runtime';
import {
APP_INIT_ERROR, APP_READY, subscribe, initialize,
+ mergeConfig,
} from '@edx/frontend-platform';
import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
import React from 'react';
@@ -51,6 +52,14 @@ subscribe(APP_INIT_ERROR, (error) => {
});
initialize({
+ handlers: {
+ config: () => {
+ mergeConfig({
+ INSIGHTS_BASE_URL: process.env.INSIGHTS_BASE_URL || null,
+ STUDIO_BASE_URL: process.env.STUDIO_BASE_URL || null,
+ }, 'LearnerAppConfig');
+ },
+ },
// TODO: Remove this once the course blocks api supports unauthenticated
// access and we are prepared to support public courses in this app.
requireAuthenticatedUser: true,