diff --git a/package-lock.json b/package-lock.json index 7cea400013..cea8f86584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "core-js": "3.22.2", "history": "5.3.0", "js-cookie": "3.0.1", + "lodash": "4.17.21", "lodash.camelcase": "4.3.0", "prop-types": "15.8.1", "query-string": "^7.1.3", diff --git a/package.json b/package.json index 1fb5a892c0..84146a6f15 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "react-router-dom": "5.3.0", "react-share": "4.4.1", "redux": "4.1.2", + "lodash": "4.17.21", "regenerator-runtime": "0.13.11", "reselect": "4.1.7", "truncate-html": "1.0.4", diff --git a/src/course-home/athena-tab/AthenaTab.jsx b/src/course-home/athena-tab/AthenaTab.jsx new file mode 100644 index 0000000000..dd7724dd3c --- /dev/null +++ b/src/course-home/athena-tab/AthenaTab.jsx @@ -0,0 +1,53 @@ +import { + Card, Button, +} from '@edx/paragon'; + +const colorVariants = ['brand', 'outline-brand', 'primary', 'outline-primary', 'tertiary']; + +const CardComponent = () => { + const randomIndex = Math.floor(Math.random() * colorVariants.length); + const variant = colorVariants[randomIndex]; + + return ( + + + + + This is a card section. It can contain anything but usually text, a list, or list of links. + Multiple sections have a card divider between them. + + + + + + ); +}; + +const generateRandomId = () => { + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + let id = ''; + for (let i = 0; i < 10; i++) { + id += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return id; +}; + +const data = Array.from({ length: 10 }).map(() => ({ id: generateRandomId() })); + +const AthenaTab = () => ( + <> +
+ {data.map(({ id }) => )} +
+ + +); + +export default AthenaTab; diff --git a/src/course-home/data/thunks.js b/src/course-home/data/thunks.js index b7c1c3f9a2..c7abb8a4ea 100644 --- a/src/course-home/data/thunks.js +++ b/src/course-home/data/thunks.js @@ -1,5 +1,6 @@ import { logError } from '@edx/frontend-platform/logging'; import { camelCaseObject } from '@edx/frontend-platform'; +import { cloneDeep } from 'lodash'; import { executePostFromPostEvent, getCourseHomeCourseMetadata, @@ -35,11 +36,23 @@ export function fetchTab(courseId, tab, getTabData, targetUserId) { dispatch(fetchTabRequest({ courseId })); try { const courseHomeCourseMetadata = await getCourseHomeCourseMetadata(courseId, 'outline'); + const formatCourseHomeCourseMetadata = cloneDeep(courseHomeCourseMetadata); + const { tabs: [homeTab] } = formatCourseHomeCourseMetadata; + const { url } = homeTab; + const newTab = { + slug: 'newtab', + title: 'New Tab', + url: url.replace('/home', '/newtab'), + }; + + const { tabs: currentTabs } = formatCourseHomeCourseMetadata; + + formatCourseHomeCourseMetadata.tabs = [...currentTabs, newTab]; dispatch(addModel({ modelType: 'courseHomeMeta', model: { id: courseId, - ...courseHomeCourseMetadata, + ...formatCourseHomeCourseMetadata, }, })); const tabDataResult = getTabData && await getTabData(courseId, targetUserId); diff --git a/src/course-home/outline-tab/Section.jsx b/src/course-home/outline-tab/Section.jsx index 3de888a89a..587f1a07ff 100644 --- a/src/course-home/outline-tab/Section.jsx +++ b/src/course-home/outline-tab/Section.jsx @@ -74,7 +74,7 @@ const Section = ({ return (
  • { title={hasVisitedCourse ? intl.formatMessage(messages.resumeBlurb) : intl.formatMessage(messages.startBlurb)} actions={(