Finish up basic dates tab support (#70)

- Drop mock data, call real API instead
- Call course metadata API for general info, not the dates API
- Mark text as translatable
- Add badges and timeline dots, group same-day items

AA-116
This commit is contained in:
Michael Terry
2020-05-26 13:15:36 -04:00
committed by GitHub
parent 7487d8d32f
commit bdb1afe990
14 changed files with 385 additions and 167 deletions

View File

@@ -3,9 +3,6 @@ import { getConfig, camelCaseObject } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient, getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { logError } from '@edx/frontend-platform/logging';
// FIXME: remove this WIP hack once we're done developing the tab
import datesTabData from './dates';
function overrideTabUrls(id, tabs) {
// "LMS tab slug" to "MFE URL slug" for overridden tabs
const tabOverrides = {};
@@ -53,11 +50,7 @@ export async function getCourseMetadata(courseId) {
}
export async function getTabData(courseId, tab, version) {
if (tab === 'dates') {
return camelCaseObject(datesTabData());
}
const url = `${getConfig().LMS_BASE_URL}/course/${courseId}/api/course_home/${version}/${tab}`;
const url = `${getConfig().LMS_BASE_URL}/api/course_home/${version}/${tab}/${courseId}`;
const { data } = await getAuthenticatedHttpClient().get(url);
return camelCaseObject(data);
}