From 3b37da26ac12354939470e4f749e2e1b6fb4160c Mon Sep 17 00:00:00 2001 From: ihor-romaniuk Date: Fri, 8 Nov 2024 18:34:20 +0100 Subject: [PATCH] feat: [FC-0070] rendering split test content in unit page --- src/constants.js | 1 + src/course-unit/CourseUnit.jsx | 9 ++- src/course-unit/CourseUnit.scss | 1 + src/course-unit/breadcrumbs/Breadcrumbs.jsx | 64 +++++++++++-------- src/course-unit/breadcrumbs/Breadcrumbs.scss | 2 +- src/course-unit/data/thunk.js | 2 + .../header-navigations/HeaderNavigations.jsx | 8 +-- src/course-unit/header-title/HeaderTitle.jsx | 10 ++- src/course-unit/sidebar/Sidebar.scss | 15 +++++ .../sidebar/SplitTestSidebarInfo.tsx | 61 ++++++++++++++++++ src/course-unit/sidebar/messages.js | 55 ++++++++++++++++ .../xblock-container-iframe/index.scss | 4 ++ .../xblock-container-iframe/index.tsx | 3 +- .../configure-modal/ConfigureModal.jsx | 4 +- src/generic/configure-modal/UnitTab.jsx | 20 ++++-- src/generic/configure-modal/messages.js | 6 +- src/generic/sub-header/SubHeader.jsx | 6 +- src/utils.js | 2 +- 18 files changed, 226 insertions(+), 47 deletions(-) create mode 100644 src/course-unit/sidebar/SplitTestSidebarInfo.tsx create mode 100644 src/course-unit/xblock-container-iframe/index.scss diff --git a/src/constants.js b/src/constants.js index 9e5c5cc84d..6881547134 100644 --- a/src/constants.js +++ b/src/constants.js @@ -59,6 +59,7 @@ export const COURSE_BLOCK_NAMES = ({ sequential: { id: 'sequential', name: 'Subsection' }, vertical: { id: 'vertical', name: 'Unit' }, libraryContent: { id: 'library_content', name: 'Library content' }, + splitTest: { id: 'split_test', name: 'Split Test' }, component: { id: 'component', name: 'Component' }, }); diff --git a/src/course-unit/CourseUnit.jsx b/src/course-unit/CourseUnit.jsx index 5392294cdb..0f810961a7 100644 --- a/src/course-unit/CourseUnit.jsx +++ b/src/course-unit/CourseUnit.jsx @@ -37,6 +37,7 @@ import TagsSidebarControls from '../content-tags-drawer/tags-sidebar-controls'; import { PasteNotificationAlert } from './clipboard'; import XBlockContainerIframe from './xblock-container-iframe'; import MoveModal from './move-modal'; +import SplitTestSidebarInfo from 'CourseAuthoring/course-unit/sidebar/SplitTestSidebarInfo'; const CourseUnit = ({ courseId }) => { const { blockId } = useParams(); @@ -72,6 +73,7 @@ const CourseUnit = ({ courseId }) => { const isUnitVerticalType = unitCategory === COURSE_BLOCK_NAMES.vertical.id; const isUnitLibraryType = unitCategory === COURSE_BLOCK_NAMES.libraryContent.id; + const isSplitTestType = unitCategory === COURSE_BLOCK_NAMES.splitTest.id; const unitLayout = [{ span: 12 }, { span: 0 }]; const defaultLayout = { @@ -161,7 +163,7 @@ const CourseUnit = ({ courseId }) => { )} headerActions={( )} @@ -229,6 +231,11 @@ const CourseUnit = ({ courseId }) => { )} + {isSplitTestType && ( + + + + )} diff --git a/src/course-unit/CourseUnit.scss b/src/course-unit/CourseUnit.scss index 6a7c0c72bd..fa96286310 100644 --- a/src/course-unit/CourseUnit.scss +++ b/src/course-unit/CourseUnit.scss @@ -4,6 +4,7 @@ @import "./sidebar/Sidebar"; @import "./header-title/HeaderTitle"; @import "./move-modal"; +@import "./xblock-container-iframe"; .course-unit { min-width: 900px; diff --git a/src/course-unit/breadcrumbs/Breadcrumbs.jsx b/src/course-unit/breadcrumbs/Breadcrumbs.jsx index 8d770fd23b..0bb8280ad2 100644 --- a/src/course-unit/breadcrumbs/Breadcrumbs.jsx +++ b/src/course-unit/breadcrumbs/Breadcrumbs.jsx @@ -15,41 +15,51 @@ const Breadcrumbs = ({ courseId, sequenceId }) => { const intl = useIntl(); const { ancestorXblocks = [] } = useSelector(getCourseSectionVertical); + const hasChildWithUrl = (children = []) => !!children.filter((child) => child.url).length; + return ( -